Skip to content

Commit 865b1b8

Browse files
committed
Let run rntuple_test.js without cd, adjust CI
1 parent 8e136d1 commit 865b1b8

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

.github/workflows/jsroot-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
node demo/node/file_proxy.js multi ./hsimple.root
6464
node demo/node/file_proxy.js buffer ./hsimple.root
6565
node demo/node/buffer_test.js
66-
cd demo/node; node rntuple_test.js; cd ../..
66+
node demo/node/rntuple_test.js demo/node/rntuple_test.root
6767
node demo/node/build3d.js
6868
6969
tests_ubuntu:
@@ -178,7 +178,7 @@ jobs:
178178
node demo/node/file_proxy.js multi ./hsimple.root
179179
node demo/node/file_proxy.js buffer ./hsimple.root
180180
node demo/node/buffer_test.js
181-
cd demo/node; node rntuple_test.js; cd ../..
181+
node demo/node/rntuple_test.js demo/node/rntuple_test.root
182182
node demo/node/build3d.js
183183
184184
build-windows:
@@ -227,7 +227,7 @@ jobs:
227227
node demo/node/file_proxy.js multi ./hsimple.root
228228
node demo/node/file_proxy.js buffer ./hsimple.root
229229
node demo/node/buffer_test.js
230-
cd demo/node; node rntuple_test.js; cd ../..
230+
node demo/node/rntuple_test.js demo/node/rntuple_test.root
231231
node demo/node/build3d.js
232232
233233

demo/node/rntuple_test.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ import { version, openFile, TSelector } from 'jsroot';
33
import { readHeaderFooter, readEntry, rntupleProcess } from 'jsroot/rntuple';
44

55
console.log(`JSROOT version ${version}`);
6-
// const file = await openFile('https://jsroot.gsi.de/files/tmp/ntpl001_staff.root'),
7-
// rntuple = await file.readObject('Staff');
8-
const file = await openFile('./rntuple_test.root'),
9-
rntuple = await file.readObject('Data');
6+
7+
8+
let filename = './rntuple_test.root';
9+
if (process?.argv && process.argv[2])
10+
filename = process.argv[2];
11+
12+
const file = await openFile(filename),
13+
rntuple = await file.readObject('Data');
1014

1115
await readHeaderFooter(rntuple);
1216

@@ -41,11 +45,11 @@ else {
4145
else
4246
console.log(`OK: Field ${i}: ${field.fieldName} (${field.typeName})`);
4347
if (i === 0) {
44-
if (field.fieldName !== 'IntField' || field.typeName !== 'std::int32_t')
45-
console.error(`FAILURE: First field should be 'IntField (std::int32_t)' but got '${field.fieldName} (${field.typeName})'`);
48+
if (field.fieldName !== 'IntField' || field.typeName !== 'std::int32_t')
49+
console.error(`FAILURE: First field should be 'IntField (std::int32_t)' but got '${field.fieldName} (${field.typeName})'`);
4650
} else if (i === rntuple.builder.fieldDescriptors.length - 1){
4751
if (field.fieldName !== 'StringField' || field.typeName !== 'std::string')
48-
console.error(`FAILURE: Last field should be 'StringField (std::string)' but got '${field.fieldName} (${field.typeName})'`);
52+
console.error(`FAILURE: Last field should be 'StringField (std::string)' but got '${field.fieldName} (${field.typeName})'`);
4953
}
5054
}
5155
}
@@ -93,7 +97,7 @@ const EPSILON = 1e-10;
9397

9498
for (let entryIndex = 0; entryIndex < 10; ++entryIndex) {
9599
console.log(`\nChecking entry ${entryIndex}:`);
96-
100+
97101
const expected = {
98102
IntField: entryIndex,
99103
FloatField: entryIndex * entryIndex,

0 commit comments

Comments
 (0)