aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorJacob Bachmeyer <jcb62281@gmail.com>2018-12-04 19:28:54 +1100
committerBen Elliston <bje@gnu.org>2018-12-04 19:28:54 +1100
commit91b267562d94064d00c709fcdcef29f225a80c5b (patch)
tree6faf52e868c8d2d8243eb2e487fe1dca4704b94f /testsuite
parentcb56b0093c860f2e66544813cd354bcb46b4ac88 (diff)
downloaddejagnu-91b267562d94064d00c709fcdcef29f225a80c5b.zip
dejagnu-91b267562d94064d00c709fcdcef29f225a80c5b.tar.gz
dejagnu-91b267562d94064d00c709fcdcef29f225a80c5b.tar.bz2
* lib/utils.exp (relative_filename): New proc.
* runtest.exp: Use it. * doc/dejagnu.texi (relative_filename procedure): Document it. * testsuite/runtest.all/utils.test: Add tests for relative_filename. Signed-off-by: Ben Elliston <bje@gnu.org>
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/runtest.all/utils.test23
1 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/runtest.all/utils.test b/testsuite/runtest.all/utils.test
index be13982..b8e05da 100644
--- a/testsuite/runtest.all/utils.test
+++ b/testsuite/runtest.all/utils.test
@@ -42,6 +42,29 @@ if [lib_pat_test "getdirs" "${srcdir}/runtest.all/topdir" "subdir1*subdir2" ] {
puts "PASSED: getdirs toplevel, two subdirs"
}
+# Test relative_filename:
+#
+if { [relative_filename "/foo/test" "/foo/test/bar/baz" ] == "bar/baz" } {
+ puts "PASSED: relative_filename, simple prefix"
+} else {
+ puts "FAILED: relative_filename, simple prefix"
+}
+if { [relative_filename "/foo/test" "/bar/test" ] == "../../bar/test" } {
+ puts "PASSED: relative_filename, up to top"
+} else {
+ puts "FAILED: relative_filename, up to top"
+}
+if { [relative_filename "/tmp/foo-test" "/tmp/bar/test" ] == "../bar/test" } {
+ puts "PASSED: relative_filename, up one level"
+} else {
+ puts "FAILED: relative_filename, up one level"
+}
+if { [relative_filename "/tmp/foo-test" "/tmp/foo-test" ] == "" } {
+ puts "PASSED: relative_filename, same name"
+} else {
+ puts "FAILED: relative_filename, same name"
+}
+
# Test find:
#
if [string match "*/subdir2/subfile2" "[find ${srcdir}/runtest.all/topdir/subdir2 sub*]"] {