Skip tests requiring root permissions

This commit is contained in:
2026-03-23 12:13:28 +01:00
parent bf811af8ba
commit 43fc223259
5 changed files with 236 additions and 483 deletions
+2
View File
@@ -19,3 +19,5 @@ tags
# Persistent undo
[._]*.un~
.idea/
+230
View File
@@ -0,0 +1,230 @@
diff --git a/test/54-assert-10-assert_character_exists.bats b/test/54-assert-10-assert_character_exists.bats
index c92a1a3..2c241f7 100644
--- a/test/54-assert-10-assert_character_exists.bats
+++ b/test/54-assert-10-assert_character_exists.bats
@@ -3,20 +3,22 @@
load 'test_helper'
fixtures 'exist'
-setup () {
- bats_sudo mknod ${TEST_FIXTURE_ROOT}/dir/test_device c 89 1
-}
+ setup () {
+ skip "Requires root privileges"
+ bats_sudo mknod ${TEST_FIXTURE_ROOT}/dir/test_device c 89 1
+ }
teardown () {
rm -f ${TEST_FIXTURE_ROOT}/dir/test_device
}
# Correctness
-@test 'assert_character_exists() <file>: returns 0 if <file> character special file exists' {
- local -r file="${TEST_FIXTURE_ROOT}/dir/test_device"
- run assert_character_exists "$file"
- [ "$status" -eq 0 ]
- [ "${#lines[@]}" -eq 0 ]
-}
+ @test 'assert_character_exists() <file>: returns 0 if <file> character special file exists' {
+ skip "Requires root privileges"
+ local -r file="${TEST_FIXTURE_ROOT}/dir/test_device"
+ run assert_character_exists "$file"
+ [ "$status" -eq 0 ]
+ [ "${#lines[@]}" -eq 0 ]
+ }
@test 'assert_character_exists() <file>: returns 1 and displays path if <file> character special file does not exist' {
local -r file="${TEST_FIXTURE_ROOT}/dir/file"
diff --git a/test/54-assert-11-assert_character_not_exists.bats b/test/54-assert-11-assert_character_not_exists.bats
index 6586a7f..671bbc9 100644
--- a/test/54-assert-11-assert_character_not_exists.bats
+++ b/test/54-assert-11-assert_character_not_exists.bats
@@ -4,6 +4,7 @@ load 'test_helper'
fixtures 'exist'
setup () {
+ skip "Requires root privileges"
bats_sudo mknod ${TEST_FIXTURE_ROOT}/dir/test_device c 89 1
}
teardown () {
@@ -19,6 +20,7 @@ teardown () {
}
@test 'assert_character_not_exists() <file>: returns 1 and displays path if <file> character special file exists, but it was expected to be absent' {
+ skip "Requires root privileges"
local -r file="${TEST_FIXTURE_ROOT}/dir/test_device"
run assert_character_not_exists "$file"
[ "$status" -eq 1 ]
@@ -30,6 +32,7 @@ teardown () {
# Transforming path
@test 'assert_character_not_exists() <file>: replace prefix of displayed path' {
+ skip "Requires root privileges"
local -r BATSLIB_FILE_PATH_REM="#${TEST_FIXTURE_ROOT}"
local -r BATSLIB_FILE_PATH_ADD='..'
run assert_character_not_exists "${TEST_FIXTURE_ROOT}/dir/test_device"
@@ -41,6 +44,7 @@ teardown () {
}
@test 'assert_character_not_exists() <file>: replace suffix of displayed path' {
+ skip "Requires root privileges"
local -r BATSLIB_FILE_PATH_REM='%file'
local -r BATSLIB_FILE_PATH_ADD='..'
run assert_character_not_exists "${TEST_FIXTURE_ROOT}/dir/test_device"
@@ -52,6 +56,7 @@ teardown () {
}
@test 'assert_character_not_exists() <file>: replace infix of displayed path' {
+ skip "Requires root privileges"
local -r BATSLIB_FILE_PATH_REM='dir'
local -r BATSLIB_FILE_PATH_ADD='..'
run assert_character_not_exists "${TEST_FIXTURE_ROOT}/dir/test_device"
diff --git a/test/55-assert-10-assert_block_exists.bats b/test/55-assert-10-assert_block_exists.bats
index 2211a3b..102c642 100644
--- a/test/55-assert-10-assert_block_exists.bats
+++ b/test/55-assert-10-assert_block_exists.bats
@@ -3,6 +3,7 @@ load 'test_helper'
fixtures 'exist'
setup () {
+ skip "Requires root privileges"
bats_sudo mknod ${TEST_FIXTURE_ROOT}/dir/blockfile b 89 1
}
teardown () {
@@ -11,6 +12,7 @@ teardown () {
# Correctness
@test 'assert_block_exists() <file>: returns 0 if <file> block special file exists' {
+ skip "Requires root privileges"
local -r file="${TEST_FIXTURE_ROOT}/dir/blockfile"
run assert_block_exists "$file"
[ "$status" -eq 0 ]
diff --git a/test/55-assert-11-assert_block_not_exists.bats b/test/55-assert-11-assert_block_not_exists.bats
index 9bff904..3a45b75 100644
--- a/test/55-assert-11-assert_block_not_exists.bats
+++ b/test/55-assert-11-assert_block_not_exists.bats
@@ -4,6 +4,7 @@ load 'test_helper'
fixtures 'exist'
setup () {
+ skip "Requires root privileges"
bats_sudo mknod ${TEST_FIXTURE_ROOT}/dir/blockfile b 89 1
}
teardown () {
@@ -19,6 +20,7 @@ teardown () {
}
@test 'assert_block_not_exists() <file>: returns 1 and displays path if <file> block special file exists, but it was expected to be absent' {
+ skip "Requires root privileges"
local -r file="${TEST_FIXTURE_ROOT}/dir/blockfile"
run assert_block_not_exists "$file"
[ "$status" -eq 1 ]
@@ -30,6 +32,7 @@ teardown () {
# Transforming path
@test 'assert_block_not_exists() <file>: replace prefix of displayed path' {
+ skip "Requires root privileges"
local -r BATSLIB_FILE_PATH_REM="#${TEST_FIXTURE_ROOT}"
local -r BATSLIB_FILE_PATH_ADD='..'
run assert_block_not_exists "${TEST_FIXTURE_ROOT}/dir/blockfile"
@@ -41,6 +44,7 @@ teardown () {
}
@test 'assert_block_not_exists() <file>: replace suffix of displayed path' {
+ skip "Requires root privileges"
local -r BATSLIB_FILE_PATH_REM='%blockfile'
local -r BATSLIB_FILE_PATH_ADD='..'
run assert_block_not_exists "${TEST_FIXTURE_ROOT}/dir/blockfile"
@@ -53,6 +57,7 @@ teardown () {
}
@test 'assert_block_not_exists() <file>: replace infix of displayed path' {
+ skip "Requires root privileges"
local -r BATSLIB_FILE_PATH_REM='dir'
local -r BATSLIB_FILE_PATH_ADD='..'
run assert_block_not_exists "${TEST_FIXTURE_ROOT}/dir/blockfile"
diff --git a/test/59-assert-10-assert_file_owner.bats b/test/59-assert-10-assert_file_owner.bats
index f1a2f35..cc687ff 100644
--- a/test/59-assert-10-assert_file_owner.bats
+++ b/test/59-assert-10-assert_file_owner.bats
@@ -8,16 +8,19 @@ setup () {
# There is PATH addition to /usr/sbin which won't come by default on bash3
# on macOS
chown_path=$(PATH="$PATH:/usr/sbin" command -v chown 2>/dev/null)
+ skip "Requires root privileges"
bats_sudo "$chown_path" root ${TEST_FIXTURE_ROOT}/dir/owner
bats_sudo "$chown_path" daemon ${TEST_FIXTURE_ROOT}/dir/notowner
}
teardown () {
+ skip "Requires root privileges"
bats_sudo rm -f ${TEST_FIXTURE_ROOT}/dir/owner ${TEST_FIXTURE_ROOT}/dir/notowner
}
# Correctness
@test 'assert_file_owner() <file>: returns 0 if <file> user root is the owner of the file' {
+ skip "Requires root privileges"
local -r owner="root"
local -r file="${TEST_FIXTURE_ROOT}/dir/owner"
run assert_file_owner "$owner" "$file"
diff --git a/test/59-assert-11-assert_not_file_owner.bats b/test/59-assert-11-assert_not_file_owner.bats
index 5518941..06c567e 100644
--- a/test/59-assert-11-assert_not_file_owner.bats
+++ b/test/59-assert-11-assert_not_file_owner.bats
@@ -8,11 +8,13 @@ setup () {
# There is PATH addition to /usr/sbin which won't come by default on bash3
# on macOS
chown_path=$(PATH="$PATH:/usr/sbin" command -v chown 2>/dev/null)
+ skip "Requires root privileges"
bats_sudo "$chown_path" root ${TEST_FIXTURE_ROOT}/dir/owner
bats_sudo "$chown_path" daemon ${TEST_FIXTURE_ROOT}/dir/notowner
}
teardown () {
+ skip "Requires root privileges"
bats_sudo rm -f ${TEST_FIXTURE_ROOT}/dir/owner ${TEST_FIXTURE_ROOT}/dir/notowner
}
@@ -26,6 +28,7 @@ teardown () {
}
@test 'assert_not_file_owner() <file>: returns 1 and displays path if <file> user root is the owner of the file, but it was expected not to be' {
+ skip "Requires root privileges"
local -r owner="root"
local -r file="${TEST_FIXTURE_ROOT}/dir/owner"
run assert_not_file_owner "$owner" "$file"
@@ -39,6 +42,7 @@ teardown () {
# Transforming path
@test 'assert_not_file_owner() <file>: replace prefix of displayed path' {
+ skip "Requires root privileges"
local -r BATSLIB_FILE_PATH_REM="#${TEST_FIXTURE_ROOT}"
local -r BATSLIB_FILE_PATH_ADD='..'
local -r owner="root"
@@ -52,6 +56,7 @@ teardown () {
}
@test 'assert_not_file_owner() <file>: replace suffix of displayed path' {
+ skip "Requires root privileges"
local -r BATSLIB_FILE_PATH_REM='%dir/owner'
local -r BATSLIB_FILE_PATH_ADD='..'
local -r owner="root"
@@ -65,6 +70,7 @@ teardown () {
}
@test 'assert_not_file_owner() <file>: replace infix of displayed path' {
+ skip "Requires root privileges"
local -r BATSLIB_FILE_PATH_REM='dir/owner'
local -r BATSLIB_FILE_PATH_ADD='..'
local -r owner="root"
diff --git a/test/70-temp-11-temp_del.bats b/test/70-temp-11-temp_del.bats
index 1eb9991..86bf9ff 100755
--- a/test/70-temp-11-temp_del.bats
+++ b/test/70-temp-11-temp_del.bats
@@ -15,6 +15,7 @@ fixtures 'temp'
}
@test 'temp_del() <path>: works even if wrote-protected file/directory exists within' {
+ skip "Requires root privileges"
TEST_TEMP_DIR="$(temp_make)"
touch $TEST_TEMP_DIR/nowritefile
chmod -w $TEST_TEMP_DIR/nowritefile
-479
View File
@@ -1,479 +0,0 @@
diff --git a/test/54-assert-10-assert_character_exists.bats b/test/54-assert-10-assert_character_exists.bats
index c92a1a3..c4e6ac0 100644
--- a/test/54-assert-10-assert_character_exists.bats
+++ b/test/54-assert-10-assert_character_exists.bats
@@ -3,20 +3,20 @@
load 'test_helper'
fixtures 'exist'
-setup () {
- bats_sudo mknod ${TEST_FIXTURE_ROOT}/dir/test_device c 89 1
-}
+# setup () {
+# bats_sudo mknod ${TEST_FIXTURE_ROOT}/dir/test_device c 89 1
+# }
teardown () {
rm -f ${TEST_FIXTURE_ROOT}/dir/test_device
}
# Correctness
-@test 'assert_character_exists() <file>: returns 0 if <file> character special file exists' {
- local -r file="${TEST_FIXTURE_ROOT}/dir/test_device"
- run assert_character_exists "$file"
- [ "$status" -eq 0 ]
- [ "${#lines[@]}" -eq 0 ]
-}
+# @test 'assert_character_exists() <file>: returns 0 if <file> character special file exists' {
+# local -r file="${TEST_FIXTURE_ROOT}/dir/test_device"
+# run assert_character_exists "$file"
+# [ "$status" -eq 0 ]
+# [ "${#lines[@]}" -eq 0 ]
+# }
@test 'assert_character_exists() <file>: returns 1 and displays path if <file> character special file does not exist' {
local -r file="${TEST_FIXTURE_ROOT}/dir/file"
diff --git a/test/54-assert-11-assert_character_not_exists.bats b/test/54-assert-11-assert_character_not_exists.bats
index 6586a7f..6161377 100644
--- a/test/54-assert-11-assert_character_not_exists.bats
+++ b/test/54-assert-11-assert_character_not_exists.bats
@@ -3,9 +3,9 @@
load 'test_helper'
fixtures 'exist'
-setup () {
- bats_sudo mknod ${TEST_FIXTURE_ROOT}/dir/test_device c 89 1
-}
+# setup () {
+# bats_sudo mknod ${TEST_FIXTURE_ROOT}/dir/test_device c 89 1
+# }
teardown () {
rm -f ${TEST_FIXTURE_ROOT}/dir/test_device
}
@@ -18,46 +18,46 @@ teardown () {
[ "${#lines[@]}" -eq 0 ]
}
-@test 'assert_character_not_exists() <file>: returns 1 and displays path if <file> character special file exists, but it was expected to be absent' {
- local -r file="${TEST_FIXTURE_ROOT}/dir/test_device"
- run assert_character_not_exists "$file"
- [ "$status" -eq 1 ]
- [ "${#lines[@]}" -eq 3 ]
- [ "${lines[0]}" == '-- character special file exists, but it was expected to be absent --' ]
- [ "${lines[1]}" == "path : $file" ]
- [ "${lines[2]}" == '--' ]
-}
+# @test 'assert_character_not_exists() <file>: returns 1 and displays path if <file> character special file exists, but it was expected to be absent' {
+# local -r file="${TEST_FIXTURE_ROOT}/dir/test_device"
+# run assert_character_not_exists "$file"
+# [ "$status" -eq 1 ]
+# [ "${#lines[@]}" -eq 3 ]
+# [ "${lines[0]}" == '-- character special file exists, but it was expected to be absent --' ]
+# [ "${lines[1]}" == "path : $file" ]
+# [ "${lines[2]}" == '--' ]
+# }
# Transforming path
-@test 'assert_character_not_exists() <file>: replace prefix of displayed path' {
- local -r BATSLIB_FILE_PATH_REM="#${TEST_FIXTURE_ROOT}"
- local -r BATSLIB_FILE_PATH_ADD='..'
- run assert_character_not_exists "${TEST_FIXTURE_ROOT}/dir/test_device"
- [ "$status" -eq 1 ]
- [ "${#lines[@]}" -eq 3 ]
- [ "${lines[0]}" == '-- character special file exists, but it was expected to be absent --' ]
- [ "${lines[1]}" == "path : ../dir/test_device" ]
- [ "${lines[2]}" == '--' ]
-}
+# @test 'assert_character_not_exists() <file>: replace prefix of displayed path' {
+# local -r BATSLIB_FILE_PATH_REM="#${TEST_FIXTURE_ROOT}"
+# local -r BATSLIB_FILE_PATH_ADD='..'
+# run assert_character_not_exists "${TEST_FIXTURE_ROOT}/dir/test_device"
+# [ "$status" -eq 1 ]
+# [ "${#lines[@]}" -eq 3 ]
+# [ "${lines[0]}" == '-- character special file exists, but it was expected to be absent --' ]
+# [ "${lines[1]}" == "path : ../dir/test_device" ]
+# [ "${lines[2]}" == '--' ]
+# }
-@test 'assert_character_not_exists() <file>: replace suffix of displayed path' {
- local -r BATSLIB_FILE_PATH_REM='%file'
- local -r BATSLIB_FILE_PATH_ADD='..'
- run assert_character_not_exists "${TEST_FIXTURE_ROOT}/dir/test_device"
- [ "$status" -eq 1 ]
- [ "${#lines[@]}" -eq 3 ]
- [ "${lines[0]}" == '-- character special file exists, but it was expected to be absent --' ]
- [ "${lines[1]}" == "path : ${TEST_FIXTURE_ROOT}/dir/test_device" ]
- [ "${lines[2]}" == '--' ]
-}
+# @test 'assert_character_not_exists() <file>: replace suffix of displayed path' {
+# local -r BATSLIB_FILE_PATH_REM='%file'
+# local -r BATSLIB_FILE_PATH_ADD='..'
+# run assert_character_not_exists "${TEST_FIXTURE_ROOT}/dir/test_device"
+# [ "$status" -eq 1 ]
+# [ "${#lines[@]}" -eq 3 ]
+# [ "${lines[0]}" == '-- character special file exists, but it was expected to be absent --' ]
+# [ "${lines[1]}" == "path : ${TEST_FIXTURE_ROOT}/dir/test_device" ]
+# [ "${lines[2]}" == '--' ]
+# }
-@test 'assert_character_not_exists() <file>: replace infix of displayed path' {
- local -r BATSLIB_FILE_PATH_REM='dir'
- local -r BATSLIB_FILE_PATH_ADD='..'
- run assert_character_not_exists "${TEST_FIXTURE_ROOT}/dir/test_device"
- [ "$status" -eq 1 ]
- [ "${#lines[@]}" -eq 3 ]
- [ "${lines[0]}" == '-- character special file exists, but it was expected to be absent --' ]
- [ "${lines[1]}" == "path : ${TEST_FIXTURE_ROOT}/../test_device" ]
- [ "${lines[2]}" == '--' ]
-}
+# @test 'assert_character_not_exists() <file>: replace infix of displayed path' {
+# local -r BATSLIB_FILE_PATH_REM='dir'
+# local -r BATSLIB_FILE_PATH_ADD='..'
+# run assert_character_not_exists "${TEST_FIXTURE_ROOT}/dir/test_device"
+# [ "$status" -eq 1 ]
+# [ "${#lines[@]}" -eq 3 ]
+# [ "${lines[0]}" == '-- character special file exists, but it was expected to be absent --' ]
+# [ "${lines[1]}" == "path : ${TEST_FIXTURE_ROOT}/../test_device" ]
+# [ "${lines[2]}" == '--' ]
+# }
diff --git a/test/55-assert-10-assert_block_exists.bats b/test/55-assert-10-assert_block_exists.bats
index 2211a3b..49c99e6 100644
--- a/test/55-assert-10-assert_block_exists.bats
+++ b/test/55-assert-10-assert_block_exists.bats
@@ -2,20 +2,20 @@
load 'test_helper'
fixtures 'exist'
-setup () {
- bats_sudo mknod ${TEST_FIXTURE_ROOT}/dir/blockfile b 89 1
-}
+# setup () {
+# bats_sudo mknod ${TEST_FIXTURE_ROOT}/dir/blockfile b 89 1
+# }
teardown () {
rm -f ${TEST_FIXTURE_ROOT}/dir/blockfile
}
# Correctness
-@test 'assert_block_exists() <file>: returns 0 if <file> block special file exists' {
- local -r file="${TEST_FIXTURE_ROOT}/dir/blockfile"
- run assert_block_exists "$file"
- [ "$status" -eq 0 ]
- [ "${#lines[@]}" -eq 0 ]
-}
+# @test 'assert_block_exists() <file>: returns 0 if <file> block special file exists' {
+# local -r file="${TEST_FIXTURE_ROOT}/dir/blockfile"
+# run assert_block_exists "$file"
+# [ "$status" -eq 0 ]
+# [ "${#lines[@]}" -eq 0 ]
+# }
@test 'assert_block_exists() <file>: returns 1 and displays path if <file> block special file does not exist' {
local -r file="${TEST_FIXTURE_ROOT}/dir/file"
diff --git a/test/55-assert-11-assert_block_not_exists.bats b/test/55-assert-11-assert_block_not_exists.bats
index 9bff904..37fa67d 100644
--- a/test/55-assert-11-assert_block_not_exists.bats
+++ b/test/55-assert-11-assert_block_not_exists.bats
@@ -3,9 +3,9 @@
load 'test_helper'
fixtures 'exist'
-setup () {
- bats_sudo mknod ${TEST_FIXTURE_ROOT}/dir/blockfile b 89 1
-}
+# setup () {
+# bats_sudo mknod ${TEST_FIXTURE_ROOT}/dir/blockfile b 89 1
+# }
teardown () {
rm -f ${TEST_FIXTURE_ROOT}/dir/blockfile
}
@@ -18,48 +18,47 @@ teardown () {
[ "${#lines[@]}" -eq 0 ]
}
-@test 'assert_block_not_exists() <file>: returns 1 and displays path if <file> block special file exists, but it was expected to be absent' {
- local -r file="${TEST_FIXTURE_ROOT}/dir/blockfile"
- run assert_block_not_exists "$file"
- [ "$status" -eq 1 ]
- [ "${#lines[@]}" -eq 3 ]
- [ "${lines[0]}" == '-- block special file exists, but it was expected to be absent --' ]
- [ "${lines[1]}" == "path : $file" ]
- [ "${lines[2]}" == '--' ]
-}
+# @test 'assert_block_not_exists() <file>: returns 1 and displays path if <file> block special file exists, but it was expected to be absent' {
+# local -r file="${TEST_FIXTURE_ROOT}/dir/blockfile"
+# run assert_block_not_exists "$file"
+# [ "$status" -eq 1 ]
+# [ "${#lines[@]}" -eq 3 ]
+# [ "${lines[0]}" == '-- block special file exists, but it was expected to be absent --' ]
+# [ "${lines[1]}" == "path : $file" ]
+# [ "${lines[2]}" == '--' ]
+# }
# Transforming path
-@test 'assert_block_not_exists() <file>: replace prefix of displayed path' {
- local -r BATSLIB_FILE_PATH_REM="#${TEST_FIXTURE_ROOT}"
- local -r BATSLIB_FILE_PATH_ADD='..'
- run assert_block_not_exists "${TEST_FIXTURE_ROOT}/dir/blockfile"
- [ "$status" -eq 1 ]
- [ "${#lines[@]}" -eq 3 ]
- [ "${lines[0]}" == '-- block special file exists, but it was expected to be absent --' ]
- [ "${lines[1]}" == "path : ../dir/blockfile" ]
- [ "${lines[2]}" == '--' ]
-}
+# @test 'assert_block_not_exists() <file>: replace prefix of displayed path' {
+# local -r BATSLIB_FILE_PATH_REM="#${TEST_FIXTURE_ROOT}"
+# local -r BATSLIB_FILE_PATH_ADD='..'
+# run assert_block_not_exists "${TEST_FIXTURE_ROOT}/dir/blockfile"
+# [ "$status" -eq 1 ]
+# [ "${#lines[@]}" -eq 3 ]
+# [ "${lines[0]}" == '-- block special file exists, but it was expected to be absent --' ]
+# [ "${lines[1]}" == "path : ../dir/blockfile" ]
+# [ "${lines[2]}" == '--' ]
+# }
-@test 'assert_block_not_exists() <file>: replace suffix of displayed path' {
- local -r BATSLIB_FILE_PATH_REM='%blockfile'
- local -r BATSLIB_FILE_PATH_ADD='..'
- run assert_block_not_exists "${TEST_FIXTURE_ROOT}/dir/blockfile"
- [ "$status" -eq 1 ]
- [ "${#lines[@]}" -eq 3 ]
- [ "${lines[0]}" == '-- block special file exists, but it was expected to be absent --' ]
- [ "${lines[1]}" == "path : ${TEST_FIXTURE_ROOT}/dir/.." ]
- [ "${lines[2]}" == '--' ]
+# @test 'assert_block_not_exists() <file>: replace suffix of displayed path' {
+# local -r BATSLIB_FILE_PATH_REM='%blockfile'
+# local -r BATSLIB_FILE_PATH_ADD='..'
+# run assert_block_not_exists "${TEST_FIXTURE_ROOT}/dir/blockfile"
+# [ "$status" -eq 1 ]
+# [ "${#lines[@]}" -eq 3 ]
+# [ "${lines[0]}" == '-- block special file exists, but it was expected to be absent --' ]
+# [ "${lines[1]}" == "path : ${TEST_FIXTURE_ROOT}/dir/.." ]
+# [ "${lines[2]}" == '--' ]
-}
-
-@test 'assert_block_not_exists() <file>: replace infix of displayed path' {
- local -r BATSLIB_FILE_PATH_REM='dir'
- local -r BATSLIB_FILE_PATH_ADD='..'
- run assert_block_not_exists "${TEST_FIXTURE_ROOT}/dir/blockfile"
- [ "$status" -eq 1 ]
- [ "${#lines[@]}" -eq 3 ]
- [ "${lines[0]}" == '-- block special file exists, but it was expected to be absent --' ]
- [ "${lines[1]}" == "path : ${TEST_FIXTURE_ROOT}/../blockfile" ]
- [ "${lines[2]}" == '--' ]
-}
+# }
+# @test 'assert_block_not_exists() <file>: replace infix of displayed path' {
+# local -r BATSLIB_FILE_PATH_REM='dir'
+# local -r BATSLIB_FILE_PATH_ADD='..'
+# run assert_block_not_exists "${TEST_FIXTURE_ROOT}/dir/blockfile"
+# [ "$status" -eq 1 ]
+# [ "${#lines[@]}" -eq 3 ]
+# [ "${lines[0]}" == '-- block special file exists, but it was expected to be absent --' ]
+# [ "${lines[1]}" == "path : ${TEST_FIXTURE_ROOT}/../blockfile" ]
+# [ "${lines[2]}" == '--' ]
+# }
diff --git a/test/59-assert-10-assert_file_owner.bats b/test/59-assert-10-assert_file_owner.bats
index f1a2f35..2dcf061 100644
--- a/test/59-assert-10-assert_file_owner.bats
+++ b/test/59-assert-10-assert_file_owner.bats
@@ -8,24 +8,24 @@ setup () {
# There is PATH addition to /usr/sbin which won't come by default on bash3
# on macOS
chown_path=$(PATH="$PATH:/usr/sbin" command -v chown 2>/dev/null)
- bats_sudo "$chown_path" root ${TEST_FIXTURE_ROOT}/dir/owner
- bats_sudo "$chown_path" daemon ${TEST_FIXTURE_ROOT}/dir/notowner
+ # bats_sudo "$chown_path" root ${TEST_FIXTURE_ROOT}/dir/owner
+ # bats_sudo "$chown_path" daemon ${TEST_FIXTURE_ROOT}/dir/notowner
}
-teardown () {
- bats_sudo rm -f ${TEST_FIXTURE_ROOT}/dir/owner ${TEST_FIXTURE_ROOT}/dir/notowner
-}
+# teardown () {
+# bats_sudo rm -f ${TEST_FIXTURE_ROOT}/dir/owner ${TEST_FIXTURE_ROOT}/dir/notowner
+# }
# Correctness
-@test 'assert_file_owner() <file>: returns 0 if <file> user root is the owner of the file' {
- local -r owner="root"
- local -r file="${TEST_FIXTURE_ROOT}/dir/owner"
- run assert_file_owner "$owner" "$file"
- [ "$status" -eq 0 ]
- echo ${#lines[@]}
- [ "${#lines[@]}" -eq 0 ]
+# @test 'assert_file_owner() <file>: returns 0 if <file> user root is the owner of the file' {
+# local -r owner="root"
+# local -r file="${TEST_FIXTURE_ROOT}/dir/owner"
+# run assert_file_owner "$owner" "$file"
+# [ "$status" -eq 0 ]
+# echo ${#lines[@]}
+# [ "${#lines[@]}" -eq 0 ]
-}
+# }
@test 'assert_file_owner() <file>: returns 1 and displays path if <file> user root is not the owner of the file' {
local -r owner="root"
diff --git a/test/59-assert-11-assert_not_file_owner.bats b/test/59-assert-11-assert_not_file_owner.bats
index 5518941..b6e018e 100644
--- a/test/59-assert-11-assert_not_file_owner.bats
+++ b/test/59-assert-11-assert_not_file_owner.bats
@@ -8,13 +8,13 @@ setup () {
# There is PATH addition to /usr/sbin which won't come by default on bash3
# on macOS
chown_path=$(PATH="$PATH:/usr/sbin" command -v chown 2>/dev/null)
- bats_sudo "$chown_path" root ${TEST_FIXTURE_ROOT}/dir/owner
- bats_sudo "$chown_path" daemon ${TEST_FIXTURE_ROOT}/dir/notowner
+ # bats_sudo "$chown_path" root ${TEST_FIXTURE_ROOT}/dir/owner
+ # bats_sudo "$chown_path" daemon ${TEST_FIXTURE_ROOT}/dir/notowner
}
-teardown () {
- bats_sudo rm -f ${TEST_FIXTURE_ROOT}/dir/owner ${TEST_FIXTURE_ROOT}/dir/notowner
-}
+# teardown () {
+# bats_sudo rm -f ${TEST_FIXTURE_ROOT}/dir/owner ${TEST_FIXTURE_ROOT}/dir/notowner
+# }
# Correctness
@test 'assert_not_file_owner() <file>: returns 0 if <file> user is not the owner' {
@@ -25,54 +25,54 @@ teardown () {
[ "${#lines[@]}" -eq 0 ]
}
-@test 'assert_not_file_owner() <file>: returns 1 and displays path if <file> user root is the owner of the file, but it was expected not to be' {
- local -r owner="root"
- local -r file="${TEST_FIXTURE_ROOT}/dir/owner"
- run assert_not_file_owner "$owner" "$file"
- [ "$status" -eq 1 ]
- [ "${#lines[@]}" -eq 3 ]
- [ "${lines[0]}" == '-- user root is the owner of the file, but it was expected not to be --' ]
- [ "${lines[1]}" == "path : $file" ]
- [ "${lines[2]}" == '--' ]
-}
+# @test 'assert_not_file_owner() <file>: returns 1 and displays path if <file> user root is the owner of the file, but it was expected not to be' {
+# local -r owner="root"
+# local -r file="${TEST_FIXTURE_ROOT}/dir/owner"
+# run assert_not_file_owner "$owner" "$file"
+# [ "$status" -eq 1 ]
+# [ "${#lines[@]}" -eq 3 ]
+# [ "${lines[0]}" == '-- user root is the owner of the file, but it was expected not to be --' ]
+# [ "${lines[1]}" == "path : $file" ]
+# [ "${lines[2]}" == '--' ]
+# }
# Transforming path
-@test 'assert_not_file_owner() <file>: replace prefix of displayed path' {
- local -r BATSLIB_FILE_PATH_REM="#${TEST_FIXTURE_ROOT}"
- local -r BATSLIB_FILE_PATH_ADD='..'
- local -r owner="root"
- local -r file="${TEST_FIXTURE_ROOT}/dir/owner"
- run assert_not_file_owner "$owner" "$file"
- [ "$status" -eq 1 ]
- [ "${#lines[@]}" -eq 3 ]
- [ "${lines[0]}" == '-- user root is the owner of the file, but it was expected not to be --' ]
- [ "${lines[1]}" == "path : ../dir/owner" ]
- [ "${lines[2]}" == '--' ]
-}
+# @test 'assert_not_file_owner() <file>: replace prefix of displayed path' {
+# local -r BATSLIB_FILE_PATH_REM="#${TEST_FIXTURE_ROOT}"
+# local -r BATSLIB_FILE_PATH_ADD='..'
+# local -r owner="root"
+# local -r file="${TEST_FIXTURE_ROOT}/dir/owner"
+# run assert_not_file_owner "$owner" "$file"
+# [ "$status" -eq 1 ]
+# [ "${#lines[@]}" -eq 3 ]
+# [ "${lines[0]}" == '-- user root is the owner of the file, but it was expected not to be --' ]
+# [ "${lines[1]}" == "path : ../dir/owner" ]
+# [ "${lines[2]}" == '--' ]
+# }
-@test 'assert_not_file_owner() <file>: replace suffix of displayed path' {
- local -r BATSLIB_FILE_PATH_REM='%dir/owner'
- local -r BATSLIB_FILE_PATH_ADD='..'
- local -r owner="root"
- local -r file="${TEST_FIXTURE_ROOT}/dir/owner"
- run assert_not_file_owner "$owner" "$file"
- [ "$status" -eq 1 ]
- [ "${#lines[@]}" -eq 3 ]
- [ "${lines[0]}" == '-- user root is the owner of the file, but it was expected not to be --' ]
- [ "${lines[1]}" == "path : ${TEST_FIXTURE_ROOT}/.." ]
- [ "${lines[2]}" == '--' ]
-}
+# @test 'assert_not_file_owner() <file>: replace suffix of displayed path' {
+# local -r BATSLIB_FILE_PATH_REM='%dir/owner'
+# local -r BATSLIB_FILE_PATH_ADD='..'
+# local -r owner="root"
+# local -r file="${TEST_FIXTURE_ROOT}/dir/owner"
+# run assert_not_file_owner "$owner" "$file"
+# [ "$status" -eq 1 ]
+# [ "${#lines[@]}" -eq 3 ]
+# [ "${lines[0]}" == '-- user root is the owner of the file, but it was expected not to be --' ]
+# [ "${lines[1]}" == "path : ${TEST_FIXTURE_ROOT}/.." ]
+# [ "${lines[2]}" == '--' ]
+# }
-@test 'assert_not_file_owner() <file>: replace infix of displayed path' {
- local -r BATSLIB_FILE_PATH_REM='dir/owner'
- local -r BATSLIB_FILE_PATH_ADD='..'
- local -r owner="root"
- local -r file="${TEST_FIXTURE_ROOT}/dir/owner"
- run assert_not_file_owner "$owner" "$file"
- [ "$status" -eq 1 ]
- [ "${#lines[@]}" -eq 3 ]
- [ "${lines[0]}" == '-- user root is the owner of the file, but it was expected not to be --' ]
- [ "${lines[1]}" == "path : ${TEST_FIXTURE_ROOT}/.." ]
- [ "${lines[2]}" == '--' ]
-}
+# @test 'assert_not_file_owner() <file>: replace infix of displayed path' {
+# local -r BATSLIB_FILE_PATH_REM='dir/owner'
+# local -r BATSLIB_FILE_PATH_ADD='..'
+# local -r owner="root"
+# local -r file="${TEST_FIXTURE_ROOT}/dir/owner"
+# run assert_not_file_owner "$owner" "$file"
+# [ "$status" -eq 1 ]
+# [ "${#lines[@]}" -eq 3 ]
+# [ "${lines[0]}" == '-- user root is the owner of the file, but it was expected not to be --' ]
+# [ "${lines[1]}" == "path : ${TEST_FIXTURE_ROOT}/.." ]
+# [ "${lines[2]}" == '--' ]
+# }
diff --git a/test/70-temp-11-temp_del.bats b/test/70-temp-11-temp_del.bats
index 1eb9991..0eaed3a 100755
--- a/test/70-temp-11-temp_del.bats
+++ b/test/70-temp-11-temp_del.bats
@@ -14,19 +14,19 @@ fixtures 'temp'
[ ! -e "$TEST_TEMP_DIR" ]
}
-@test 'temp_del() <path>: works even if wrote-protected file/directory exists within' {
- TEST_TEMP_DIR="$(temp_make)"
- touch $TEST_TEMP_DIR/nowritefile
- chmod -w $TEST_TEMP_DIR/nowritefile
- mkdir -p $TEST_TEMP_DIR/nowritefolder
- chmod -w $TEST_TEMP_DIR/nowritefolder
-
- run temp_del "$TEST_TEMP_DIR"
-
- [ "$status" -eq 0 ]
- [ "${#lines[@]}" -eq 0 ]
- [ ! -e "$TEST_TEMP_DIR" ]
-}
+# @test 'temp_del() <path>: works even if wrote-protected file/directory exists within' {
+# TEST_TEMP_DIR="$(temp_make)"
+# touch $TEST_TEMP_DIR/nowritefile
+# chmod -w $TEST_TEMP_DIR/nowritefile
+# mkdir -p $TEST_TEMP_DIR/nowritefolder
+# chmod -w $TEST_TEMP_DIR/nowritefolder
+
+# run temp_del "$TEST_TEMP_DIR"
+
+# [ "$status" -eq 0 ]
+# [ "${#lines[@]}" -eq 0 ]
+# [ ! -e "$TEST_TEMP_DIR" ]
+# }
@test 'temp_del() <path>: returns 1 and displays an error message if <path> can not be deleted' {
local -r path="${TEST_FIXTURE_ROOT}/does/not/exist"
+2 -2
View File
@@ -1,3 +1,3 @@
# basic-rpm-template
# bats-file-rpm
A template that only contains the copr and rpm builder workflow files
Build an rpm of bats-file, a file-realated test helper library for BATS.
+2 -2
View File
@@ -9,12 +9,12 @@ Summary: Bash Automated Testing System assertion helper
License: CC0-1.0
URL: https://github.com/bats-core/%{upstreamname}
Source: https://github.com/bats-core/%{upstreamname}/archive/v%{version}.tar.gz
Patch: 01-disable-tests-requiring-sudo.patch
Patch0: 01-disable-tests-requiring-root.patch
BuildArch: noarch
Requires: bats-filesystem parallel
BuildRequires: bats-filesystem bats-support parallel procps-ng
BuildRequires: bats-filesystem bats-support parallel procps-ng python-unversioned-command
%description
Bats is a TAP-compliant testing framework for Bash. It provides a simple way to