From 39b06f1073a37f5da0c8a31c74a4d82c1ba8a441 Mon Sep 17 00:00:00 2001 From: Richard T Bonhomme Date: Tue, 22 Mar 2022 15:52:04 +0000 Subject: [PATCH] Unit test improvements * Allow local copy of unit tests to persist. * Quote file-name exapansion for Windows setup. Signed-off-by: Richard T Bonhomme --- op_test.sh | 22 ++++++++++++++++------ wop_test.bat | 21 ++++++++++----------- 2 files changed, 26 insertions(+), 17 deletions(-) mode change 100755 => 100644 op_test.sh diff --git a/op_test.sh b/op_test.sh old mode 100755 new mode 100644 index f9d6be9..80f210d --- a/op_test.sh +++ b/op_test.sh @@ -4,14 +4,24 @@ # and executes that - allows for disconnected testing from the easy-rsa # repo with TravisCI. -curl -O 'https://raw.githubusercontent.com/OpenVPN/easyrsa-unit-tests/master/easyrsa-unit-tests.sh' +case "$1" in +-v) verb='-v' ;; +-vv) verb='-vv' ;; +*) verb='-v' +esac -if [ -e "easyrsa-unit-tests.sh" ]; -then - sh easyrsa-unit-tests.sh -v +estat=0 + +if [ -e "easyrsa-unit-tests.sh" ]; then + sh easyrsa-unit-tests.sh "$verb" estat=$? +else + curl -O 'https://raw.githubusercontent.com/OpenVPN/easyrsa-unit-tests/master/easyrsa-unit-tests.sh' + [ -e "easyrsa-unit-tests.sh" ] || { echo "Unit-test download failed."; exit 9; } + sh easyrsa-unit-tests.sh "$verb" + estat=$? + rm -f easyrsa-unit-tests.sh fi -rm -f easyrsa-unit-tests.sh - +echo "estat: $estat" exit $estat diff --git a/wop_test.bat b/wop_test.bat index 507c3d2..2869a5c 100644 --- a/wop_test.bat +++ b/wop_test.bat @@ -12,24 +12,23 @@ IF %SYS_ARCH%==test ( exit /B 1 ) set WORK_DIR=%cd% -mkdir %WORK_DIR%\easyrsa3\bin -copy %WORK_DIR%\distro\windows\bin\* %WORK_DIR%\easyrsa3\bin -copy %WORK_DIR%\distro\windows\%SYS_ARCH%\* %WORK_DIR%\easyrsa3\bin -copy %WORK_DIR%\distro\windows\EasyRSA-Start.bat %WORK_DIR%\easyrsa3\EasyRSA-Start.bat +mkdir "%WORK_DIR%\easyrsa3\bin" +copy "%WORK_DIR%\distro\windows\bin\*" "%WORK_DIR%\easyrsa3\bin" +copy "%WORK_DIR%\distro\windows\%SYS_ARCH%\*" "%WORK_DIR%\easyrsa3\bin" +copy "%WORK_DIR%\distro\windows\EasyRSA-Start.bat" "%WORK_DIR%\easyrsa3\EasyRSA-Start.bat" PATH=%PATH%;%WORK_DIR%\easyrsa3\bin;C:\PROGRA~1\openssl cmd /C "easyrsa3\bin\sh.exe wop_test.sh" IF ERRORLEVEL 0 ( IF %SAVE_LAYOUT% EQU 0 ( - echo rmdir /S /Q %WORK_DIR%\easyrsa3\bin - rmdir /S /Q %WORK_DIR%\easyrsa3\bin - echo del /Q %WORK_DIR%\easyrsa3\EasyRSA-Start.bat - del /Q %WORK_DIR%\easyrsa3\EasyRSA-Start.bat - echo rm %WORK_DIR%\easyrsa3\.rnd - rm %WORK_DIR%\easyrsa3\.rnd + echo rmdir /S /Q "%WORK_DIR%\easyrsa3\bin" + rmdir /S /Q "%WORK_DIR%\easyrsa3\bin" + echo del /Q "%WORK_DIR%\easyrsa3\EasyRSA-Start.bat" + del /Q "%WORK_DIR%\easyrsa3\EasyRSA-Start.bat" + echo rm "%WORK_DIR%\easyrsa3\.rnd" + rm "%WORK_DIR%\easyrsa3\.rnd" ) ELSE echo NOTICE; Saved Layout ) ELSE echo Error occurred, no clean up set SAVE_LAYOUT= set SYS_ARCH= -pause