forked from decaf-lang/decaf
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.bat
78 lines (76 loc) · 2.55 KB
/
test.bat
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
75
76
77
78
@echo off
set stage=PA3
if "%2"=="" (
if "%1"=="compile" (
call gradlew build
echo gradlew build done
goto :end
) else if "%1"=="test" (
call gradlew build
echo gradlew build done
java -jar -ea --enable-preview build/libs/decaf.jar -t %stage% --log-color TestCases\test.decaf --log-level all
rm test.tac
goto :end
) else if "%1"=="tac" (
call gradlew build
echo gradlew build done
java -jar -ea --enable-preview build/libs/decaf.jar -t %stage% --log-color TestCases\test.decaf --log-level all
goto :end
) else if "%1"=="output" (
java -jar -ea --enable-preview build/libs/decaf.jar -t %stage% --log-color TestCases\test.decaf > TestCases\test.output
rm test.tac
goto :end
) else if "%1"=="clean" (
rm -r build
goto :end
) else (
:show_help
echo Usage:
echo Compile: test compile
echo Compile and run: test {stage} {testcase}
echo Compile and run custom test: test test
echo Output custom test result to test.output: test output
echo Compile and run custom test and keep TAC: test tac
echo Run: test {stage} {testcase} run
echo Generate testcase: test {stage} {testcase} gen
echo Compile and run but do not diff: test {stage} {testcase} nodiff
echo Compile and run and output TAC but do not diff: test {stage} {testcase} tac
echo Delete build/ , compile and run: test {stage} {testcase} full
echo Delete build/: test clean
echo {stage}: [S1, S1-LL, S2, S3]
goto :end
)
)
if "%3" == "" (
call gradlew build
echo gradlew build done
) else if "%3" == "run" (
rem a
) else if "%3" == "gen" (
rem a
) else if "%3" == "full" (
rm -r build
call gradlew build
echo gradlew build done
) else if "%3" == "nodiff" (
call gradlew build
echo gradlew build done
) else if "%3" == "tac" (
call gradlew build
echo gradlew build done
) else (
goto :show_help
)
java -jar -ea --enable-preview build/libs/decaf.jar -t %stage% --log-color TestCases\%1\%2.decaf --log-level all
if "%3" neq "nodiff" if "%3" neq "tac" (
java -jar -ea --enable-preview build/libs/decaf.jar -t %stage% --log-color TestCases\%1\%2.decaf > TestCases\%1\output\%2.output
)
if "%3" == "gen" (
copy TestCases\%1\output\%2.output TestCases\%1\result\%2.result
) else if "%3" neq "nodiff" if "%3" neq "tac" (
fc TestCases\%1\output\%2.output TestCases\%1\result\%2.result
)
if "%3" neq "tac" (
rm %2.tac
)
:end