aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris
diff options
context:
space:
mode:
authorLi-Wen Hsu <lwhsu@FreeBSD.org>2017-07-25 13:11:20 +0000
committerLi-Wen Hsu <lwhsu@FreeBSD.org>2017-07-25 13:11:20 +0000
commit5604d0f997c655f01f1e56fa451a2f0a2f8e8190 (patch)
treeea1a90784496af7fcbeeb3934ad75300e603fa48 /cddl/contrib/opensolaris
parent4ca0dfa6b0eaa09ad4c899ed3668a8bf0ddf36a8 (diff)
downloadsrc-5604d0f997c655f01f1e56fa451a2f0a2f8e8190.tar.gz
src-5604d0f997c655f01f1e56fa451a2f0a2f8e8190.zip
Notes
Diffstat (limited to 'cddl/contrib/opensolaris')
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d20
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d.out6
2 files changed, 22 insertions, 4 deletions
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d
index d417801f58ed..e4eae881432f 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d
@@ -55,12 +55,16 @@ BEGIN
dir[i++] = "f";
dir[i++] = "f/";
dir[i++] = "/////";
+ /*
+ * basename(3) and basename(1) return different results for the empty
+ * string on FreeBSD, so we need special handling.
dir[i++] = "";
+ */
end = i;
i = 0;
- printf("#!/usr/bin/ksh\n\n");
+ printf("#!/usr/bin/env ksh\n\n");
}
tick-1ms
@@ -84,5 +88,19 @@ tick-1ms
tick-1ms
/i == end/
{
+ dir[i] = "";
+ printf("if [ \"`basename \"%s\"`\" != \"%s\" -a \".\" != \"%s\" ]; then\n",
+ dir[i], basename(dir[i]), basename(dir[i]));
+ printf(" echo \"basename(\\\"%s\\\") is \\\"%s\\\"; ",
+ dir[i], basename(dir[i]));
+ printf("expected \\\"`basename \"%s\"`\\\" or \\\".\\\"\"\n", dir[i]);
+ printf("fi\n\n");
+ printf("if [ `dirname \"%s\"` != \"%s\" ]; then\n",
+ dir[i], dirname(dir[i]));
+ printf(" echo \"dirname(\\\"%s\\\") is \\\"%s\\\"; ",
+ dir[i], dirname(dir[i]));
+ printf("expected \\\"`dirname \"%s\"`\"\\\"\n", dir[i]);
+ printf("fi\n\n");
+
exit(0);
}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d.out
index e16541adbb03..0f94599df1ea 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d.out
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.basename.d.out
@@ -1,4 +1,4 @@
-#!/usr/bin/ksh
+#!/usr/bin/env ksh
if [ `basename "/foo/bar/baz"` != "baz" ]; then
echo "basename(\"/foo/bar/baz\") is \"baz\"; expected \"`basename "/foo/bar/baz"`"\"
@@ -152,8 +152,8 @@ if [ `dirname "/////"` != "/" ]; then
echo "dirname(\"/////\") is \"/\"; expected \"`dirname "/////"`"\"
fi
-if [ `basename ""` != "." ]; then
- echo "basename(\"\") is \".\"; expected \"`basename ""`"\"
+if [ "`basename ""`" != "." -a "." != "." ]; then
+ echo "basename(\"\") is \".\"; expected \"`basename ""`\" or \".\""
fi
if [ `dirname ""` != "." ]; then