From 352a7e268ecf86e265523c3ddd18cfcd3a8a2509 Mon Sep 17 00:00:00 2001 From: Sam Lang Date: Thu, 18 Oct 2012 10:13:12 -0500 Subject: [PATCH] test: Make the test filename unique to test This fixes up the chmod test to use a unique filename to test with, and avoid clobbering of other tests and commonly named files. Signed-off-by: Sam Lang --- qa/workunits/misc/chmod.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/qa/workunits/misc/chmod.sh b/qa/workunits/misc/chmod.sh index c71774b1e9957..b6065c1263b79 100755 --- a/qa/workunits/misc/chmod.sh +++ b/qa/workunits/misc/chmod.sh @@ -18,40 +18,42 @@ check_perms() { fi } -echo "foo" > foo +file=test_chmod.$$ + +echo "foo" > ${file} if test $? != 0; then - echo "ERROR: Failed to create file foo" + echo "ERROR: Failed to create file ${file}" exit 1 fi -check_perms foo "-rw-r--r--" +check_perms ${file} "-rw-r--r--" -chmod 400 foo +chmod 400 ${file} if test $? != 0; then - echo "ERROR: Failed to change mode of foo" + echo "ERROR: Failed to change mode of ${file}" exit 1 fi -check_perms foo "-r--------" +check_perms ${file} "-r--------" set +e -echo "bar" >> foo +echo "bar" >> ${file} if test $? = 0; then echo "ERROR: Write to read-only file should Fail" exit 1 fi set -e -chmod 600 foo -echo "bar" >> foo +chmod 600 ${file} +echo "bar" >> ${file} if test $? != 0; then echo "ERROR: Write to writeable file failed" exit 1 fi -check_perms foo "-rw-------" +check_perms ${file} "-rw-------" -echo "foo" >> foo +echo "foo" >> ${file} if test $? != 0; then echo "ERROR: Failed to write to file" exit 1 -- 2.39.5