Skip to content

Commit

Permalink
[Makefile] Fix install-test working directory path for coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisCummins committed May 27, 2021
1 parent c2d511f commit f858b34
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ livedocs: gendocs doxygen
COMPILER_GYM_SITE_DATA ?= "/tmp/compiler_gym/tests/site_data"
COMPILER_GYM_CACHE ?= "/tmp/compiler_gym/tests/cache"

# A directory that is used as the working directory for running pytest tests
# by symlinking the tests directory into it.
INSTALL_TEST_ROOT ?= "/tmp/compiler_gym/install_tests"

# The target to use. If not provided, all tests will be run. For `make test` and
# related, this is a bazel target pattern, with default value '//...'. For `make
# install-test` and related, this is a relative file path of the directory or
Expand All @@ -243,21 +247,21 @@ itest:
# some hoops to run pytest "out of tree" by creating an empty directory and
# symlinking the test directory into it so that pytest can be invoked.
install-test-setup:
mkdir -p /tmp/compiler_gym/install_tests
rm -f /tmp/compiler_gym/install_tests/tests /tmp/compiler_gym/install_tests/tox.ini
ln -s $(ROOT)/tests /tmp/compiler_gym/install_tests
ln -s $(ROOT)/tox.ini /tmp/compiler_gym/install_tests
mkdir -p "$(INSTALL_TEST_ROOT)"
rm -f "$(INSTALL_TEST_ROOT)/tests" "$(INSTALL_TEST_ROOT)/tox.ini"
ln -s "$(ROOT)/tests" "$(INSTALL_TEST_ROOT)"
ln -s "$(ROOT)/tox.ini" "$(INSTALL_TEST_ROOT)"

define pytest
cd /tmp/compiler_gym/install_tests && pytest $(if $(TEST_TARGET),$(TEST_TARGET),tests) $(1) $(PYTEST_ARGS)
cd "$(INSTALL_TEST_ROOT)" && pytest $(if $(TEST_TARGET),$(TEST_TARGET),tests) $(1) $(PYTEST_ARGS)
endef

install-test: install-test-setup
$(call pytest,--benchmark-disable -n auto -k "not fuzz" --durations=5)

install-test-cov: install-test-setup
$(call pytest,--benchmark-disable -n auto -k "not fuzz" --durations=5 --cov=compiler_gym --cov-report=xml --cov-report=term)
@mv /tmp/compiler_gym/wheel_tests/coverage.xml .
@mv "$(INSTALL_TEST_ROOT)/coverage.xml" .

# The minimum number of seconds to run the fuzz tests in a loop for. Override
# this at the commandline, e.g. `FUZZ_SECONDS=1800 make fuzz`.
Expand Down

0 comments on commit f858b34

Please sign in to comment.