aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorJacob Bachmeyer <jcb62281@gmail.com>2018-12-08 17:28:51 +1100
committerBen Elliston <bje@gnu.org>2018-12-08 17:28:51 +1100
commit01599a0570d858b0ad6e00a32cc7f7e70154059d (patch)
tree914274c20c80bacd3c56861a079340928c242f6e /testsuite
parent9a8e51a8f56193756564d7b1d425aa2d0086dac3 (diff)
downloaddejagnu-01599a0570d858b0ad6e00a32cc7f7e70154059d.zip
dejagnu-01599a0570d858b0ad6e00a32cc7f7e70154059d.tar.gz
dejagnu-01599a0570d858b0ad6e00a32cc7f7e70154059d.tar.bz2
* NEWS: Document 'testsuite' command.
* doc/dejagnu.texi (testsuite procedure): Document multiplex entry point and "testsuite file" command. * lib/framework.exp (testsuite): New proc for multiplex commands. (testsuite_file): New proc implementing "testsuite file". * testsuite/runtest.all/testsuite_file.test: New file. * runtest.exp: Expect to find testsuite in ${srcdir}/testsuite, but also search $srcdir itself. (load_lib): Add explicit search for testsuite-local libraries. (load_tool_init): Use $testsuitedir in search. (load_config): Use $testsuitedir instead of $srcdir. (load_tool_target_config): Likewise. Add variable "testsuitedir" for testsuite root directory. Add internal global variables "testbuilddir" and "testdir" for use by "testsuite file". Ensure that $testsuitedir, $testbuilddir, and $objdir also avoid duplicated path delimiters. Add warning if no tests are found and fallback method of searching $srcdir is used. Signed-off-by: Ben Elliston <bje@gnu.org>
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/runtest.all/testsuite_file.test211
1 files changed, 211 insertions, 0 deletions
diff --git a/testsuite/runtest.all/testsuite_file.test b/testsuite/runtest.all/testsuite_file.test
new file mode 100644
index 0000000..c7e13ff
--- /dev/null
+++ b/testsuite/runtest.all/testsuite_file.test
@@ -0,0 +1,211 @@
+# test "testsuite file" API call -*- Tcl -*-
+
+set srcdir [lindex $argv 0]
+set subdir [lindex $argv 1]
+set objdir [lindex $argv 2]
+
+if [ file exists $objdir/setval.tmp ] {
+ source $objdir/setval.tmp
+} else {
+ puts "ERROR: $objdir/setval.tmp doesn't exist"
+}
+if [ file exists $srcdir/$subdir/default_procs.tcl ] {
+ source "$srcdir/$subdir/default_procs.tcl"
+} else {
+ puts "ERROR: $srcdir/$subdir/default_procs.tcl doesn't exist"
+}
+if [ file exists $srcdir/../lib/framework.exp] {
+ source $srcdir/../lib/framework.exp
+} else {
+ puts "ERROR: $srcdir/../lib/framework.exp doesn't exist"
+}
+if [ file exists $srcdir/../lib/utils.exp] {
+ source $srcdir/../lib/utils.exp
+} else {
+ puts "ERROR: $srcdir/../lib/utils.exp doesn't exist"
+}
+
+# basic tests
+
+set testsuitedir /src/foo/testsuite
+set testbuilddir /build/foo/testsuite
+set testdir [file join $testsuitedir foo.all]
+
+run_tests {
+ { "#" "basic syntax errors" }
+ { lib_errpat_test testsuite { file }
+ "*testsuite file requires one of *-top*-test*"
+ "testsuite file without arguments" }
+ { lib_errpat_test testsuite { file -bogus }
+ "*unrecognized flag -bogus"
+ "testsuite file with bogus flag" }
+ { lib_errpat_test testsuite { file -- }
+ "*testsuite file requires one of *-top*-test*"
+ "testsuite file without directory level flag, only --" }
+ { lib_errpat_test testsuite { file -source }
+ "*testsuite file requires one of *-top*-test*"
+ "testsuite file without directory level flag, only -source" }
+ { lib_errpat_test testsuite { file -object }
+ "*testsuite file requires one of *-top*-test*"
+ "testsuite file without directory level flag, only -object" }
+ { lib_errpat_test testsuite { file -hypothetical }
+ "*testsuite file requires one of *-top*-test*"
+ "testsuite file without directory level flag, only -hypothetical" }
+ { lib_errpat_test testsuite { file -- foo bar }
+ "*testsuite file requires one of *-top*-test*"
+ "testsuite file without directory level flag, only -- and names" }
+ { lib_errpat_test testsuite { file foo bar }
+ "*testsuite file requires one of *-top*-test*"
+ "testsuite file without directory level flag, only names" }
+ { lib_errpat_test testsuite { file -- -top }
+ "*testsuite file requires one of *-top*-test*"
+ "testsuite file with directory level flag after --" }
+ { lib_errpat_test testsuite { file foo -top }
+ "*testsuite file requires one of *-top*-test*"
+ "testsuite file with directory level flag after name" }
+
+ { "#" "basic variable retrieval" }
+ { lib_ret_test testsuite
+ { file -source -top -hypothetical } "/src/foo/testsuite"
+ "testsuite file -source -top for fixed example" }
+ { lib_ret_test testsuite
+ { file -top -hypothetical } "/src/foo/testsuite"
+ "testsuite file -top defaults to -source" }
+ { lib_ret_test testsuite
+ { file -object -top -hypothetical } "/build/foo/testsuite"
+ "testsuite file -object -top for fixed example" }
+ { lib_ret_test testsuite
+ { file -source -test -hypothetical } "/src/foo/testsuite/foo.all"
+ "testsuite file -source -test for fixed example" }
+ { lib_ret_test testsuite
+ { file -test -hypothetical } "/src/foo/testsuite/foo.all"
+ "testsuite file -test defaults to -source" }
+ { lib_ret_test testsuite
+ { file -object -test -hypothetical } "/build/foo/testsuite/foo.all"
+ "testsuite file -object -test for fixed example" }
+
+ { "#" "append file name elements" }
+ { lib_ret_test testsuite
+ { file -source -top -hypothetical lib foo }
+ "/src/foo/testsuite/lib/foo"
+ "testsuite file -source -top lib foo for fixed example" }
+ { lib_ret_test testsuite
+ { file -object -top -hypothetical lib foo }
+ "/build/foo/testsuite/lib/foo"
+ "testsuite file -object -top lib foo for fixed example" }
+ { lib_ret_test testsuite
+ { file -source -test -hypothetical bar }
+ "/src/foo/testsuite/foo.all/bar"
+ "testsuite file -source -test bar for fixed example" }
+ { lib_ret_test testsuite
+ { file -object -test -hypothetical bar }
+ "/build/foo/testsuite/foo.all/bar"
+ "testsuite file -object -test bar for fixed example" }
+
+ { "#" "-- properly handled" }
+ { lib_ret_test testsuite
+ { file -source -top -hypothetical -- -lib -- foo }
+ "/src/foo/testsuite/-lib/--/foo"
+ "testsuite file -source -top -- -lib -- foo for fixed example" }
+ { lib_ret_test testsuite
+ { file -object -top -hypothetical -- -lib -foo }
+ "/build/foo/testsuite/-lib/-foo"
+ "testsuite file -object -top -- -lib -foo for fixed example" }
+ { lib_ret_test testsuite
+ { file -source -test -hypothetical -- bar -object }
+ "/src/foo/testsuite/foo.all/bar/-object"
+ "testsuite file -source -test -- bar -object for fixed example" }
+ { lib_ret_test testsuite
+ { file -object -test -hypothetical -- -bar }
+ "/build/foo/testsuite/foo.all/-bar"
+ "testsuite file -object -test -- -bar for fixed example" }
+
+ { "#" "apparent command substitutions are safe" }
+ { lib_ret_test testsuite
+ { file -source -top -hypothetical lib foo [bogus] }
+ "/src/foo/testsuite/lib/foo/[bogus]"
+ "testsuite file -source -top foo [bogus] for fixed example" }
+ { lib_ret_test testsuite
+ { file -object -top -hypothetical lib foo [bogus] }
+ "/build/foo/testsuite/lib/foo/[bogus]"
+ "testsuite file -object -top foo [bogus] for fixed example" }
+ { lib_ret_test testsuite
+ { file -source -test -hypothetical bar [bogus] }
+ "/src/foo/testsuite/foo.all/bar/[bogus]"
+ "testsuite file -source -test bar [bogus] for fixed example" }
+ { lib_ret_test testsuite
+ { file -object -test -hypothetical bar [bogus] }
+ "/build/foo/testsuite/foo.all/bar/[bogus]"
+ "testsuite file -object -test bar [bogus] for fixed example" }
+
+ { "#" "apparent variable substitutions are safe" }
+ { lib_ret_test testsuite
+ { file -source -top -hypothetical lib foo $bogus }
+ "/src/foo/testsuite/lib/foo/$bogus"
+ "testsuite file -source -top foo $bogus for fixed example" }
+ { lib_ret_test testsuite
+ { file -object -top -hypothetical lib foo $bogus }
+ "/build/foo/testsuite/lib/foo/$bogus"
+ "testsuite file -object -top foo $bogus for fixed example" }
+ { lib_ret_test testsuite
+ { file -source -test -hypothetical bar $bogus }
+ "/src/foo/testsuite/foo.all/bar/$bogus"
+ "testsuite file -source -test bar $bogus for fixed example" }
+ { lib_ret_test testsuite
+ { file -object -test -hypothetical bar $bogus }
+ "/build/foo/testsuite/foo.all/bar/$bogus"
+ "testsuite file -object -test bar $bogus for fixed example" }
+}
+
+set testsuitedir $srcdir
+set testbuilddir $objdir
+set testdir [file join $srcdir $subdir]
+
+run_tests [subst -nocommands {
+ { lib_ret_test testsuite { file -source -top } $srcdir
+ "testsuite file -source -top" }
+ { lib_ret_test testsuite { file -source -test } $testdir
+ "testsuite file -source -test" }
+ { lib_ret_test testsuite { file -object -top } $objdir
+ "testsuite file -object -top" }
+ { lib_errpat_test testsuite { file -source -test {[bogus]} foo }
+ "directory '*\\\\[bogus\\\\]' does not exist"
+ "testsuite file raises error on bogus source directory" }
+}]
+
+# test object directory creation
+
+if { [file isdirectory [file join $objdir empty-test-dir]] } {
+ file delete -force -- [file join $objdir empty-test-dir]
+}
+if { [file isdirectory [file join $objdir empty-test-dir]] } {
+ perror "[file join $objdir empty-test-dir] exists and cannot be removed"
+}
+
+run_tests [subst {
+ { lib_ret_test testsuite
+ { file -object -top -hypothetical empty-test-dir foo }
+ [file join $objdir empty-test-dir foo]
+ "testsuite file implying hypothetical directory" }
+}]
+
+if { ![file isdirectory [file join $objdir empty-test-dir]] } {
+ puts "PASSED: testsuite file does not create hypothetical implied directory"
+} else {
+ puts "FAILED: testsuite file does not create hypothetical implied directory"
+}
+
+run_tests [subst {
+ { lib_ret_test testsuite
+ { file -object -top empty-test-dir foo }
+ [file join $objdir empty-test-dir foo]
+ "testsuite file implying new object directory" }
+}]
+
+if { [file isdirectory [file join $objdir empty-test-dir]] } {
+ puts "PASSED: testsuite file creates new implied object directory"
+} else {
+ puts "FAILED: testsuite file creates new implied object directory"
+}
+
+file delete -force [file join $objdir empty-test-dir]