Skip to content

Commit

Permalink
Add switching between "Parsing" and "Serialization" suites
Browse files Browse the repository at this point in the history
  • Loading branch information
generalmimon committed Oct 12, 2023
1 parent 8a6e5c5 commit 6bda341
Showing 1 changed file with 68 additions and 30 deletions.
98 changes: 68 additions & 30 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,27 @@
<div class="form-group col-md-4">
<input name="filterTarget" class="form-control" v-model="filterTarget" placeholder="Search target...">
</div>
<div class="col-md-4 options-column">
<label class="checkbox-inline" for="only-failures-checkbox">
<input type="checkbox" v-model="skipPassed" id="only-failures-checkbox">
Only failures
</label>
<label class="checkbox-inline" for="group-by-lang">
<input type="checkbox" v-model="groupByLang" id="group-by-lang">
Group columns by language
</label>
<div class="col-md-4">
<div class="options-column">
<label class="checkbox-inline" for="only-failures-checkbox">
<input type="checkbox" v-model="skipPassed" id="only-failures-checkbox">
Only failures
</label>
<label class="checkbox-inline" for="group-by-lang">
<input type="checkbox" v-model="groupByLang" id="group-by-lang">
Group columns by language
</label>
</div>
<div class="options-column">
<label class="radio-inline" for="suite-readonly">
<input type="radio" name="suite" id="suite-readonly" value="readonly" v-model="suite">
Parsing
</label>
<label class="radio-inline" for="suite-readwrite">
<input type="radio" name="suite" id="suite-readwrite" value="readwrite" v-model="suite">
Serialization
</label>
</div>
</div>
</div>
</form>
Expand All @@ -43,10 +55,11 @@
}
.form-row .options-column {
display: inline-block;
padding-left: 12px;
}
.col-md-4 label.checkbox-inline {
.col-md-4 label.checkbox-inline, .col-md-4 label.radio-inline {
padding-top: 6px;
padding-bottom: 6px;
}
Expand Down Expand Up @@ -101,48 +114,71 @@ const TARGET_PAIRS = [
TARGET_PAIRS.forEach(pair => Object.freeze(pair));
Object.freeze(TARGET_PAIRS);
const TARGET_LANGS_READWRITE = new Set([
"java",
"python",
]);
Object.freeze(TARGET_LANGS_READWRITE);
export default {
name: 'app',
components: {
CiGrid
},
data: function () {
return {
testData: {},
filterTest: '',
filterTarget: '',
gridColumns: [],
gridMeta: {},
suiteData: {
readonly: {
testData: {},
gridColumns: [],
gridMeta: {},
},
readwrite: {
testData: {},
gridColumns: [],
gridMeta: {},
},
},
skipPassed: false,
groupByLang: true,
suite: 'readonly',
};
},
created: function () {
const pairCmpFunc = this.getPairCompareFunc(TARGET_PAIRS);
TARGET_PAIRS.forEach(pair => this.addOneJson(pair[0], pair[1], pairCmpFunc));
TARGET_PAIRS.forEach(pair => {
this.addOneJson(pair[0], pair[1], pairCmpFunc, 'readonly');
if (TARGET_LANGS_READWRITE.has(pair[0])) {
this.addOneJson(pair[0], pair[1], pairCmpFunc, 'readwrite');
}
});
},
computed: {
groupedGridColumns: function () {
const gridColumns = this.suiteData[this.suite].gridColumns;
if (!this.groupByLang) {
return this.gridColumns;
return gridColumns;
}
return Array.from(
new Set(
this.gridColumns.map(pair => pair.split('/')[0])
gridColumns.map(pair => pair.split('/')[0])
)
);
},
groupedGridData: function () {
const suiteData = this.suiteData[this.suite];
if (!this.groupByLang) {
return Object.entries(this.testData)
return Object.entries(suiteData.testData)
.map(([testName, testRow]) => ({name: testName, value: testRow}));
}
const rows = [];
for (const testName in this.testData) {
const testRow = this.testData[testName];
for (const testName in suiteData.testData) {
const testRow = suiteData.testData[testName];
const newTestRow = {};
rows.push({name: testName, value: newTestRow});
this.gridColumns.forEach(key => {
suiteData.gridColumns.forEach(key => {
let value = testRow[key];
if (!value) {
value = {};
Expand Down Expand Up @@ -206,11 +242,12 @@ export default {
return rows;
},
groupedGridMeta: function () {
const gridMeta = this.suiteData[this.suite].gridMeta;
if (!this.groupByLang) {
return this.gridMeta;
return gridMeta;
}
const newGridMeta = {};
Object.entries(this.gridMeta).forEach(([pair, meta]) => {
Object.entries(gridMeta).forEach(([pair, meta]) => {
const lang = pair.split('/')[0];
if (!Object.prototype.hasOwnProperty.call(newGridMeta, lang)) {
newGridMeta[lang] = {
Expand Down Expand Up @@ -240,8 +277,10 @@ export default {
},
},
methods: {
addOneJson: function (lang, version, pairCmpFunc) {
addOneJson: function (lang, version, pairCmpFunc, suite) {
var pair = lang + "/" + version;
lang += (suite === 'readwrite' ? "-write" : "");
const suiteData = this.suiteData[suite];
console.log("Querying data for", pair);
fetch(
"https://raw.githubusercontent.com/kaitai-io/ci_artifacts/" + pair + "/test_out/" + lang + "/ci.json"
Expand All @@ -259,11 +298,10 @@ export default {
var numPassed = 0;
var numKst = 0;
for (const testName in json) {
if (!Object.prototype.hasOwnProperty.call(this.testData, testName)) {
this.testData[testName] = {};
if (!Object.prototype.hasOwnProperty.call(suiteData.testData, testName)) {
suiteData.testData[testName] = {};
}
var row = this.testData[testName];
delete json[testName]["name"];
var row = suiteData.testData[testName];
row[pair] = json[testName];
if (row[pair].status === 'passed')
numPassed++;
Expand All @@ -272,14 +310,14 @@ export default {
}
// Generate output
this.gridColumns.push(pair);
this.gridColumns = this.gridColumns.sort(pairCmpFunc);
suiteData.gridColumns.push(pair);
suiteData.gridColumns.sort(pairCmpFunc);
meta.passed = numPassed;
meta.kst = numKst;
meta.timestamp = new Date(meta.timestamp);
meta.artifactsUrl = "https://github.com/kaitai-io/ci_artifacts/tree/" + pair + "/test_out/" + lang;
this.gridMeta[pair] = meta;
suiteData.gridMeta[pair] = meta;
}).catch(err => {
console.warn("Cannot fetch data for " + pair + ". " + err);
});
Expand Down

0 comments on commit 6bda341

Please sign in to comment.