From f4cae8a433a3744f6d3a6d895ef06631c0a656ec Mon Sep 17 00:00:00 2001
From: lubing6 <lubing6@huawei.com>
Date: Sat, 21 Mar 2020 20:52:01 +0800
Subject: [PATCH] fix testcase fail if noroot

---
 tests/arguments.at |  2 ++
 tests/commands.at  |  5 +++++
 tests/expr.at      |  1 +
 tests/lexical.at   |  4 ++++
 tests/variables.at | 10 ++++++++++
 5 files changed, 22 insertions(+)

diff --git a/tests/arguments.at b/tests/arguments.at
index 562fd83..8cd8673 100644
--- a/tests/arguments.at
+++ b/tests/arguments.at
@@ -47,6 +47,7 @@ TCSH_UNTESTED([-f])
 
 
 AT_SETUP([-i])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_CHECK([echo 'echo $1' | tcsh -f -q -i foo], ,
 [[> foo
@@ -143,6 +144,7 @@ AT_CLEANUP
 
 
 AT_SETUP([non-option arguments])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_DATA([options.csh],
 [[echo $0
diff --git a/tests/commands.at b/tests/commands.at
index cf0fcf0..e0532d3 100644
--- a/tests/commands.at
+++ b/tests/commands.at
@@ -267,6 +267,7 @@ AT_CLEANUP
 
 
 AT_SETUP([dirs])
+AT_SKIP_IF([test `whoami` != 'root' ])
 
 AT_DATA([dirs.csh],
 [[set current=`/bin/pwd`
@@ -379,6 +380,7 @@ TCSH_UNTESTED([fg])
 
 
 AT_SETUP([filetest])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 touch file1 file2 'b{c'
 chmod 6777 file1
@@ -561,6 +563,7 @@ TCSH_UNTESTED([hashstat])
 
 
 AT_SETUP([history])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_DATA([history.csh],
 [[: cmd 1
@@ -776,6 +779,7 @@ TCSH_UNTESTED([jobs])
 
 
 AT_SETUP([kill])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 # Nested to ensure consistent output
 AT_DATA([kill.csh],
@@ -1201,6 +1205,7 @@ AT_CLEANUP
 
 
 AT_SETUP([source])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_DATA([script.csh],
 [[set var=$1
diff --git a/tests/expr.at b/tests/expr.at
index fa373c8..d9e0a1d 100644
--- a/tests/expr.at
+++ b/tests/expr.at
@@ -74,6 +74,7 @@ AT_CLEANUP
 
 
 AT_SETUP([Primary expressions])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_CHECK([tcsh -f -c 'set parseoctal; exit (010)'], 8)
 AT_CHECK([tcsh -f -c 'exit (010)'], 10)
diff --git a/tests/lexical.at b/tests/lexical.at
index d42d3ea..277eba4 100644
--- a/tests/lexical.at
+++ b/tests/lexical.at
@@ -153,6 +153,7 @@ AT_CLEANUP
 
 
 AT_SETUP([History basics])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 # Printing prompt only when at end of input is rather nondeterministic...
 AT_DATA([basic.csh],
@@ -203,6 +204,7 @@ AT_CLEANUP
 
 
 AT_SETUP([Event specification])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_DATA([positive.csh],
 [[echo 1
@@ -345,6 +347,7 @@ AT_CLEANUP
 
 
 AT_SETUP([Word selection])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_DATA([words.csh],
 [[echo 1 2 3 4 5
@@ -394,6 +397,7 @@ AT_CLEANUP
 
 
 AT_SETUP([History modifiers])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_DATA([modifiers.csh],
 [[echo foo bar baz quux /usr/src/sys/sys/malloc.c
diff --git a/tests/variables.at b/tests/variables.at
index 9db0886..dc151c8 100644
--- a/tests/variables.at
+++ b/tests/variables.at
@@ -358,6 +358,7 @@ AT_CLEANUP
 
 
 AT_SETUP([$ ellipsis])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_DATA([ellipsis0.csh],
 [[echo $?ellipsis
@@ -417,6 +418,7 @@ AT_CLEANUP
 
 
 AT_SETUP([$ histchars])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_DATA([histchars.csh],
 [[echo $?histchars
@@ -440,6 +442,7 @@ AT_CLEANUP
 
 
 AT_SETUP([$ histdup])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_DATA([histdup.csh],
 [[echo $?histdup
@@ -497,6 +500,7 @@ VAR_UNSET([histfile])
 
 
 AT_SETUP([$ histlit])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_DATA([histlit.csh],
 [[echo $?histlit
@@ -563,6 +567,7 @@ AT_CLEANUP
 
 
 AT_SETUP([$ history])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_DATA([history.csh],
 [[echo $#history $history
@@ -620,6 +625,7 @@ VAR_UNSET([ignoreeof])
 
 
 AT_SETUP([$ implicitcd])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_DATA([implicitcd.csh],
 [[echo $?implicitcd
@@ -826,6 +832,7 @@ AT_CLEANUP
 
 
 AT_SETUP([$ prompt])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_DATA([prompt.csh],
 [[echo "$prompt"
@@ -862,6 +869,7 @@ AT_CHECK([echo 'echo "$prompt3"' | tcsh -f], ,
 
 
 AT_SETUP([$ promptchars])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_DATA([promptchars.csh],
 [[echo $?promptchars
@@ -883,6 +891,7 @@ VAR_UNSET([rmstar])
 
 
 AT_SETUP([$ rprompt])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_DATA([rprompt.csh],
 [[echo $?rprompt
@@ -1078,6 +1087,7 @@ AT_CLEANUP
 
 
 AT_SETUP([$ verbose])
+AT_SKIP_IF([test `whoami` == 'root' ])
 
 AT_CHECK([tcsh -f -v -c 'echo $verbose'], , [
 ],
-- 
1.8.3.1

