From 55aa12d7bd5bb4a9d8324b4f26fd3c9d3df8b173 Mon Sep 17 00:00:00 2001 From: protolambda Date: Sat, 20 Apr 2019 12:23:10 +1000 Subject: [PATCH] parallelism support for make gen_yaml_tests --- Makefile | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index b39538791..0a3e03e33 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ clean: rm -rf $(PY_SPEC_ALL_TARGETS) # "make gen_yaml_tests" to run generators -gen_yaml_tests: $(YAML_TEST_DIR) $(YAML_TEST_TARGETS) +gen_yaml_tests: $(YAML_TEST_TARGETS) # runs a limited set of tests against a minimal config test: $(PY_SPEC_ALL_TARGETS) @@ -48,24 +48,30 @@ CURRENT_DIR = ${CURDIR} # The function that builds a set of suite files, by calling a generator for the given type (param 1) define build_yaml_tests - $(info running generator $(1)) - # Create the output - mkdir -p $(YAML_TEST_DIR)$(1) - - # 1) Create a virtual environment - # 2) Activate the venv, this is where dependencies are installed for the generator - # 3) Install all the necessary requirements - # 4) Run the generator. The generator is assumed to have an "main.py" file. - # 5) We output to the tests dir (generator program should accept a "-o " argument. - cd $(GENERATOR_DIR)$(1); python3 -m venv venv; . venv/bin/activate; pip3 install -r requirements.txt; python3 main.py -o $(CURRENT_DIR)/$(YAML_TEST_DIR)$(1) -c $(CURRENT_DIR)/$(CONFIGS_DIR) - - $(info generator $(1) finished) + # Started! + # Create output directory + # Navigate to the generator + # Create a virtual environment, if it does not exist already + # Activate the venv, this is where dependencies are installed for the generator + # Install all the necessary requirements + # Run the generator. The generator is assumed to have an "main.py" file. + # We output to the tests dir (generator program should accept a "-o " argument. + echo "generator $(1) started"; \ + mkdir -p $(YAML_TEST_DIR)$(1); \ + cd $(GENERATOR_DIR)$(1); \ + if test -d venv; then python3 -m venv venv; fi; \ + . venv/bin/activate; \ + pip3 install -r requirements.txt; \ + python3 main.py -o $(CURRENT_DIR)/$(YAML_TEST_DIR)$(1) -c $(CURRENT_DIR)/$(CONFIGS_DIR); \ + echo "generator $(1) finished" endef # The tests dir itself is simply build by creating the directory (recursively creating deeper directories if necessary) $(YAML_TEST_DIR): $(info creating directory, to output yaml targets to: ${YAML_TEST_TARGETS}) mkdir -p $@ +$(YAML_TEST_DIR)/: + $(info ignoring duplicate yaml tests dir) # For any target within the tests dir, build it using the build_yaml_tests function. # (creation of output dir is a dependency)