2 # Author
: Petter Reinholdtsen
<pere@td.org.uit.no
>
4 # Java regression tester
for DejaGNU
10 #
Compile and run all available java source
12 proc test
-java
-source
{ } {
18 foreach src
[lsort
[glob
-nocomplain $srcdir
/$subdir
/*.java
]] {
19 #
If we
're only testing specific files and this isn't one of them
,
21 if ![runtest_file_p $runtests $src
] then {
25 java
-compile-execute $src
28 # Find all jasmin
(java assambler
) files
29 foreach src
[lsort
[glob
-nocomplain $srcdir
/$subdir
/*.j
]] {
30 #
If we
're only testing specific files and this isn't one of them
,
32 if ![runtest_file_p $runtests $src
] then {
36 jasmin
-assemble
-execute $src
43 proc java
-compile { args } {
47 set comp_output
[javac
-target
-compile "$src" "$output" executable $options];
53 proc jasmin
-assemble
{ args } {
57 set comp_output
[jasmin
-target
-assemble
"$src" "$output" executable $options];
61 #
Compile $
args and
execute java class runtime_test
63 proc java
-compile-execute { args } {
67 set comp_output
[java
-compile $
args]
68 if ![regexp
"^$" $comp_output] {
69 #
Do not care about kaffes stupid messages
78 set classpath
[getenv CLASSPATH
]
79 setenv CLASSPATH
"${srcdir}/$subdir:$classpath"
81 # XXX There must be a better way to
get basename
82 catch
{exec basename $
args .java
} basename
83 catch
{exec $java $basename
} run_output
84 exec rm
-f
"${srcdir}/$subdir/$basename.class"
87 foreach line
[split $run_output
\n] {
88 if [regexp
"PASSED:.*" $line] {
89 if ![regexp
"^$" $lines] {
94 if [regexp
"FAILED:.*" $line] {
97 # Accumulate
"wild" lines
98 if ![regexp
"^$" $lines] {
99 set lines
"$lines\n $line"
106 if ![regexp
"^$" $lines] {
111 setenv CLASSPATH
"$classpath"
117 #
Compile $
args and
execute java class runtime_test
119 proc jasmin
-assemble
-execute { args } {
123 set comp_output
[jasmin
-assemble $
args]
124 if ![regexp
"^$" $comp_output] {
126 #print
"$comp_output"
130 # XXX Should use some default value
134 set classpath
[getenv CLASSPATH
]
135 setenv CLASSPATH
"${srcdir}/$subdir:$classpath"
137 # XXX There must be a better way to
get basename
138 catch
{exec basename $
args .j
} basename
139 catch
{exec $java $basename
} run_output
140 exec rm
-f
"${srcdir}/$subdir/$basename.class"
143 foreach line
[split $run_output
\n] {
144 if [regexp
"PASSED:.*" $line] {
145 if ![regexp
"^$" $lines] {
150 if [regexp
"FAILED:.*" $line] {
153 # Accumulate
"wild" lines
154 if ![regexp
"^$" $lines] {
155 set lines
"$lines\n $line"
162 if ![regexp
"^$" $lines] {
167 setenv CLASSPATH
"$classpath"
173 #
Compile java source
175 proc javac
-target
-compile { source dest type options
} {
176 # XXX
Do it the simple way
- should use target_compile
181 catch
{exec $javac $source
} comp_output
185 # lappend options
"compiler=javac"
186 # lappend options
"additional_flags=-g"
187 # lappend options
"libs="
188 # lappend options
"ldflags="
189 #
return [target_compile $source $dest $type $options
]
193 #
Compile jasmin
(java assambly
) source
195 proc jasmin
-target
-assemble
{ source dest type options
} {
198 # XXX
Do it the simple way
- should use target_compile
203 catch
{exec $java jasmin.Main
-d $srcdir
/$subdir $source
} comp_output
207 # lappend options
"compiler=javac"
208 # lappend options
"additional_flags=-g"
209 # lappend options
"libs="
210 # lappend options
"ldflags="
211 #
return [target_compile $source $dest $type $options
]