Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

Permalink
Hook up unit tests to test harness, remove MIR tests from pa4 xthScripts
Browse files Browse the repository at this point in the history
- `make test-unit` executes the unit tests now, also attached to
`make test` now.
- MIR tests were just giving errors because the MIR trees weren't
canonical and the xth interpreter was refusing to interpret them.
  • Loading branch information
anmolkabra committed Mar 14, 2019
1 parent 7c2e050 commit 12ef453
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 45 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ help:
build: ## Build xic
$(XIC_BUILD)

test: test-xth-build $(XTH_TEST_DIRS) ## Run xth quietly on all test directories
test: test-xth-build $(XTH_TEST_DIRS) test-unit ## Run unit tests and xth quietly on all test directories

test-xth-build: ## Run xth quietly on xic builder
$(eval SCRIPT:=$(addsuffix /xthScriptBuild, $(XTH_BUILD_TEST_DIR)))
Expand All @@ -40,6 +40,9 @@ test-custom: build ## Run xth on a specific directory given by TESTPATH and with
$(eval SCRIPT:=$(addsuffix /xthScript, $(TESTPATH)))
$(XTH_BIN) $(ARGS) -testpath $(TESTPATH) $(SCRIPT)

test-unit: ## Run unit tests in the project
./gradle_exec.sh --no-daemon test

zip: clean ## Zip Xi Compiler source files into xic.zip
# netid of a random group member added to the zip file name
zip -r xic-kc875.zip $(GRADLE_SETUP_FILES) Makefile lib src xic-build xic $(SUBMIT_TEST_DIRS) -x *.results*
Expand Down
11 changes: 11 additions & 0 deletions gradle_exec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# Executes the given arguments on the right version of gradle: either the gradle
# installed by the package manager, or the supplied wrapper

if which gradle > /dev/null; then
# gradle installed by package manager
gradle "$@"
else
# gradle not installed by package manager, try the gradle wrapper supplied
./gradlew "$@"
fi
2 changes: 1 addition & 1 deletion src/main/java/cli/CLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ private void IRRun() {
XiLexer lexer = new XiLexer(fileReader, xtf);
XiParser parser = new XiParser(lexer, xtf);
ASTNode root = (ASTNode) parser.parse().value;
root.accept(new VisitorTypeCheck(new HashMapSymbolTable<TypeSymTable>(), libpath.toString()));
root.accept(new VisitorTypeCheck(new HashMapSymbolTable<>(), libpath.toString()));
//IR translation and lowering
VisitorTranslation tv = new VisitorTranslation(
!optDisableOptimization,
Expand Down
24 changes: 0 additions & 24 deletions tests/pa4-tests/xthScript
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,6 @@
#
# xth runs the commands in order of appearance.

xic ("Test --mir --irgen") "-libpath $(testpath) --irgen" {
array_assign.xi;
array_concat.xi;
array_index.xi;
multidim_alloc.xi;
multidim_literal.xi;
propagate_dbz.xi;
simple_inc_print.xi;
simulator_ex.xi;
sortstring.xi;
}

xic ("Test --mir --irgen -O") "-libpath $(testpath) --irgen -O" {
array_assign.xi;
array_concat.xi;
array_index.xi;
multidim_alloc.xi;
multidim_literal.xi;
propagate_dbz.xi;
simple_inc_print.xi;
simulator_ex.xi;
sortstring.xi;
}

xic ("Test --irgen") "-libpath $(testpath) --irgen" {
array_assign.xi;
array_concat.xi;
Expand Down
8 changes: 1 addition & 7 deletions xic-build
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@ java -jar lib/jflex-full-1.7.0.jar src/main/java/lexer/xilexer.flex -d src/main/
./lib/cup -parser "IxiParser" -destdir ./src/main/java/xi_parser -locations ./src/main/java/xi_parser/ixi.cup

# Create the compiler using gradle, create xic binary
if which gradle > /dev/null; then
# gradle installed by package manager
gradle --no-daemon customFatJar
else
# gradle not installed by package manager, try the gradle wrapper supplied
./gradlew --no-daemon customFatJar
fi
./gradle_exec.sh --no-daemon customFatJar
cat make_jar_executable.sh build/libs/all-in-one-jar-1.0-SNAPSHOT.jar > xic && chmod +x xic

# Link the xic binary in ~/bin
Expand Down
12 changes: 0 additions & 12 deletions xth/tests/pa4/xthScript
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@
#
# xth runs the commands in order of appearance.

xic ("Test --mir --irgen") "-libpath $(testpath) --irgen" {
ex01.xi;
ack.xi;
primes.xi;
}

xic ("Test --mir --irgen -O") "-libpath $(testpath) --irgen -O" {
ex01.xi;
ack.xi;
primes.xi;
}

xic ("Test --irgen") "-libpath $(testpath) --irgen" {
ex01.xi;
ack.xi;
Expand Down

0 comments on commit 12ef453

Please sign in to comment.