Files
bats-file-rpm/01-disable-tests-requiring-root.patch

231 lines
8.5 KiB
Diff

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