mirror of
https://github.com/fsquillace/junest.git
synced 2026-01-23 02:34:30 +00:00
Disable the checks and fix shellcheck
This commit is contained in:
parent
4d2d0fcb84
commit
fd44972137
9 changed files with 55 additions and 1 deletions
|
|
@ -29,12 +29,15 @@ function tearDown(){
|
|||
|
||||
function init_mocks() {
|
||||
chroot_cmd() {
|
||||
# shellcheck disable=SC2317
|
||||
[ "$JUNEST_ENV" != "1" ] && return 1
|
||||
# shellcheck disable=SC2317
|
||||
echo "chroot_cmd $*"
|
||||
}
|
||||
# shellcheck disable=SC2034
|
||||
GROOT=chroot_cmd
|
||||
mychroot() {
|
||||
# shellcheck disable=SC2317
|
||||
echo mychroot "$*"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,10 @@ function oneTimeTearDown(){
|
|||
|
||||
function setUp(){
|
||||
ld_exec_mock() {
|
||||
# shellcheck disable=SC2317
|
||||
echo "ld_exec $*"
|
||||
}
|
||||
# shellcheck disable=SC2317
|
||||
ld_exec_mock_false() {
|
||||
echo "ld_exec $*"
|
||||
return 1
|
||||
|
|
@ -32,11 +34,13 @@ function setUp(){
|
|||
LD_EXEC=ld_exec_mock
|
||||
|
||||
unshare_mock() {
|
||||
# shellcheck disable=SC2317
|
||||
echo "unshare $*"
|
||||
}
|
||||
# shellcheck disable=SC2034
|
||||
UNSHARE=unshare_mock
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
bwrap_mock() {
|
||||
echo "bwrap $*"
|
||||
}
|
||||
|
|
@ -173,6 +177,7 @@ function test_proot_cmd_compat(){
|
|||
|
||||
function test_proot_cmd_seccomp(){
|
||||
envv(){
|
||||
# shellcheck disable=SC2317
|
||||
env
|
||||
}
|
||||
PROOT=envv
|
||||
|
|
@ -180,6 +185,7 @@ function test_proot_cmd_seccomp(){
|
|||
assertEquals "" "$(grep "^PROOT_NO_SECCOMP" "$STDOUTF")"
|
||||
|
||||
envv(){
|
||||
# shellcheck disable=SC2317
|
||||
env | grep "^PROOT_NO_SECCOMP"
|
||||
}
|
||||
# shellcheck disable=SC2034
|
||||
|
|
@ -193,6 +199,7 @@ PROOT_NO_SECCOMP=1" "$(grep "^PROOT_NO_SECCOMP" "$STDOUTF")"
|
|||
|
||||
function test_copy_passwd_and_group(){
|
||||
getent_cmd_mock() {
|
||||
# shellcheck disable=SC2317
|
||||
echo "$*"
|
||||
}
|
||||
GETENT=getent_cmd_mock assertCommandSuccess copy_passwd_and_group
|
||||
|
|
@ -202,6 +209,7 @@ function test_copy_passwd_and_group(){
|
|||
|
||||
function test_copy_passwd_and_group_fallback(){
|
||||
cp_cmd_mock() {
|
||||
# shellcheck disable=SC2317
|
||||
echo "$*"
|
||||
}
|
||||
CP=cp_cmd_mock GETENT=false LD_EXEC=false assertCommandSuccess copy_passwd_and_group
|
||||
|
|
|
|||
|
|
@ -15,25 +15,32 @@ function oneTimeSetUp(){
|
|||
|
||||
function setUp(){
|
||||
## Mock functions ##
|
||||
# shellcheck disable=SC2317
|
||||
function usage(){
|
||||
echo "usage"
|
||||
}
|
||||
# shellcheck disable=SC2317
|
||||
function version(){
|
||||
echo "version"
|
||||
}
|
||||
# shellcheck disable=SC2317
|
||||
function build_image_env(){
|
||||
local disable_check=$1
|
||||
echo "build_image_env($disable_check)"
|
||||
}
|
||||
# shellcheck disable=SC2317
|
||||
function delete_env(){
|
||||
echo "delete_env"
|
||||
}
|
||||
# shellcheck disable=SC2317
|
||||
function setup_env_from_file(){
|
||||
echo "setup_env_from_file($1)"
|
||||
}
|
||||
# shellcheck disable=SC2317
|
||||
function setup_env(){
|
||||
echo "setup_env($1)"
|
||||
}
|
||||
# shellcheck disable=SC2317
|
||||
function run_env_as_proot_fakeroot(){
|
||||
local backend_command="$1"
|
||||
local backend_args="$2"
|
||||
|
|
@ -41,6 +48,7 @@ function setUp(){
|
|||
shift 3
|
||||
echo "run_env_as_proot_fakeroot($backend_command,$backend_args,$no_copy_files,$*)"
|
||||
}
|
||||
# shellcheck disable=SC2317
|
||||
function run_env_as_groot(){
|
||||
local backend_command="$1"
|
||||
local backend_args="$2"
|
||||
|
|
@ -48,6 +56,7 @@ function setUp(){
|
|||
shift 3
|
||||
echo "run_env_as_groot($backend_command,$backend_args,$no_copy_files,$*)"
|
||||
}
|
||||
# shellcheck disable=SC2317
|
||||
function run_env_as_chroot(){
|
||||
local backend_command="$1"
|
||||
local backend_args="$2"
|
||||
|
|
@ -55,6 +64,7 @@ function setUp(){
|
|||
shift 3
|
||||
echo "run_env_as_chroot($backend_command,$backend_args,$no_copy_files,$*)"
|
||||
}
|
||||
# shellcheck disable=SC2317
|
||||
function run_env_as_proot_user(){
|
||||
local backend_command="$1"
|
||||
local backend_args="$2"
|
||||
|
|
@ -62,6 +72,7 @@ function setUp(){
|
|||
shift 3
|
||||
echo "run_env_as_proot_user($backend_command,$backend_args,$no_copy_files,$*)"
|
||||
}
|
||||
# shellcheck disable=SC2317
|
||||
function run_env_as_bwrap_fakeroot(){
|
||||
local backend_command="$1"
|
||||
local backend_args="$2"
|
||||
|
|
@ -69,6 +80,7 @@ function setUp(){
|
|||
shift 3
|
||||
echo "run_env_as_bwrap_fakeroot($backend_command,$backend_args,$no_copy_files,$*)"
|
||||
}
|
||||
# shellcheck disable=SC2317
|
||||
function run_env_as_bwrap_user(){
|
||||
local backend_command="$1"
|
||||
local backend_args="$2"
|
||||
|
|
@ -76,9 +88,11 @@ function setUp(){
|
|||
shift 3
|
||||
echo "run_env_as_bwrap_user($backend_command,$backend_args,$no_copy_files,$*)"
|
||||
}
|
||||
# shellcheck disable=SC2317
|
||||
function is_env_installed(){
|
||||
return 0
|
||||
}
|
||||
# shellcheck disable=SC2317
|
||||
function create_wrappers(){
|
||||
:
|
||||
}
|
||||
|
|
@ -108,6 +122,7 @@ function test_build_image_env(){
|
|||
}
|
||||
|
||||
function test_create_wrappers(){
|
||||
# shellcheck disable=SC2317
|
||||
function create_wrappers(){
|
||||
local force=$1
|
||||
echo "create_wrappers($force)"
|
||||
|
|
@ -126,6 +141,7 @@ function test_delete_env(){
|
|||
assertEquals "delete_env" "$(cat "$STDOUTF")"
|
||||
}
|
||||
function test_setup_env_from_file(){
|
||||
# shellcheck disable=SC2317
|
||||
is_env_installed(){
|
||||
return 1
|
||||
}
|
||||
|
|
@ -134,6 +150,7 @@ function test_setup_env_from_file(){
|
|||
assertCommandSuccess main setup --from-file myimage
|
||||
assertEquals "setup_env_from_file(myimage)" "$(cat "$STDOUTF")"
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
is_env_installed(){
|
||||
return 0
|
||||
}
|
||||
|
|
@ -141,6 +158,7 @@ function test_setup_env_from_file(){
|
|||
}
|
||||
|
||||
function test_setup_env(){
|
||||
# shellcheck disable=SC2317
|
||||
is_env_installed(){
|
||||
return 1
|
||||
}
|
||||
|
|
@ -153,6 +171,7 @@ function test_setup_env(){
|
|||
assertCommandSuccess main setup --arch arm
|
||||
assertEquals "setup_env(arm)" "$(cat "$STDOUTF")"
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
is_env_installed(){
|
||||
return 0
|
||||
}
|
||||
|
|
@ -181,6 +200,7 @@ function test_run_env_as_proot_fakeroot(){
|
|||
assertCommandSuccess main proot -f -- command --as
|
||||
assertEquals "run_env_as_proot_fakeroot(,,false,command --as)" "$(cat "$STDOUTF")"
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
is_env_installed(){
|
||||
return 1
|
||||
}
|
||||
|
|
@ -207,6 +227,7 @@ function test_run_env_as_user(){
|
|||
assertCommandSuccess main proot -- command -ls
|
||||
assertEquals "run_env_as_proot_user(,,false,command -ls)" "$(cat "$STDOUTF")"
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
is_env_installed(){
|
||||
return 1
|
||||
}
|
||||
|
|
@ -231,6 +252,7 @@ function test_run_env_as_groot(){
|
|||
assertCommandSuccess main groot -- command
|
||||
assertEquals "run_env_as_groot(,,false,command)" "$(cat "$STDOUTF")"
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
is_env_installed(){
|
||||
return 1
|
||||
}
|
||||
|
|
@ -253,6 +275,7 @@ function test_run_env_as_chroot(){
|
|||
assertCommandSuccess main root -- command
|
||||
assertEquals "run_env_as_chroot(,,false,command)" "$(cat "$STDOUTF")"
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
is_env_installed(){
|
||||
return 1
|
||||
}
|
||||
|
|
@ -295,6 +318,7 @@ function test_run_env_as_bwrap_fakeroot(){
|
|||
assertCommandSuccess main -f -- command --as
|
||||
assertEquals "run_env_as_bwrap_fakeroot(,,false,command --as)" "$(cat "$STDOUTF")"
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
is_env_installed(){
|
||||
return 1
|
||||
}
|
||||
|
|
@ -337,6 +361,7 @@ function test_run_env_as_bwrap_user(){
|
|||
assertCommandSuccess main -- command --as
|
||||
assertEquals "run_env_as_bwrap_user(,,false,command --as)" "$(cat "$STDOUTF")"
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
is_env_installed(){
|
||||
return 1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ function oneTimeSetUp(){
|
|||
|
||||
## Mock functions ##
|
||||
function init_mocks() {
|
||||
# shellcheck disable=SC2317
|
||||
function bwrap_cmd(){
|
||||
echo "$BWRAP $*"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ function _test_copy_remaining_files() {
|
|||
}
|
||||
|
||||
function test_run_env_as_proot_user(){
|
||||
# shellcheck disable=SC2317
|
||||
_run_env_with_qemu() {
|
||||
# shellcheck disable=SC2086
|
||||
# shellcheck disable=SC2048
|
||||
|
|
@ -66,6 +67,7 @@ function test_run_env_as_proot_user(){
|
|||
}
|
||||
|
||||
function test_run_env_as_proot_user_with_backend_command(){
|
||||
# shellcheck disable=SC2317
|
||||
_run_env_with_qemu() {
|
||||
# shellcheck disable=SC2086
|
||||
# shellcheck disable=SC2048
|
||||
|
|
@ -83,6 +85,7 @@ function test_run_env_as_proot_user_with_backend_command(){
|
|||
}
|
||||
|
||||
function test_run_env_as_proot_user_no_copy(){
|
||||
# shellcheck disable=SC2317
|
||||
_run_env_with_qemu() {
|
||||
# shellcheck disable=SC2086
|
||||
# shellcheck disable=SC2048
|
||||
|
|
@ -120,6 +123,7 @@ function test_run_env_as_proot_user_nested_env(){
|
|||
}
|
||||
|
||||
function test_run_env_as_proot_fakeroot(){
|
||||
# shellcheck disable=SC2317
|
||||
_run_env_with_qemu() {
|
||||
# shellcheck disable=SC2086
|
||||
# shellcheck disable=SC2048
|
||||
|
|
@ -136,6 +140,7 @@ function test_run_env_as_proot_fakeroot(){
|
|||
}
|
||||
|
||||
function test_run_env_as_proot_fakeroot_with_backend_command(){
|
||||
# shellcheck disable=SC2317
|
||||
_run_env_with_qemu() {
|
||||
# shellcheck disable=SC2086
|
||||
# shellcheck disable=SC2048
|
||||
|
|
@ -159,6 +164,7 @@ function test_run_env_as_proot_fakeroot_nested_env(){
|
|||
}
|
||||
|
||||
function test_run_env_with_quotes(){
|
||||
# shellcheck disable=SC2317
|
||||
_run_env_with_qemu() {
|
||||
# shellcheck disable=SC2086
|
||||
# shellcheck disable=SC2048
|
||||
|
|
@ -169,6 +175,7 @@ function test_run_env_with_quotes(){
|
|||
}
|
||||
|
||||
function test_run_env_with_proot_args(){
|
||||
# shellcheck disable=SC2317
|
||||
proot_cmd() {
|
||||
[ "$JUNEST_ENV" != "1" ] && return 1
|
||||
# shellcheck disable=SC2086
|
||||
|
|
@ -187,16 +194,19 @@ function test_run_env_with_proot_args(){
|
|||
|
||||
function test_qemu() {
|
||||
echo "JUNEST_ARCH=arm" > "${JUNEST_HOME}"/etc/junest/info
|
||||
# shellcheck disable=SC2317
|
||||
rm_cmd() {
|
||||
# shellcheck disable=SC2086
|
||||
# shellcheck disable=SC2048
|
||||
echo $*
|
||||
}
|
||||
# shellcheck disable=SC2317
|
||||
ln_cmd() {
|
||||
# shellcheck disable=SC2086
|
||||
# shellcheck disable=SC2048
|
||||
echo $*
|
||||
}
|
||||
# shellcheck disable=SC2317
|
||||
_run_env_with_proot() {
|
||||
# shellcheck disable=SC2086
|
||||
# shellcheck disable=SC2048
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ function test_is_env_installed(){
|
|||
|
||||
function test_setup_env(){
|
||||
rm -rf "${JUNEST_HOME:?}"/*
|
||||
# shellcheck disable=SC2317
|
||||
wget_mock(){
|
||||
# Proof that the setup is happening
|
||||
# inside $JUNEST_TEMPDIR
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ function test_create_wrappers_verify_content(){
|
|||
assertEquals "" "$(cat "$STDOUTF")"
|
||||
|
||||
# Mock junest command to capture the actual output generated from myfile script
|
||||
# shellcheck disable=SC2317
|
||||
junest(){
|
||||
for arg in "$@"
|
||||
do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue