Skip to content

Commit e7086f3

Browse files
committed
Add tests for the Chaos compiler and don't call requirements-dev for Chaos
1 parent c2765a6 commit e7086f3

File tree

7 files changed

+44
-6
lines changed

7 files changed

+44
-6
lines changed

.github/workflows/memcheck.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
- name: Run the memory leak checks (gcc)
2525
run: |
2626
make memcheck
27+
make memcheck-compiler
2728
2829
- name: Build (clang)
2930
run: |
@@ -33,3 +34,4 @@ jobs:
3334
- name: Run the memory leak checks (clang)
3435
run: |
3536
make memcheck
37+
make memcheck-compiler

.github/workflows/tests.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ jobs:
7878
- name: Run the tests (gcc)
7979
run: |
8080
make test
81+
make test-compiler
8182
8283
- name: Build (clang)
8384
run: |
@@ -87,6 +88,7 @@ jobs:
8788
- name: Run the tests (clang)
8889
run: |
8990
make test
91+
make test-compiler
9092
9193
macos:
9294
name: macos
@@ -99,27 +101,30 @@ jobs:
99101
run: |
100102
mv /usr/local/bin/gcc-8 /usr/local/bin/gcc
101103
make requirements
102-
brew install gnu-sed
103104
104105
- name: Build (gcc)
105106
run: |
106107
source ~/.bash_profile
107108
cd .chaos/ && make && make install && cd ..
109+
source ~/.bash_profile
108110
make
109111
110112
- name: Run the tests (gcc)
111113
run: |
112114
make test
115+
make test-compiler
113116
114117
- name: Build (clang)
115118
run: |
116119
source ~/.bash_profile
117120
cd .chaos/ && make clang && make install && cd ..
121+
source ~/.bash_profile
118122
make clang
119123
120124
- name: Run the tests (clang)
121125
run: |
122126
make test
127+
make test-compiler
123128
124129
windows:
125130
name: windows
@@ -143,6 +148,7 @@ jobs:
143148
shell: cmd
144149
run: |
145150
call make.bat test
151+
call make.bat test-compiler
146152
147153
- name: Build (clang)
148154
shell: cmd
@@ -156,3 +162,4 @@ jobs:
156162
run: |
157163
call RefreshEnv.cmd
158164
call make.bat test
165+
call make.bat test-compiler

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ spells/
1818

1919
# Chaos project directory
2020
.chaos/
21+
22+
# Chaos build directory
23+
build

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,18 @@ spell:
3535
test: spell
3636
./test.sh
3737

38+
test-compiler: spell
39+
./test.sh compile
40+
3841
memcheck: spell
3942
valgrind --tool=memcheck --leak-check=full --show-reachable=yes --num-callers=20 --track-fds=yes --track-origins=yes --error-exitcode=1 chaos test.kaos || exit 1
4043

44+
memcheck-compiler: spell
45+
valgrind --tool=memcheck --leak-check=full --show-reachable=yes --num-callers=20 --track-fds=yes --track-origins=yes --error-exitcode=1 chaos -c test.kaos || exit 1
46+
valgrind --tool=memcheck --leak-check=full --show-reachable=yes --num-callers=20 --track-fds=yes --track-origins=yes --error-exitcode=1 build/main || exit 1
47+
4148
requirements:
4249
git clone https://github.com/chaos-lang/chaos.git .chaos/ && \
4350
cd .chaos/ && \
4451
make requirements && \
45-
make requirements-dev && \
4652
rm -rf .chaos/

make.bat

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ IF [%1]==[clang] (
1616
EXIT /B 1
1717
)
1818
EXIT /B 0
19+
) ELSE IF [%1]==[test-compiler] (
20+
IF not exist spells\%spell_name% mkdir spells\%spell_name%
21+
COPY %spell_name%.dll spells\%spell_name%
22+
23+
CALL test.bat compile
24+
IF errorlevel 1 (
25+
EXIT /B 1
26+
)
27+
EXIT /B 0
1928
) ELSE IF [%1]==[requirements] (
2029
git clone https://github.com/chaos-lang/chaos.git .chaos/
2130
CD .chaos\

test.bat

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
@ECHO OFF
22
setlocal EnableDelayedExpansion
33

4-
chaos test.kaos > tmpFile
4+
IF "%~1"=="compile" (
5+
chaos -c test.kaos
6+
build\main > tmpFile
7+
) ELSE (
8+
chaos test.kaos > tmpFile
9+
)
10+
511
FC test.out tmpFile
612
IF errorlevel 1 (
713
DEL tmpFile

test.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
#!/bin/bash
22

33
out=$(<"test.out")
4-
test=$(chaos test.kaos)
5-
if [ "$test" == "$out" ]
6-
then
4+
if [ "$#" -gt 0 ] && [ $1 == "compile" ]; then
5+
chaos -c test.kaos && \
6+
test=$(build/main)
7+
else
8+
test=$(chaos test.kaos)
9+
fi
10+
11+
if [ "$test" == "$out" ]; then
712
echo "OK"
813
else
914
echo "$test"

0 commit comments

Comments
 (0)