diff options
Diffstat (limited to 'coverage.sh.in')
-rwxr-xr-x | coverage.sh.in | 117 |
1 files changed, 90 insertions, 27 deletions
diff --git a/coverage.sh.in b/coverage.sh.in index b75ae5c..51d1106 100755 --- a/coverage.sh.in +++ b/coverage.sh.in @@ -35,10 +35,14 @@ log_file_contents() { fi while IFS= read -r line; do - msg=" ${line}" - printf "%b%s%s%b[0m\n" "\0033" ${color} "${msg}" "\0033" - sudo logger -t COVERAGE -i "@@@@@ " -p ${level} -- "${msg}" + printf "%b%s%s%b[0m\n" "\0033" ${color} " ${line}" "\0033" done < ${file} + + sudo file=${file} level=${level} bash <<'EOF' +while IFS= read -r line; do + logger -t COVERAGE -i "@@@@@ " -p ${level} -- " ${line}" +done < ${file} +EOF } systemctl-exists() { @@ -83,7 +87,7 @@ sd_start() { sudo systemctl reset-failed "${unit}" >/dev/null 2>&1 log "Start ${app}" - sudo systemd-run --unit="${unit}" --working-directory=. --property=Type=dbus --property=BusName="${dbus}" --property="SyslogIdentifier=${app}" --property="ExecReload=/bin/kill -HUP \$MAINPID" --setenv=PYTHONPATH=${PYTHON_PATH} --setenv=RUNTIME_DIRECTORY=${RUNTIME_DIRECTORY} coverage run --rcfile=.coveragerc ${cmd} >/tmp/output.txt 2>&1 + sudo systemd-run --unit="${unit}" --working-directory=. --property=Type=dbus --property=BusName="${dbus}" --property="SyslogIdentifier=${app}" --setenv=PYTHONPATH=${PYTHON_PATH} --setenv=RUNTIME_DIRECTORY=${RUNTIME_DIRECTORY} coverage run --rcfile=.coveragerc ${cmd} >/tmp/output.txt 2>&1 log_file_contents $? /tmp/output.txt printf "\n" sleep 1 @@ -108,10 +112,10 @@ sd_restart() { reload_cfg() { app="$1" unit="${app}"-cov.service - log "Reload config ${app}" - sudo systemctl reload "${unit}" && printf "systemctl reload %s\n" "${unit}" >/tmp/output.txt 2>&1 - #pid=$( systemctl show --property MainPID --value "${unit}" ) - #sudo kill -HUP "${pid}" >/tmp/output.txt 2>&1 + pid=$( systemctl show --property MainPID --value "${unit}" ) + log "Reload config ${app} - SIGHUP ${pid}" + #sudo systemctl reload "${unit}" && printf "systemctl reload %s\n" "${unit}" >/tmp/output.txt 2>&1 + sudo kill -HUP "${pid}" >/tmp/output.txt 2>&1 log_file_contents $? /tmp/output.txt printf "\n" sleep 1 @@ -125,9 +129,9 @@ run_unit_test() { else COVERAGE="coverage" fi - test=$@ + args=$@ log "Run unit test: ${input}" - PYTHONPATH=${PYTHON_PATH} ${COVERAGE} run --rcfile=.coveragerc ../test/${test} >/dev/null 2>&1 + PYTHONPATH=${PYTHON_PATH} ${COVERAGE} run --rcfile=.coveragerc "${args}" >/dev/null 2>&1 } run_cmd_coverage() { @@ -464,15 +468,39 @@ run_cmd_coverage stacctl ls log ">>>>>>>>>>>>>>>>>>>>> Marker [6] <<<<<<<<<<<<<<<<<<<<<" printf "\n" + #******************************************************************************* -# Stop Avahi Publisher -log "Stop Avahi publisher" +log "Restart Avahi publisher with invalid protocol" +run_cmd sudo systemctl stop ${AVAHI_PUBLISHER} +printf "\n" +sleep 1 +run_cmd sudo systemd-run --unit=${AVAHI_PUBLISHER} --working-directory=. avahi-publish -s SFSS _nvme-disc._tcp 8009 "p=walmart" +printf "\n" +sleep 2 + +#******************************************************************************* +log "Restart Avahi publisher with protocol set to RoCE" run_cmd sudo systemctl stop ${AVAHI_PUBLISHER} printf "\n" sleep 1 +run_cmd sudo systemd-run --unit=${AVAHI_PUBLISHER} --working-directory=. avahi-publish -s SFSS _nvme-disc._tcp 8009 "p=roce" +printf "\n" +sleep 2 #******************************************************************************* -log "Restart Avahi publisher" +log "Restart Avahi publisher without specifying protocol" +run_cmd sudo systemctl stop ${AVAHI_PUBLISHER} +printf "\n" +sleep 1 +run_cmd sudo systemd-run --unit=${AVAHI_PUBLISHER} --working-directory=. avahi-publish -s SFSS _nvme-disc._tcp 8009 +printf "\n" +sleep 2 + +#******************************************************************************* +log "Restart Avahi publisher with protocol set to TCP" +run_cmd sudo systemctl stop ${AVAHI_PUBLISHER} +printf "\n" +sleep 1 run_cmd sudo systemd-run --unit=${AVAHI_PUBLISHER} --working-directory=. avahi-publish -s SFSS _nvme-disc._tcp 8009 "p=tcp" printf "\n" sleep 2 @@ -515,6 +543,7 @@ reconnect-delay=1 ctrl-loss-tmo=0 disable-sqflow=true ip-family=ipv6 +pleo=disabled [Discovery controller connection management] persistent-connections=false @@ -613,6 +642,35 @@ mkdir -p "/tmp/stafd" sd_restart "stafd" sleep 2 + +log ">>>>>>>>>>>>>>>>>>>>> Marker [11] <<<<<<<<<<<<<<<<<<<<<" +printf "\n" + +log "Change stafd config [5]:" +cat > "${stafd_conf_fname}" <<'EOF' +[Global] +tron = true + +[Controllers] +controller=transport=tcp;traddr=localhost +controller=transport=tcp;traddr=1.1.1.1 +controller=transport=tcp;traddr=2.2.2.2 +controller=transport=tcp;traddr=3.3.3.3 +controller=transport=tcp;traddr=4.4.4.4 +controller=transport=tcp;traddr=5.5.5.5 +controller=transport=tcp;traddr=6.6.6.6 +EOF +log_file_contents 0 "${stafd_conf_fname}" +printf "\n" + +reload_cfg "stafd" +sleep 2 + +sd_stop "stafd" +sleep 5 +sd_start "stafd" + + #******************************************************************************* # Change ownership of files that were created as root sudo chown -R "${PRIMARY_USR}":"${PRIMARY_GRP}" coverage >/dev/null 2>&1 @@ -621,20 +679,25 @@ sudo chown -R "${PRIMARY_USR}":"${PRIMARY_GRP}" subprojects/libnvme/libnvme/__py #******************************************************************************* # Run unit tests -run_unit_test test-avahi.py -run_unit_test test-avahi.py -run_unit_test test-config.py -run_unit_test test-controller.py -run_unit_test test-gtimer.py -run_unit_test test-iputil.py -run_unit_test test-log.py -run_unit_test sudo test-nvme_options.py # Test both with super user... -run_unit_test test-nvme_options.py # ... and with regular user -run_unit_test test-service.py -run_unit_test test-timeparse.py -run_unit_test test-transport_id.py -run_unit_test test-udev.py -run_unit_test test-version.py +TEST_DIR=$( realpath ../test ) +run_unit_test ${TEST_DIR}/test-avahi.py +run_unit_test ${TEST_DIR}/test-avahi.py +run_unit_test ${TEST_DIR}/test-config.py +run_unit_test ${TEST_DIR}/test-controller.py +run_unit_test ${TEST_DIR}/test-gtimer.py +run_unit_test ${TEST_DIR}/test-iputil.py +run_unit_test ${TEST_DIR}/test-log.py +run_unit_test ${TEST_DIR}/test-nbft.py +run_unit_test ${TEST_DIR}/test-nbft_conf.py +run_unit_test sudo ${TEST_DIR}/test-nvme_options.py # Test both with super user... +run_unit_test ${TEST_DIR}/test-nvme_options.py # ... and with regular user +run_unit_test ${TEST_DIR}/test-service.py +run_unit_test ${TEST_DIR}/test-timeparse.py +run_unit_test ${TEST_DIR}/test-transport_id.py +run_unit_test ${TEST_DIR}/test-defs.py +run_unit_test ${TEST_DIR}/test-gutil.py +run_unit_test ${TEST_DIR}/test-udev.py +run_unit_test ${TEST_DIR}/test-version.py #******************************************************************************* # Stop nvme target simulator |