generated from demus/basic-rpm-template
First packaging
Build and provide rpm of bats-file / Build src rpm and send it to COPR (f42) (release) Failing after 2m12s
Build and provide rpm of bats-file / Build src rpm and send it to COPR (f43) (release) Failing after 1m40s
Build and provide rpm of bats-file / Build src rpm and send it to COPR (f44) (release) Failing after 2m20s
Build and provide rpm of bats-file / Build src rpm and send it to COPR (rawhide) (release) Failing after 1m41s
Build and provide rpm of bats-file / Build src rpm and send it to COPR (f42) (release) Failing after 2m12s
Build and provide rpm of bats-file / Build src rpm and send it to COPR (f43) (release) Failing after 1m40s
Build and provide rpm of bats-file / Build src rpm and send it to COPR (f44) (release) Failing after 2m20s
Build and provide rpm of bats-file / Build src rpm and send it to COPR (rawhide) (release) Failing after 1m41s
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
name: Build and provide rpm of bats-file-rpm
|
||||
run-name: Build bats-file-rpm from ${{ gitea.repository }} on COPR by ${{ github.actor }}
|
||||
name: Build and provide rpm of bats-file
|
||||
run-name: Build bats-file from ${{ gitea.repository }} on COPR by ${{ github.actor }}
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
@@ -7,7 +7,7 @@ on:
|
||||
type: choice
|
||||
description: "Choose a fedora version"
|
||||
required: true
|
||||
options: [ f42, f43, rawhide ]
|
||||
options: [ f42, f43, f44, rawhide ]
|
||||
coprproject:
|
||||
type: choice
|
||||
description: "Which repo"
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
name: Build and provide rpm of bats-file-rpm
|
||||
run-name: Build bats-file-rpm from ${{ gitea.repository }} on COPR by ${{ github.actor }}
|
||||
name: Build and provide rpm of bats-file
|
||||
run-name: Build bats-file from ${{ gitea.repository }} on COPR by ${{ github.actor }}
|
||||
on: [release]
|
||||
jobs:
|
||||
coprbuild:
|
||||
name: Build src rpm and send it to COPR
|
||||
strategy:
|
||||
matrix:
|
||||
fedoraversion: [ f42, f43, rawhide ]
|
||||
fedoraversion: [ f42, f43, f44, rawhide ]
|
||||
runs-on: ${{ matrix.fedoraversion }}-minimal-copr
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: Build and provide rpm of bats-file-rpm
|
||||
run-name: Rpmbuild bats-file-rpm at ${{ gitea.repository }} by ${{ github.actor }}
|
||||
name: Build and provide rpm of bats-file
|
||||
run-name: Rpmbuild bats-file at ${{ gitea.repository }} by ${{ github.actor }}
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
@@ -7,7 +7,7 @@ on:
|
||||
type: choice
|
||||
description: "Choose a fedora version"
|
||||
required: true
|
||||
options: [ f42, f43, rawhide ]
|
||||
options: [ f42, f43, f44, rawhide ]
|
||||
jobs:
|
||||
rpmbuild:
|
||||
name: Build and deploy an rpm to the demus.dk repo
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
name: Build and provide rpm of bats-file-rpm
|
||||
run-name: Rpmbuild bats-file-rpm by ${{ github.actor }} by ${{ github.actor }}
|
||||
name: Build and provide rpm of bats-file
|
||||
run-name: Rpmbuild bats-file by ${{ github.actor }} by ${{ github.actor }}
|
||||
on: [ release ]
|
||||
jobs:
|
||||
rpmbuild:
|
||||
name: Build and deploy an rpm to the demus.dk repo
|
||||
strategy:
|
||||
matrix:
|
||||
fedoraversion: [ f42, f43, rawhide ]
|
||||
fedoraversion: [ f42, f43, f44, rawhide ]
|
||||
runs-on: ${{ matrix.fedoraversion }}-minimal-rpmbuild
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
|
||||
@@ -0,0 +1,479 @@
|
||||
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"
|
||||
@@ -0,0 +1,45 @@
|
||||
%global upstreamname bats-file
|
||||
%global bats_libdir %{_batslibdir}/%{upstreamname}
|
||||
|
||||
Name: %upstreamname
|
||||
Version: 0.4.0
|
||||
Release: %autorelease
|
||||
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
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
Requires: bats-filesystem parallel
|
||||
BuildRequires: bats-filesystem bats-support parallel procps-ng
|
||||
|
||||
%description
|
||||
Bats is a TAP-compliant testing framework for Bash. It provides a simple way to
|
||||
verify that the UNIX programs you write behave as expected. Bats is most useful
|
||||
when testing software written in Bash, but you can use it to test any UNIX
|
||||
program.
|
||||
|
||||
bats-assert is a helper library providing common assertions for Bats.
|
||||
|
||||
%prep
|
||||
%autosetup -n %{upstreamname}-%{version} -p1
|
||||
|
||||
%install
|
||||
%{__install} -D -m 0644 -t %{buildroot}%{bats_libdir} load.bash
|
||||
%{__install} -D -m 0644 -t %{buildroot}%{bats_libdir}/src src/*
|
||||
%dnl Should turn up with the next release
|
||||
%dnl ./install.sh ${RPM_BUILD_ROOT}%{_prefix}
|
||||
|
||||
%check
|
||||
bats test
|
||||
|
||||
%files
|
||||
%doc README.md CHANGELOG.md
|
||||
%license LICENSE
|
||||
%{bats_libdir}
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
Reference in New Issue
Block a user