summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2020-02-24 23:00:42 +0200
committerAdrian Thurston <thurston@colm.net>2020-03-07 22:36:41 +0200
commitf44ddde0cde8fa1794c91cb57871fc5a479b64b1 (patch)
treee61c47d3e1e1b93a4b8e9d391e6ef8c9c987d937 /test
parentd7a891f70b72f9c3c9dbfbc8b604603efb70bead (diff)
downloadcolm-f44ddde0cde8fa1794c91cb57871fc5a479b64b1.tar.gz
test suite: various updates to allow running on OSX
Diffstat (limited to 'test')
-rw-r--r--test/colm.d/gentests.sh4
-rw-r--r--test/ragel.d/gentests.sh4
-rw-r--r--test/ragel.d/noignore.rl2
-rw-r--r--test/ragel.d/strings1.rl1
-rw-r--r--test/ragel.d/strings2.rl2
-rw-r--r--test/ragel.d/xml.rl2
-rwxr-xr-xtest/rlhc.d/gentests2
-rwxr-xr-xtest/runtests9
8 files changed, 16 insertions, 10 deletions
diff --git a/test/colm.d/gentests.sh b/test/colm.d/gentests.sh
index 9198633b..b5cc8982 100644
--- a/test/colm.d/gentests.sh
+++ b/test/colm.d/gentests.sh
@@ -115,7 +115,7 @@ function cat_section
local in=$3
# Print Nth instance of the section
- awk -vsection=$section -vnth=$nth '
+ awk -v section=$section -v nth=$nth '
BEGIN {
if ( section == "LM" ) {
found = 1
@@ -309,7 +309,7 @@ function runtests()
# fi
}
-rm -f $WORKING/*
+rm -Rf $WORKING/*
runtests
#exit $EXIT;
diff --git a/test/ragel.d/gentests.sh b/test/ragel.d/gentests.sh
index 86c81da2..ac3eef2a 100644
--- a/test/ragel.d/gentests.sh
+++ b/test/ragel.d/gentests.sh
@@ -425,7 +425,7 @@ function run_translate()
expected_out=$wk/$root.exp;
case_rl=${root}.rl
- sed '1,/^#\+ * OUTPUT #\+/{ d };' $test_case > $expected_out
+ sed '1,/^##* * OUTPUT ##*/d' $test_case > $expected_out
prohibit_languages=`sed '/@PROHIBIT_LANGUAGES:/s/^.*: *//p;d' $test_case`
@@ -472,7 +472,7 @@ function run_translate()
done
else
- sed '/^#\+ * OUTPUT #\+/,$d' $test_case > $wk/$case_rl
+ sed '/^##* * OUTPUT ##*/,$d' $test_case > $wk/$case_rl
cases=$wk/$case_rl
diff --git a/test/ragel.d/noignore.rl b/test/ragel.d/noignore.rl
index dfa36b6e..a25ae49a 100644
--- a/test/ragel.d/noignore.rl
+++ b/test/ragel.d/noignore.rl
@@ -46,7 +46,7 @@ char *inp[] = {
"hello\n",
};
-int inplen = 9;
+int inplen = 1;
int main( )
{
diff --git a/test/ragel.d/strings1.rl b/test/ragel.d/strings1.rl
index 5e3ef9f9..97b57d34 100644
--- a/test/ragel.d/strings1.rl
+++ b/test/ragel.d/strings1.rl
@@ -1,5 +1,6 @@
/*
* @LANG: c
+ * @PROHIBIT_FLAGS: -G0 -G1 -G2
*/
#include <string.h>
diff --git a/test/ragel.d/strings2.rl b/test/ragel.d/strings2.rl
index 41681b8f..97b334e0 100644
--- a/test/ragel.d/strings2.rl
+++ b/test/ragel.d/strings2.rl
@@ -1,6 +1,6 @@
/*
* @LANG: c
- * @PROHIBIT_FLAGS: -e
+ * @PROHIBIT_FLAGS: -e -G0 -G1 -G2
*
* Test works with split code gen.
*/
diff --git a/test/ragel.d/xml.rl b/test/ragel.d/xml.rl
index e010ffb6..650e9679 100644
--- a/test/ragel.d/xml.rl
+++ b/test/ragel.d/xml.rl
@@ -3,7 +3,7 @@
* http://www.jelks.nu/XML/xmlebnf.html
*
* @LANG: c++
- * @PROHIBIT_FLAGS: -m -n -F0 -F1 -G0 -G1 -G2
+ * @PROHIBIT_FLAGS: -m -n -F0 -F1 -G0 -G1 -G2 -W0 -W1
*/
#include <iostream>
diff --git a/test/rlhc.d/gentests b/test/rlhc.d/gentests
index 15d92b12..d0143f2a 100755
--- a/test/rlhc.d/gentests
+++ b/test/rlhc.d/gentests
@@ -23,7 +23,7 @@ for fn; do
rm -f $sh
- lang=`echo $fn | awk -vFS=- '{ print $2 }'`
+ lang=`echo $fn | awk -v FS=- '{ print $2 }'`
case $lang in
A) lang=csharp;;
diff --git a/test/runtests b/test/runtests
index 97528852..bd94ffc8 100755
--- a/test/runtests
+++ b/test/runtests
@@ -5,9 +5,14 @@
timed()
{
# Default to all .d direcories.
- DIRS=$(find -type d -name '*.d' | sort)
+ DIRS=$(find . -type d -name '*.d' | sort)
+
+ if [ -f /proc/cpuinfo ]; then
+ CORES=$(awk '/cpu cores/ { print $4; exit }' /proc/cpuinfo)
+ else
+ CORES=$(sysctl -n hw.physicalcpu)
+ fi
- CORES=$(awk '/cpu cores/ { print $4; exit }' /proc/cpuinfo)
if ! echo $CORES | grep -q '^[1-9][0-9]\?$'; then
echo "warning: could not determine number of cores, using 2"