aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-08-25 23:23:01 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2016-08-25 23:29:39 +0300
commit558c9d71b89c42dc9c3700011165ad17cc144b84 (patch)
tree3638b9184337b61c597195c113c416ff2179fd6d
parentfb43246e70032ab42e63cf7fc93a2a0548655a57 (diff)
downloadrush-558c9d71b89c42dc9c3700011165ad17cc144b84.tar.gz
rush-558c9d71b89c42dc9c3700011165ad17cc144b84.tar.bz2
Fix testsuite
Use AT_CHECK_UNQUOTED with variable substitution instead of postprocessing stderr and stdout with sed.
-rw-r--r--tests/argc.at2
-rw-r--r--tests/atlocal.in10
-rw-r--r--tests/chdir.at2
-rw-r--r--tests/command.at2
-rw-r--r--tests/env.at22
-rw-r--r--tests/fallthrough.at2
-rw-r--r--tests/gid.at2
-rw-r--r--tests/map.at2
-rw-r--r--tests/match.at2
-rw-r--r--tests/matchprog.at2
-rw-r--r--tests/testsuite.at8
-rw-r--r--tests/uid.at2
12 files changed, 24 insertions, 34 deletions
diff --git a/tests/argc.at b/tests/argc.at
index 3da9389..b92f412 100644
--- a/tests/argc.at
+++ b/tests/argc.at
@@ -42,7 +42,7 @@ rule
[/usr/bin/echo foo bar],
[1],
[],
-[rush: Error: no matching rule for "/usr/bin/echo foo bar", user MY_USER
+[rush: Error: no matching rule for "/usr/bin/echo foo bar", user $MY_USER
])
AT_CLEANUP
diff --git a/tests/atlocal.in b/tests/atlocal.in
index 272b48e..a88b583 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -10,13 +10,5 @@ myvars() {
MY_UID=$2
MY_GROUP=$3
MY_GID=$4
+ TESTDIR=$(pwd)
}
-myfilter() {
- sed -e "s^$PWD^PWD^g" \
- -e "s/$MY_USER/MY_USER/g" \
- -e "s/$MY_UID/MY_UID/g" \
- -e "s/$MY_GROUP/MY_GROUP/g" \
- -e "s/$MY_GID/MY_GID/g" \
- $@
-}
-
diff --git a/tests/chdir.at b/tests/chdir.at
index e0e6c96..e8a9b26 100644
--- a/tests/chdir.at
+++ b/tests/chdir.at
@@ -25,7 +25,7 @@ rule
[command],
[0],
[{
- "home_dir":"PWD"
+ "home_dir":"$TESTDIR"
}
],
[])
diff --git a/tests/command.at b/tests/command.at
index 3ca015a..25fd4ca 100644
--- a/tests/command.at
+++ b/tests/command.at
@@ -42,7 +42,7 @@ rule
[/usr/bin/echo foo bar],
[1],
[],
-[rush: Error: no matching rule for "/usr/bin/echo foo bar", user MY_USER
+[rush: Error: no matching rule for "/usr/bin/echo foo bar", user $MY_USER
])
AT_CLEANUP
diff --git a/tests/env.at b/tests/env.at
index a410bbc..4aa9c00 100644
--- a/tests/env.at
+++ b/tests/env.at
@@ -40,8 +40,8 @@ rule
[0],
[{
"environ":[[
- "HOME=PWD",
- "USER=MY_USER"
+ "HOME=$TESTDIR",
+ "USER=$MY_USER"
]]
}
],
@@ -56,8 +56,8 @@ rule
[0],
[{
"environ":[[
- "HOME=PWD",
- "USER=MY_USER"
+ "HOME=$TESTDIR",
+ "USER=$MY_USER"
]]
}
],
@@ -74,9 +74,9 @@ rule
[0],
[{
"environ":[[
- "HOME=PWD",
- "LOGIN=NO_MY_USER",
- "USER=MY_USER"
+ "HOME=$TESTDIR",
+ "LOGIN=NO_$MY_USER",
+ "USER=$MY_USER"
]]
}
],
@@ -93,8 +93,8 @@ rule
[0],
[{
"environ":[[
- "HOME=PWD",
- "USER=MY_USER"
+ "HOME=$TESTDIR",
+ "USER=$MY_USER"
]]
}
],
@@ -111,9 +111,9 @@ rule
[0],
[{
"environ":[[
- "HOME=PWD",
+ "HOME=$TESTDIR",
"NEWVAR=foo",
- "USER=MY_USER"
+ "USER=$MY_USER"
]]
}
],
diff --git a/tests/fallthrough.at b/tests/fallthrough.at
index 03c69a9..7202ebf 100644
--- a/tests/fallthrough.at
+++ b/tests/fallthrough.at
@@ -32,7 +32,7 @@ rule
"cmdline":"newcommand",
"environ":[[
"STATUS=Fall-through working",
- "USER=MY_USER"
+ "USER=$MY_USER"
]]
}
],
diff --git a/tests/gid.at b/tests/gid.at
index af90ea7..e47be5f 100644
--- a/tests/gid.at
+++ b/tests/gid.at
@@ -43,7 +43,7 @@ rule
[ls /],
[1],
[],
-[rush: Error: no matching rule for "ls /", user MY_USER
+[rush: Error: no matching rule for "ls /", user $MY_USER
])
AT_CLEANUP
diff --git a/tests/map.at b/tests/map.at
index 14096fe..d7694e1 100644
--- a/tests/map.at
+++ b/tests/map.at
@@ -21,7 +21,7 @@ AT_CHECK([
myvars
cat > passwd.rush <<EOT
-root:x:0:0::/root:/bin/bash
+x$MY_USER:x:$(($MY_UID + 1)):$(($MY_GID + 1))::/root:/bin/bash
$MY_USER:x:$MY_UID:$MY_GID:Me:/:/rush_special_shell
EOT
diff --git a/tests/match.at b/tests/match.at
index 3ade2cd..a798d9a 100644
--- a/tests/match.at
+++ b/tests/match.at
@@ -39,7 +39,7 @@ rule
[/usr/bin/echo bar],
[1],
[],
-[rush: Error: no matching rule for "/usr/bin/echo bar", user MY_USER
+[rush: Error: no matching rule for "/usr/bin/echo bar", user $MY_USER
])
AT_CLEANUP
diff --git a/tests/matchprog.at b/tests/matchprog.at
index b31f2ca..eb75423 100644
--- a/tests/matchprog.at
+++ b/tests/matchprog.at
@@ -39,7 +39,7 @@ rule
[echo foo],
[1],
[],
-[rush: Error: no matching rule for "echo foo", user MY_USER
+[rush: Error: no matching rule for "echo foo", user $MY_USER
])
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 03acf44..d6c6d30 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -21,17 +21,15 @@ m4_define([m4_run_rush],[m4_ifval([$2],[dnl
echo "# $2"
echo "# $2" >&2
m4_ifset([RUSH_ENVIRON],[env RUSH_ENVIRON $RUSHDIR/])rush -C none -D$1 dnl
-m4_if([$2],[interactive],[-i],[-c "$2"]) test.conf 2>err 1>out
+m4_if([$2],[interactive],[-i],[-c "$2"]) test.conf
echo "# $?"
-myfilter out
-myfilter err >&2
$0([$1],m4_shiftn(5, $@))])])
dnl m4_fmt_out([CMD],[EC],[STDOUT],[STDERR],...)
m4_define([m4_fmt_out],[m4_ifval([$1],[dnl
# $1
-# $2
$3[]dnl
+# $2
$0(m4_shift(m4_shift3($@)))])])
dnl m4_fmt_err([CMD],[EC],[STDOUT],[STDERR],...)
@@ -42,8 +40,8 @@ $0(m4_shift(m4_shift3($@)))])])
dnl AT_RUSH_TEST([CONFIG],[KW], [CMD],[EC],[STDOUT],[STDERR])
m4_define([AT_RUSH_TEST],[
-AT_CHECK([
myvars
+AT_CHECK_UNQUOTED([
cat > test.conf <<EOT
[$1]
EOT
diff --git a/tests/uid.at b/tests/uid.at
index 8df7cb1..306b932 100644
--- a/tests/uid.at
+++ b/tests/uid.at
@@ -43,7 +43,7 @@ rule
[ls /],
[1],
[],
-[rush: Error: no matching rule for "ls /", user MY_USER
+[rush: Error: no matching rule for "ls /", user $MY_USER
])
AT_CLEANUP

Return to:

Send suggestions and report system problems to the System administrator.