From 854a784be5ca10db1329186b1278a2ad85fd3b2f Mon Sep 17 00:00:00 2001 From: Mobin Date: Sun, 16 Jul 2023 23:02:39 +0330 Subject: [PATCH 1/3] igr_functions: Some minor fixes Signed-off-by: Mobin "Hojjat" Aydinfar --- src/igr-tests/igr_functions.sh | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/igr-tests/igr_functions.sh b/src/igr-tests/igr_functions.sh index 68642121..3f147b11 100644 --- a/src/igr-tests/igr_functions.sh +++ b/src/igr-tests/igr_functions.sh @@ -1,6 +1,6 @@ -# Included from run-test.sh files. Do not run independently. +# Included from run-test.sh files. DO NOT run independently. -### This file contain basic variables for running Integration tests of +### This file contain basic variables & functions for running Integration tests of ### Dinit. # Input variables: @@ -33,7 +33,7 @@ error() { >&2 echo " ... $2" fi if [ -n "${STAGE:-}" ]; then - echo "${TEST_NAME:-}: Failed at stage $STAGE." + >&2 echo "${TEST_NAME:-}: Failed at stage $STAGE." fi if [ -e "${SOCKET:-}" ]; then stop_dinit # A dinit instance is running, stopping... @@ -57,31 +57,26 @@ find_executable() { varname=$2 if [ -z "$(eval "echo \${${varname}:-}")" ]; then if [ -x "$DINIT_BINDIR/$exename" ]; then - export $varname="$DINIT_BINDIR/$exename" + export "$varname"="$DINIT_BINDIR/$exename" else return 1 fi fi } - find_dinit() { find_executable dinit DINIT; } find_dinitctl() { find_executable dinitctl DINITCTL; } find_dinitcheck() { find_executable dinitcheck DINITCHECK; } find_dinitmonitor() { find_executable dinit-monitor DINITMONITOR; } - -## Change directory to run-test.sh location -cd "$(dirname "$0")" || error "Can't change directory to script location." - ## Prepare $IGR_OUTPUT TEST_NAME="${PWD##*/}" -if [ -z "$TEST_NAME" ]; then error "Failed to guess test name."; fi +[ -n "$TEST_NAME" ] || error "Failed to guess test name." if [ -z "${IGR_OUTPUT:-}" ]; then IGR_OUTPUT="$PWD" - if [ -z "$IGR_OUTPUT" ]; then error "Failed to guess igr output files location."; fi + [ -n "$IGR_OUTPUT" ] || error "Failed to guess igr output files location." export IGR_OUTPUT else - # Igr tests are used by meson. + # Igr test is probably used by Meson. mkdir -p "$IGR_OUTPUT/$TEST_NAME/" IGR_OUTPUT="$IGR_OUTPUT/$TEST_NAME/" export IGR_OUTPUT @@ -132,7 +127,7 @@ stop_dinit() { return 0 else warning "Cannot stopping dinit via dinitctl." "Fallback to killing DINITPID." - kill "$DINITPID" || ( echo "${TEST_NAME:-}: Cannot stop Dinit instance!" && exit 1 ) + kill "$DINITPID" || ( echo "${TEST_NAME:-}: Cannot stop Dinit instance!" && exit 1 ) >&2 wait "$DINITPID" fi } @@ -209,7 +204,7 @@ compare_file() { # throw an error on any other failure. compare_cmd() { if [ ! -e "$2" ]; then - error "$2 file isn't exist!" + error "$2 file doesn't exist!" fi if [ "${3:-}" = "err" ]; then CMD_OUT="$($1 2>&1 || true)" From e01433eb3fd0c373903fbabea7c8cea527a975c0 Mon Sep 17 00:00:00 2001 From: Mobin Date: Sun, 16 Jul 2023 23:06:41 +0330 Subject: [PATCH 2/3] gitignore: Remove obsolete igr-tests temp files items Signed-off-by: Mobin "Hojjat" Aydinfar --- .gitignore | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.gitignore b/.gitignore index 8f2fb204..8c601627 100644 --- a/.gitignore +++ b/.gitignore @@ -21,20 +21,8 @@ # Integration test output: /src/igr-tests/*/output/** -/src/igr-tests/basic/basic-ran -/src/igr-tests/environ/env-record -/src/igr-tests/environ2/env-record -/src/igr-tests/ps-environ/env-record -/src/igr-tests/chain-to/recorded-output -/src/igr-tests/restart/basic-ran -/src/igr-tests/check-basic/output.txt -/src/igr-tests/check-cycle/output.txt -/src/igr-tests/check-cycle2/output.txt -/src/igr-tests/check-lint/output.txt /src/igr-tests/reload1/sd /src/igr-tests/reload2/sd -/src/igr-tests/no-command-error/dinit-run.log -/src/igr-tests/var-subst/args-record # Generated man pages: /doc/manpages/*.5 From 216ba8f62e8109d319ec6d19fe89e842575d4794 Mon Sep 17 00:00:00 2001 From: Mobin Date: Sun, 16 Jul 2023 23:13:15 +0330 Subject: [PATCH 3/3] igr-tests: Don't send test logs into system syslog Signed-off-by: Mobin "Hojjat" Aydinfar --- src/igr-tests/igr_functions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/igr-tests/igr_functions.sh b/src/igr-tests/igr_functions.sh index 3f147b11..3615ef28 100644 --- a/src/igr-tests/igr_functions.sh +++ b/src/igr-tests/igr_functions.sh @@ -96,7 +96,7 @@ fi # throw an error on failure. spawn_dinit() { find_dinit || error "Cannot find dinit exec path." "Specify 'DINIT_BINDIR' and/or ensure dinit is compiled." - "$DINIT" $QUIET -u -d sd -p "$SOCKET" "$@" & + "$DINIT" $QUIET -u -d sd -p "$SOCKET" -l /dev/null "$@" & DINITPID=$! # Wait for Dinit socket shows up. TIMEOUT=0 @@ -138,7 +138,7 @@ stop_dinit() { # throw an error on failure. spawn_dinit_oneshot() { find_dinit || error "Cannot find dinit exec path." "Specify 'DINIT_BINDIR' and/or ensure dinit is compiled." - "$DINIT" $QUIET -u -d sd -p "$SOCKET" "$@" + "$DINIT" $QUIET -u -d sd -p "$SOCKET" -l /dev/null "$@" } # This function find dinitctl and allow access to dinit daemon via dinitctl.