@@ -220,18 +220,6 @@ function lookForEntry(entry, data) {
220
220
return null ;
221
221
}
222
222
223
- function build_docs ( out_dir , rustdoc_path , file_to_document ) {
224
- var c = spawnSync ( rustdoc_path , [ file_to_document , '-o' , out_dir ] ) ;
225
- var s = '' ;
226
- if ( c . error || c . stderr . length > 0 ) {
227
- if ( c . stderr . length > 0 ) {
228
- s += '==> STDERR: ' + c . stderr + '\n' ;
229
- }
230
- s += '==> ERROR: ' + c . error ;
231
- }
232
- return s ;
233
- }
234
-
235
223
function load_files ( out_folder , crate ) {
236
224
var mainJs = readFile ( out_folder + "/main.js" ) ;
237
225
var ALIASES = readFile ( out_folder + "/aliases.js" ) ;
@@ -266,44 +254,32 @@ function load_files(out_folder, crate) {
266
254
}
267
255
268
256
function main ( argv ) {
269
- if ( argv . length !== 4 ) {
270
- console . error ( "USAGE: node tester.js [TOOLCHAIN] [STAGE ]" ) ;
257
+ if ( argv . length < 4 ) {
258
+ console . error ( "USAGE: node tester.js OUT_FOLDER [TESTS ]" ) ;
271
259
return 1 ;
272
260
}
273
- const toolchain = argv [ 2 ] ;
274
- const stage = argv [ 3 ] ;
275
- const rustdoc_path = './build/' + toolchain + '/stage' + stage + '/bin/rustdoc' ;
261
+ if ( argv [ 2 ] . substr ( - 1 ) !== "/" ) {
262
+ argv [ 2 ] += "/" ;
263
+ }
264
+ const out_folder = argv [ 2 ] ;
276
265
277
266
var errors = 0 ;
278
267
279
- fs . readdirSync ( TEST_FOLDER ) . forEach ( function ( file ) {
280
- if ( ! file . endsWith ( '.js' ) ) {
281
- return ;
282
- }
283
- var test_name = file . substring ( 0 , file . length - 3 ) ;
284
- process . stdout . write ( 'Checking "' + test_name + '" ... ' ) ;
285
- var rust_file = TEST_FOLDER + test_name + '.rs' ;
268
+ for ( var j = 3 ; j < argv . length ; ++ j ) {
269
+ const test_name = argv [ j ] ;
286
270
287
- if ( ! fs . existsSync ( rust_file ) ) {
288
- console . error ( "FAILED" ) ;
289
- console . error ( "==> Missing '" + test_name + ".rs' file..." ) ;
271
+ process . stdout . write ( 'Checking "' + test_name + '" ... ' ) ;
272
+ if ( ! fs . existsSync ( TEST_FOLDER + test_name + ".js" ) ) {
290
273
errors += 1 ;
291
- return ;
292
- }
293
-
294
- var out_folder = "build/" + toolchain + "/stage" + stage + "/tests/rustdoc-js/" +
295
- test_name ;
296
-
297
- var ret = build_docs ( out_folder , rustdoc_path , rust_file ) ;
298
- if ( ret . length > 0 ) {
299
274
console . error ( "FAILED" ) ;
300
- console . error ( ret ) ;
301
- errors += 1 ;
302
- return ;
275
+ console . error ( "==> Missing '" + test_name + ".js' file..." ) ;
276
+ continue ;
303
277
}
304
278
305
- var [ loaded , index ] = load_files ( out_folder , test_name ) ;
306
- var loadedFile = loadContent ( readFile ( TEST_FOLDER + file ) +
279
+ const test_out_folder = out_folder + test_name ;
280
+
281
+ var [ loaded , index ] = load_files ( test_out_folder , test_name ) ;
282
+ var loadedFile = loadContent ( readFile ( TEST_FOLDER + test_name + ".js" ) +
307
283
'exports.QUERY = QUERY;exports.EXPECTED = EXPECTED;' ) ;
308
284
const expected = loadedFile . EXPECTED ;
309
285
const query = loadedFile . QUERY ;
@@ -351,7 +327,7 @@ function main(argv) {
351
327
} else {
352
328
console . log ( "OK" ) ;
353
329
}
354
- } ) ;
330
+ }
355
331
return errors ;
356
332
}
357
333
0 commit comments