-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.bat
144 lines (118 loc) · 3.95 KB
/
script.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
@echo off
set "CurDir="
for %%a in ("%cd%") do set "CurDir=%%~nxa"
if NOT "%CurDir%" == "assignment1" exit
if exist %CD%\src\test\testcases\ (
echo "Cleaning testcases"
rmdir /Q /S %CD%\src\test\testcases\
)
echo "Creating testcases"
mkdir %CD%\src\test\testcases\
if exist %CD%\src\test\solutions\ (
echo "Cleaning solutions"
rmdir /Q /S %CD%\src\test\solutions\
)
echo "Creating solutions"
mkdir %CD%\src\test\solutions\
if exist %CD%\src\test\solutionsSample (
echo "Cleaning solutions"
rmdir /Q /S %CD%\src\test\solutionsSample
)
if exist %CD%\output\ (
echo "Cleaning Output..."
rmdir /Q /S %CD%\output\
)
echo "Creating Output..."
mkdir %CD%\output\
mkdir %CD%\output\test
if exist %CD%\test\solutions\ (
echo "Copying solution sample"
mkdir %CD%\src\test\solutionsSample
robocopy %CD%\test\solutions %CD%\src\test\solutionsSample /move /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist %CD%\test\check.py (
echo "Copying check.py"
robocopy %CD%\test\ %CD%\src\ check.py /move /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist %CD%\test\LexerSuite.py (
echo "Rename old LexerSuite.py to LexerSuite_old.py"
ren %CD%\src\test\LexerSuite.py LexerSuite_old.py
echo "Copying LexerSuite.py"
robocopy %CD%\test\ %CD%\src\test\ LexerSuite.py /move /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist %CD%\test\ParserSuite.py (
echo "Rename old ParserSuite.py to ParserSuite_old.py"
ren %CD%\src\test\ParserSuite.py ParserSuite_old.py
echo "Copying ParserSuite.py"
robocopy %CD%\test\ %CD%\src\test\ ParserSuite.py /move /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist %CD%\test\TestUtils.py (
echo "Rename old TestUtils.py to TestUtils_old.py"
ren %CD%\src\test\TestUtils.py TestUtils_old.py
echo "Copying TestUtils.py"
robocopy %CD%\test\ %CD%\src\test\ TestUtils.py /move /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist %CD%\src\test\testLexer.py (
del %CD%\src\test\testLexer.py /f /q
)
if exist %CD%\src\test\testParser.py (
del %CD%\src\test\testParser.py /f /q
)
cd src
echo "Cleaning and Generatting..."
python run.py clean
python run.py gen
echo.
echo "=============================================="
echo "Testing Lexer..."
python run.py test LexerSuite
cd ..
if exist %CD%\src\test\LexerSuite.txt (
robocopy %CD%\src\test\ %CD%\output\ LexerSuite.txt /move /NFL /NDL /NJH /NJS /nc /ns /np
del %CD%\src\test\ParserSuite.txt /f /q
)
cd src
echo.
echo "=============================================="
echo "Testing Parser..."
python run.py test ParserSuite
cd ..
if exist %CD%\src\test\ParserSuite.txt (
robocopy %CD%\src\test\ %CD%\output\ ParserSuite.txt /move /NFL /NDL /NJH /NJS /nc /ns /np
del %CD%\src\test\LexerSuite.txt /f /q
)
cd src
if exist %CD%\test\solutionsSample\ (
if exist %CD%\check.py (
echo.
echo "=============================================="
echo "Checking solution..."
echo.
python check.py
)
)
cd ..
@echo off
if exist %CD%\src\check.txt (
robocopy %CD%\src\ %CD%\output\ check.txt /move /NFL /NDL /NJH /NJS /nc /ns /np
start %CD%\output\check.txt
)
if exist %CD%\src\test\LexerSuite_old.py (
robocopy %CD%\src\test\ %CD%\output\test\ LexerSuite.py /move /NFL /NDL /NJH /NJS /nc /ns /np
ren %CD%\src\test\LexerSuite_old.py LexerSuite.py
)
if exist %CD%\src\test\ParserSuite_old.py (
robocopy %CD%\src\test\ %CD%\output\test\ ParserSuite.py /move /NFL /NDL /NJH /NJS /nc /ns /np
ren %CD%\src\test\ParserSuite_old.py ParserSuite.py
)
if exist %CD%\src\test\TestUtils_old.py (
robocopy %CD%\src\test\ %CD%\output\test\ TestUtils.py /move /NFL /NDL /NJH /NJS /nc /ns /np
ren %CD%\src\test\TestUtils_old.py TestUtils.py
)
if exist %CD%\src\check.py (
robocopy %CD%\src\ %CD%\output\test\ check.py /move /NFL /NDL /NJH /NJS /nc /ns /np
)
if exist %CD%\src\test\solutionsSample\ (
robocopy %CD%\src\test\solutionsSample\ %CD%\output\test\solutions /move /NFL /NDL /NJH /NJS /nc /ns /np
)
::pause >nul