]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/mkhtml.pl
3 # mkhtml.pl cruises through your $MOZ_SRC/mozilla/js/tests/ subdirectories,
4 # and for any .js file it finds, creates an HTML file that includes:
5 # $MOZ_SRC/mozilla/js/tests/$suite/shell.js, $
6 # MOZ_SRC/mozilla/js/tests/$suite/browser.js,
7 # and the test.js file.
11 $moz_src = $ENV{"MOZ_SRC"} ||
12 die ("You need to set your MOZ_SRC environment variable.\n");
14 $test_home = $moz_src ."/js/tests/";
16 opendir (TEST_HOME
, $test_home);
17 @__suites = readdir (TEST_HOME
);
20 foreach (@__suites ) {
21 if ( -d
$_ && $_ !~ /\./ && $_ !~ 'CVS' ) {
22 $suites[$#suites+1] = $_;
26 die ( "Specify a directory: ". join(" ", @suites) ."\n" );
29 $js_test_dir = $moz_src . "/js/tests/" . $ARGV[0] ."/";
31 print "Generating html files for the tests in $js_test_dir\n";
33 $shell_js = $js_test_dir . "shell.js";
34 $browser_js = $js_test_dir . "browser.js";
36 # cd to the test directory
38 die "Couldn't chdir to js_test_dir, which is $js_test_dir\n";
40 print ( "js_test_dir is $js_test_dir\n" );
42 # read the test directory
43 opendir ( JS_TEST_DIR
, $js_test_dir );
44 # || die "Couldn't open js_test_dir, which is $js_test_dir\n";
45 @js_test_dir_items = readdir( JS_TEST_DIR
);
46 # || die "Couldn't read js_test_dir, which is $js_test_dir\n";
47 closedir( JS_TEST_DIR
);
49 print ("The js_test_dir_items are: " . join( ",", @js_test_dir_items ) . "\n");
51 # figure out which of the items are directories
52 foreach $js_test_subdir ( @js_test_dir_items ) {
53 if ( -d
$js_test_subdir ) {
55 $js_test_subdir = $js_test_dir ."/" . $js_test_subdir;
57 || die "Couldn't chdir to js_test_subdir $js_test_subdir\n";
58 print "Just chdir'd to $js_test_subdir \n";
60 opendir( JS_TEST_SUBDIR
, $js_test_subdir );
61 @subdir_tests = readdir( JS_TEST_SUBDIR
);
62 closedir( JS_TEST_SUBDIR
);
64 foreach ( @subdir_tests ) {
67 if ( $_ =~ /\.js$/ ) {
70 open( HTML_TEST
, "> $_")
71 || die "Can't open html file $test_html\n";
73 '<script src=./../shell.js></script>';
75 '<script src=./../browser.js></script>';
77 '<script src=./' . $js_test. '></script>';