Unit test improvements

* Allow local copy of unit tests to persist.
* Quote file-name exapansion for Windows setup.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
Richard T Bonhomme 2022-03-22 15:52:04 +00:00
parent 8284dec85b
commit 39b06f1073
No known key found for this signature in database
GPG Key ID: 2D767DB92FB6C246
2 changed files with 26 additions and 17 deletions

22
op_test.sh Executable file → Normal file
View File

@ -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

View File

@ -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