summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-09-05 08:31:38 +0300
committerArnold D. Robbins <arnold@skeeve.com>2014-09-05 08:31:38 +0300
commit16a26e063e9c62bff0478fa210d875c4eed2b7c0 (patch)
tree1e2732934037e2c2758734e6ce61f93de4b80c8a
parent8beb9796b17b6ca48eb62df8fd3d31421e43c761 (diff)
downloadgawk-16a26e063e9c62bff0478fa210d875c4eed2b7c0.tar.gz
Portability fix for functab4 test.
-rw-r--r--test/ChangeLog6
-rw-r--r--test/functab4.awk26
-rw-r--r--test/functab4.ok6
3 files changed, 31 insertions, 7 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 3d20eaac..02580b43 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+2014-09-05 Arnold D. Robbins <arnold@skeeve.com>
+
+ * functab4.awk: Changed to use stat instead of chdir since
+ /tmp isn't /tmp on all systems (e.g. Mac OS X). Thanks to
+ Hermann Peifer for the report.
+
2014-09-04 Arnold D. Robbins <arnold@skeeve.com>
* profile2.ok: Update after code improvement in profiler.
diff --git a/test/functab4.awk b/test/functab4.awk
index 0d9d4267..196fcc6d 100644
--- a/test/functab4.awk
+++ b/test/functab4.awk
@@ -6,9 +6,25 @@ function foo()
}
BEGIN {
- x = FUNCTAB["chdir"]
- print "x =", x
- @x("/tmp")
- printf "we are now in --> "
- system("/bin/pwd || /usr/bin/pwd")
+ f = FUNCTAB["foo"]
+ @f()
+
+ ret1 = stat(".", data1)
+ print "ret1 =", ret1
+
+ f = "stat"
+ ret2 = @f(".", data2)
+ print "ret2 =", ret2
+
+ problem = 0
+ for (i in data1) {
+ if (! isarray(data1[i])) {
+# print i, data1[i]
+ if (! (i in data2) || data1[i] != data2[i]) {
+ printf("mismatch element \"%s\"\n", i)
+ problems++
+ }
+ }
+ }
+ print(problems ? (problems+0) "encountered" : "no problems encountered")
}
diff --git a/test/functab4.ok b/test/functab4.ok
index 8eaab508..2b76cd88 100644
--- a/test/functab4.ok
+++ b/test/functab4.ok
@@ -1,2 +1,4 @@
-x = chdir
-we are now in --> /tmp
+foo!
+ret1 = 0
+ret2 = 0
+no problems encountered