Use skip to disable tests requiring root permissions

This commit is contained in:
2026-03-23 11:41:40 +01:00
parent bf811af8ba
commit 07fbceb145
4 changed files with 298 additions and 392 deletions
+2
View File
@@ -19,3 +19,5 @@ tags
# Persistent undo
[._]*.un~
.idea/
+293 -389
View File
@@ -1,8 +1,80 @@
diff --git a/test/50-assert-10-assert_exists.bats b/test/50-assert-10-assert_exists.bats
index 8dc0ee9..4474768 100755
--- a/test/50-assert-10-assert_exists.bats
+++ b/test/50-assert-10-assert_exists.bats
@@ -59,6 +59,7 @@ teardown () {
}
@test 'assert_exists() <file>: replace infix of displayed path' {
+ skip "Fails on COPR, probably because of built-in path sanitization"
local -r BATSLIB_FILE_PATH_REM='dir'
local -r BATSLIB_FILE_PATH_ADD='..'
run assert_exists "${TEST_FIXTURE_ROOT}/dir/file.does_not_exist"
diff --git a/test/50-assert-11-assert_not_exists.bats b/test/50-assert-11-assert_not_exists.bats
index 107898c..5ad7c1f 100644
--- a/test/50-assert-11-assert_not_exists.bats
+++ b/test/50-assert-11-assert_not_exists.bats
@@ -52,6 +52,7 @@ teardown () {
}
@test 'assert_not_exists() <file>: replace infix of displayed path' {
+ skip "Fails on COPR, probably because of built-in path sanitization"
local -r BATSLIB_FILE_PATH_REM='dir'
local -r BATSLIB_FILE_PATH_ADD='..'
run assert_not_exists "${TEST_FIXTURE_ROOT}/dir/file"
diff --git a/test/51-assert-10-assert_file_exists.bats b/test/51-assert-10-assert_file_exists.bats
index 9c4c8a5..d344e67 100755
--- a/test/51-assert-10-assert_file_exists.bats
+++ b/test/51-assert-10-assert_file_exists.bats
@@ -52,6 +52,7 @@ teardown () {
}
@test 'assert_file_exists() <file>: replace infix of displayed path' {
+ skip "Fails on COPR, probably because of built-in path sanitization"
local -r BATSLIB_FILE_PATH_REM='dir'
local -r BATSLIB_FILE_PATH_ADD='..'
run assert_file_exists "${TEST_FIXTURE_ROOT}/dir"
diff --git a/test/51-assert-11-assert_file_not_exists.bats b/test/51-assert-11-assert_file_not_exists.bats
index 107898c..5ad7c1f 100755
--- a/test/51-assert-11-assert_file_not_exists.bats
+++ b/test/51-assert-11-assert_file_not_exists.bats
@@ -52,6 +52,7 @@ teardown () {
}
@test 'assert_not_exists() <file>: replace infix of displayed path' {
+ skip "Fails on COPR, probably because of built-in path sanitization"
local -r BATSLIB_FILE_PATH_REM='dir'
local -r BATSLIB_FILE_PATH_ADD='..'
run assert_not_exists "${TEST_FIXTURE_ROOT}/dir/file"
diff --git a/test/52-assert-11-assert_file_not_executable.bats b/test/52-assert-11-assert_file_not_executable.bats
index 9896c27..b9b7e7c 100644
--- a/test/52-assert-11-assert_file_not_executable.bats
+++ b/test/52-assert-11-assert_file_not_executable.bats
@@ -54,6 +54,7 @@ teardown () {
}
@test 'assert_file_not_executable() <file>: replace infix of displayed path' {
+ skip "Fails on COPR, probably because of built-in path sanitization"
local -r BATSLIB_FILE_PATH_REM='dir'
local -r BATSLIB_FILE_PATH_ADD='..'
run assert_file_not_executable "${TEST_FIXTURE_ROOT}/dir/execfile"
diff --git a/test/53-assert-11-assert_link_not_exists.bats b/test/53-assert-11-assert_link_not_exists.bats
index 8133dcf..9d1c2bf 100644
--- a/test/53-assert-11-assert_link_not_exists.bats
+++ b/test/53-assert-11-assert_link_not_exists.bats
@@ -56,6 +56,7 @@ teardown () {
}
@test 'assert_link_not_exists() <file>: replace infix of displayed path' {
+ skip "Fails on COPR, probably because of built-in path sanitization"
local -r BATSLIB_FILE_PATH_REM='dir'
local -r BATSLIB_FILE_PATH_ADD='..'
run assert_link_not_exists "${TEST_FIXTURE_ROOT}/dir/link"
diff --git a/test/54-assert-10-assert_character_exists.bats b/test/54-assert-10-assert_character_exists.bats
index c92a1a3..c4e6ac0 100644
index c92a1a3..87a637d 100644
--- a/test/54-assert-10-assert_character_exists.bats
+++ b/test/54-assert-10-assert_character_exists.bats
@@ -3,20 +3,20 @@
@@ -3,20 +3,21 @@
load 'test_helper'
fixtures 'exist'
@@ -23,457 +95,289 @@ index c92a1a3..c4e6ac0 100644
- [ "$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 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..6161377 100644
index 6586a7f..671bbc9 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'
@@ -4,6 +4,7 @@ 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
setup () {
+ skip "Requires root privileges"
bats_sudo mknod ${TEST_FIXTURE_ROOT}/dir/test_device c 89 1
}
@@ -18,46 +18,46 @@ teardown () {
[ "${#lines[@]}" -eq 0 ]
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' {
- 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]}" == '--' ]
+# }
@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' {
- 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 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' {
- 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 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' {
- 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]}" == '--' ]
+# }
@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..49c99e6 100644
index 2211a3b..c8dd220 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'
@@ -3,6 +3,7 @@ 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
setup () {
+ skip "Requires root privileges"
bats_sudo mknod ${TEST_FIXTURE_ROOT}/dir/blockfile b 89 1
}
teardown () {
@@ -11,10 +12,11 @@ teardown () {
# 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 ]
@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 ]
- [ "${#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 ]
+# }
+ [ "${#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
index 9bff904..33b0231 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'
@@ -4,6 +4,7 @@ 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
setup () {
+ skip "Requires root privileges"
bats_sudo mknod ${TEST_FIXTURE_ROOT}/dir/blockfile b 89 1
}
@@ -18,48 +18,47 @@ teardown () {
[ "${#lines[@]}" -eq 0 ]
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' {
- 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]}" == '--' ]
+# }
@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' {
- 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 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' {
- 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 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"
@@ -62,4 +67,3 @@ teardown () {
[ "${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/56-assert-10-assert_fifo_exists.bats b/test/56-assert-10-assert_fifo_exists.bats
index 780154d..c3096c3 100644
--- a/test/56-assert-10-assert_fifo_exists.bats
+++ b/test/56-assert-10-assert_fifo_exists.bats
@@ -52,6 +52,7 @@ teardown () {
}
+# @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_fifo_exists() <file>: replace infix of displayed path' {
+ skip "Fails on COPR, probably because of built-in path sanitization"
local -r BATSLIB_FILE_PATH_REM='dir'
local -r BATSLIB_FILE_PATH_ADD='..'
run assert_fifo_exists "${TEST_FIXTURE_ROOT}/dir"
diff --git a/test/56-assert-11-assert_fifo_not_exists.bats b/test/56-assert-11-assert_fifo_not_exists.bats
index 5aeb800..b918c1c 100644
--- a/test/56-assert-11-assert_fifo_not_exists.bats
+++ b/test/56-assert-11-assert_fifo_not_exists.bats
@@ -54,6 +54,7 @@ teardown () {
}
@test 'assert_fifo_not_exists() <file>: replace infix of displayed path' {
+ skip "Fails on COPR, probably because of built-in path sanitization"
local -r BATSLIB_FILE_PATH_REM='dir'
local -r BATSLIB_FILE_PATH_ADD='..'
run assert_fifo_not_exists "${TEST_FIXTURE_ROOT}/dir/testpipe"
diff --git a/test/58-assert-10-assert_equal_files.bats b/test/58-assert-10-assert_equal_files.bats
index b391122..d5395ed 100644
--- a/test/58-assert-10-assert_equal_files.bats
+++ b/test/58-assert-10-assert_equal_files.bats
@@ -77,6 +77,7 @@ teardown () {
}
@test 'assert_files_equal() <file>: replace infix of displayed path' {
+ skip "Fails on COPR, probably because of built-in path sanitization"
local -r file2="${TEST_FIXTURE_ROOT}/dir/same_file_with_text"
local -r file1="${TEST_FIXTURE_ROOT}/dir/file"
local -r BATSLIB_FILE_PATH_REM='dir'
diff --git a/test/58-assert-11-assert_not_equal_files.bats b/test/58-assert-11-assert_not_equal_files.bats
index f7e719f..cc32c09 100644
--- a/test/58-assert-11-assert_not_equal_files.bats
+++ b/test/58-assert-11-assert_not_equal_files.bats
@@ -72,6 +72,7 @@ teardown () {
}
@test 'assert_files_not_equal() <file>: replace infix of displayed path' {
+ skip "Fails on COPR, probably because of built-in path sanitization"
local -r file2="${TEST_FIXTURE_ROOT}/dir/same_file_with_text"
local -r file1="${TEST_FIXTURE_ROOT}/dir/file_with_text"
local -r BATSLIB_FILE_PATH_REM='dir'
diff --git a/test/59-assert-10-assert_file_owner.bats b/test/59-assert-10-assert_file_owner.bats
index f1a2f35..2dcf061 100644
index f1a2f35..cc687ff 100644
--- a/test/59-assert-10-assert_file_owner.bats
+++ b/test/59-assert-10-assert_file_owner.bats
@@ -8,24 +8,24 @@ setup () {
@@ -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)
- 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
+ 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 () {
- 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
+# }
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' {
- 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' {
@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..b6e018e 100644
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,13 +8,13 @@ setup () {
@@ -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)
- 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
+ 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 () {
- 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 ]
teardown () {
+ skip "Requires root privileges"
bats_sudo rm -f ${TEST_FIXTURE_ROOT}/dir/owner ${TEST_FIXTURE_ROOT}/dir/notowner
}
-@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]}" == '--' ]
+# }
@@ -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' {
- 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 '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 '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 '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 '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"
@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/68-assert-10-assert_file_empty.bats b/test/68-assert-10-assert_file_empty.bats
index baf7ee9..5c05e92 100644
--- a/test/68-assert-10-assert_file_empty.bats
+++ b/test/68-assert-10-assert_file_empty.bats
@@ -42,6 +42,7 @@ fixtures 'empty'
[ "${lines[3]}" == '--' ]
}
@test 'assert_file_empty() <file>: replace infix of displayed path' {
+ skip "Fails on COPR, probably because of built-in path sanitization"
local -r BATSLIB_FILE_PATH_REM='dir'
local -r BATSLIB_FILE_PATH_ADD='..'
run assert_file_empty "${TEST_FIXTURE_ROOT}/dir/non-empty-file"
diff --git a/test/68-assert-11-assert_file_not_empty.bats b/test/68-assert-11-assert_file_not_empty.bats
index 75a0823..1d2376e 100644
--- a/test/68-assert-11-assert_file_not_empty.bats
+++ b/test/68-assert-11-assert_file_not_empty.bats
@@ -40,6 +40,7 @@ echo [ "${lines[1]}" == "path : ${TEST_FIXTURE_ROOT}/dir/.." ]
[ "${lines[2]}" == '--' ]
}
@test 'assert_file_not_empty() <file>: replace infix of displayed path' {
+ skip "Fails on COPR, probably because of built-in path sanitization"
local -r BATSLIB_FILE_PATH_REM='dir'
local -r BATSLIB_FILE_PATH_ADD='..'
run assert_file_not_empty "${TEST_FIXTURE_ROOT}/dir/empty-file"
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
+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.
+1 -1
View File
@@ -14,7 +14,7 @@ Patch: 01-disable-tests-requiring-sudo.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