@@ -220,18 +220,6 @@ function lookForEntry(entry, data) {
220220 return null ;
221221}
222222
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-
235223function load_files ( out_folder , crate ) {
236224 var mainJs = readFile ( out_folder + "/main.js" ) ;
237225 var ALIASES = readFile ( out_folder + "/aliases.js" ) ;
@@ -266,44 +254,32 @@ function load_files(out_folder, crate) {
266254}
267255
268256function 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 ]" ) ;
271259 return 1 ;
272260 }
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 ] ;
276265
277266 var errors = 0 ;
278267
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 ] ;
286270
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" ) ) {
290273 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 ) {
299274 console . error ( "FAILED" ) ;
300- console . error ( ret ) ;
301- errors += 1 ;
302- return ;
275+ console . error ( "==> Missing '" + test_name + ".js' file..." ) ;
276+ continue ;
303277 }
304278
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" ) +
307283 'exports.QUERY = QUERY;exports.EXPECTED = EXPECTED;' ) ;
308284 const expected = loadedFile . EXPECTED ;
309285 const query = loadedFile . QUERY ;
@@ -351,7 +327,7 @@ function main(argv) {
351327 } else {
352328 console . log ( "OK" ) ;
353329 }
354- } ) ;
330+ }
355331 return errors ;
356332}
357333
0 commit comments