make
This commit is contained in:
36
Makefile
36
Makefile
@ -12,11 +12,6 @@ YACC := src/grammar.y
|
|||||||
EXE := alpha
|
EXE := alpha
|
||||||
|
|
||||||
OBJS := tmp/runner.o tmp/symbol_table.o tmp/grammar.tab.o tmp/lex.yy.o tmp/intermediate_code.o tmp/codegen.o
|
OBJS := tmp/runner.o tmp/symbol_table.o tmp/grammar.tab.o tmp/lex.yy.o tmp/intermediate_code.o tmp/codegen.o
|
||||||
|
|
||||||
TESTS-S1 := $(wildcard tests/sprint1/test/*.alpha)
|
|
||||||
TESTS-S2 := $(wildcard tests/sprint2/test/*.alpha)
|
|
||||||
TESTS-S3 := $(wildcard tests/sprint3/test/*.alpha)
|
|
||||||
TESTS-S4 := $(wildcard tests/sprint4/test/*.alpha)
|
|
||||||
# ----------
|
# ----------
|
||||||
|
|
||||||
|
|
||||||
@ -71,35 +66,30 @@ tmp/runner.o: src/runner.c src/runner.h tmp/flex.h tmp/grammar.tab.h
|
|||||||
|
|
||||||
# ----- Tests -----
|
# ----- Tests -----
|
||||||
test:
|
test:
|
||||||
chmod +x ./check.sh
|
|
||||||
chmod +x ./test.sh
|
chmod +x ./test.sh
|
||||||
$(foreach test, $(TESTS-S1), (./$(EXE) -tok -debug $(test) || true);)
|
./test.sh tests/sprint1/test/ -diff
|
||||||
./test.sh sp2
|
./test.sh tests/sprint2/test/ -diff
|
||||||
./test.sh sp3
|
./test.sh tests/sprint3/test/ -diff
|
||||||
./test.sh sp4
|
./test.sh tests/sprint4/test/ -diff
|
||||||
./check.sh
|
./test.sh tests/given/test/ -diff
|
||||||
|
|
||||||
test-s1:
|
test-s1:
|
||||||
chmod +x ./check.sh
|
|
||||||
chmod +x ./test.sh
|
chmod +x ./test.sh
|
||||||
$(foreach test, $(TESTS-S1), (./$(EXE) -tok -debug $(test) || true);)
|
./test.sh tests/sprint1/test/ -diff
|
||||||
./check.sh sp1
|
|
||||||
|
|
||||||
test-s2:
|
test-s2:
|
||||||
chmod +x ./check.sh
|
|
||||||
chmod +x ./test.sh
|
chmod +x ./test.sh
|
||||||
./test.sh sp2
|
./test.sh tests/sprint2/test/ -diff
|
||||||
./check.sh sp2
|
|
||||||
|
|
||||||
test-s3:
|
test-s3:
|
||||||
chmod +x ./check.sh
|
|
||||||
chmod +x ./test.sh
|
chmod +x ./test.sh
|
||||||
./test.sh sp3
|
./test.sh tests/sprint3/test/ -diff
|
||||||
./check.sh sp3
|
|
||||||
|
|
||||||
test-s4:
|
test-s4:
|
||||||
chmod +x ./check.sh
|
|
||||||
chmod +x ./test.sh
|
chmod +x ./test.sh
|
||||||
./test.sh sp4
|
./test.sh tests/sprint4/test/ -diff
|
||||||
./check.sh sp4
|
|
||||||
|
test-given:
|
||||||
|
chmod +x ./test.sh
|
||||||
|
./test.sh tests/given/test/ -diff
|
||||||
# -----------
|
# -----------
|
24
test.sh
24
test.sh
@ -33,8 +33,26 @@ if [ $# -eq 0 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
echo -e "${GREEN}[HELP] ${YELLOW}Usage: ./test.sh <file> [-exp] ${WHITE}"
|
echo -e "${WHITE}-----{ ${BLUE}Test.sh Help ${WHITE}}-----\n"
|
||||||
echo -e "${GREEN}[HELP] ${YELLOW}To all tests in a folder: ./test/sh <dir>/ [-exp]${WHITE}"
|
echo -e "${YELLOW} Arguments: ${WHITE}"
|
||||||
|
echo -e "${GREEN} -exp ${WHITE} Generate expected output files"
|
||||||
|
echo -e "${GREEN} -diff ${WHITE} Compare output files with expected output files"
|
||||||
|
echo -e "${GREEN} -help ${WHITE} Show this help message\n"
|
||||||
|
echo -e "${YELLOW} Usage: ${WHITE}"
|
||||||
|
echo -e "${GREEN} ./test.sh <file.alpha> [flags] ${WHITE} Run the test on a single file"
|
||||||
|
echo -e "${GREEN} ./test.sh <directory> [flags] ${WHITE} Run the test on all files in a directory\n"
|
||||||
|
echo -e "${YELLOW} Examples: ${WHITE}"
|
||||||
|
echo -e "${GREEN} ./test.sh test.alpha ${WHITE} Runs test flags in header on test.alpha"
|
||||||
|
echo -e "${GREEN} ./test.sh test/ ${WHITE} Runs test flags in header on all .alpha files in test/"
|
||||||
|
echo -e "${GREEN} ./test.sh test/ -exp ${WHITE} Runs test flags in header on all .alpha files in test/ and generates expected output files"
|
||||||
|
echo -e "${GREEN} ./test.sh test/ -diff ${WHITE} Runs test flags in header on all .alpha files in test/ and compares output files with expected output files"
|
||||||
|
echo -e "${GREEN} ./test.sh test/ -exp -diff ${WHITE} Runs test flags in header on all .alpha files in test/ and generates expected output files and compares output files with expected output files\n"
|
||||||
|
echo -e "${YELLOW} Notes: ${WHITE}"
|
||||||
|
echo -e "${ORANGE} To create a test file, on the first line of the .alpha file, add:"
|
||||||
|
echo -e "${LIGHTBLUE} (* TEST: [ <test_flags> ] *)"
|
||||||
|
echo -e "${ORANGE} where <test_flags> are the alpha flags to be used. Ex:"
|
||||||
|
echo -e "${LIGHTBLUE} (* TEST: [ -debug -asc -tc ] *)\n"
|
||||||
|
echo -e "${WHITE}-----------------------------------------\n"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,4 +154,6 @@ if [ -f "$1" ]; then
|
|||||||
echo -e "${RED}[ERROR] ${YELLOW}File $1 is not a .alpha file!${WHITE}"
|
echo -e "${RED}[ERROR] ${YELLOW}File $1 is not a .alpha file!${WHITE}"
|
||||||
help
|
help
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
help
|
||||||
fi
|
fi
|
||||||
|
@ -9,4 +9,3 @@
|
|||||||
movl %eax, -20(%rbp) #subtraction end
|
movl %eax, -20(%rbp) #subtraction end
|
||||||
movl -20(%rbp), %eax #assign start
|
movl -20(%rbp), %eax #assign start
|
||||||
movl %eax, -8(%rbp) #assign end
|
movl %eax, -8(%rbp) #assign end
|
||||||
s
|
|
Reference in New Issue
Block a user