File: RunAllTests.bsh

package info (click to toggle)
bsh 2.0b4-20
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, trixie
  • size: 4,224 kB
  • sloc: java: 23,431; xml: 4,500; sh: 139; makefile: 24
file content (85 lines) | stat: -rw-r--r-- 1,802 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh
#! The following hack allows java to reside anywhere in the path.
//bin/sh -c "exec java bsh.Interpreter $0 $*"; exit

// Change to the test directory
path=pathToFile( getSourceFileInfo() ).getAbsolutePath();
cd( dirname( path ) );

list=pathToFile( bsh.cwd ).list();

failed=false;
warnings=false;
failedTests = "";
warnedTests = "";

// Test the test harness
// Yes, it's been an issue before.
r=run("Fail.bsh");
if ( r.test_failed == void || !r.test_failed 
	|| !r.test_completed == void || !r.test_completed ) {
	print("Test harness failure: Fail.bsh!");
	exit();
}

time=System.currentTimeMillis();

for( i=0; i<list.length; i++) 
{
	f=list[i];

	if ( !f.endsWith(".bsh") 
		|| f.equals("RunAllTests.bsh") 
		|| f.equals("Fail.bsh") 
		|| f.equals("TestHarness.bsh" ) 
		//|| f.equals("LastTest.bsh" ) 
	) 
	{
		print("Skipping File: "+f);
		continue;
	}

	print("Running test: "+f);
	try {
		r=run(f);
	} catch ( EvalError e) {
		print("Script: "+f+" produced an eval Error: " + e );
		r=object();
		r.test_failed = true;
	}

	if ( r.test_failed == void )
		r.test_failed = true;
	if ( r.test_completed == void )
		r.test_completed = false;
	if ( r.test_warning == void )
		r.test_warning = false;

	if ( r.test_failed || !r.test_completed ) {
		print("Test: "+f+" FAILED!");

		failed = true;
		failedTests = failedTests + "\t" + f + "\n";
	}

	if ( r.test_warning ) {
		warnings = true;
		warnedTests = warnedTests + "\t" + f + "\n";
	}
}

print("----------------------------------------");
if ( failed  )
	print("FAILED Tests:\n" + failedTests);

if ( warnings )
	print("Warnings on Tests:\n" + warnedTests);

if ( !failed && !warnings )
	print("All tests passed OK.");

print("Time to run all tests: "+(System.currentTimeMillis() - time) + "ms");

if ( !bsh.interactive )
	exit();