forked from zproksi/bpatch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathin_tests.cmd
74 lines (60 loc) · 1.75 KB
/
in_tests.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
@echo off
setlocal enabledelayedexpansion
goto :begining
REM Function to print a visual divider
:divisor
echo ========
goto :eof
:begining
REM Get the directory of the script
rem set "ScriptPath=%~f0"
set "ScriptPath=%~dp0"
REM Ensure a parameter has been provided
if "%~1"=="" (
echo To run script provide to script 'bpatch' executable name as parameter
echo "%~f0 path_to\bpatch.exe"
exit /b 1
) else (
echo "This script is located at: %ScriptPath%"
echo "current folder is %cd%"
echo "Files will be written here"
call :divisor
)
REM Set up directories
set "Folder_FA=%ScriptPath%scripts"
set "Folder_FB=%ScriptPath%binaries"
set "Folder_Source=%ScriptPath%sources"
set "Folder_Expected=%ScriptPath%expected"
rem echo "FA is here %Folder_FA%"
rem echo "FB is here %Folder_FB%"
rem echo "sources is here %Folder_Source%"
rem echo "Expected is %Folder_Expected%"
set "ReturnValue=0"
REM Iterate over .test files in source directory
for %%F in ("%Folder_Source%\*.test") do (
set "Src=%%~nxF"
set "nameonly=%%~nF"
set "Act=!nameonly!.json"
set "Dest=%ScriptPath%!nameonly!.res"
set "Command=%~1 -s %Folder_Source%\!Src! -a !Act! -w !Dest! -fa %Folder_FA% -fb %Folder_FB%"
echo To execute: '!Command!'
call :divisor
REM start one test
call !Command!
REM Compare the output to the expected result
fc /b %Folder_Expected%\!nameonly!.expected !Dest! >nul
if errorlevel 1 (
echo ERROR for !Src!
set "ReturnValue=1"
) else (
echo OK for !Src!
del !Dest!
)
call :divisor
)
if not !ReturnValue! equ 0 (
echo ERROR detected
) else (
echo OK for every test
)
exit /b !ReturnValue!