forked from OSchip/llvm-project
Tweaks and fixes to cpp11-migrate generated tests
* Fixed a comment typo * Changed 'autogen' to 'generated-tests' * Made the clean target not fail if the 'generated-tests' directory doesn't already exist. llvm-svn: 175624
This commit is contained in:
parent
d8c29210e5
commit
ea8b062a56
|
@ -35,7 +35,7 @@ set(CLANG_TOOLS_TEST_DEPS
|
|||
|
||||
add_lit_testsuite(check-clang-tools "Running the Clang extra tools' regression tests"
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cpp11-migrate/autogen
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cpp11-migrate/generated_tests
|
||||
DEPENDS ${CLANG_TOOLS_TEST_DEPS}
|
||||
ARGS ${CLANG_TOOLS_TEST_EXTRA_ARGS}
|
||||
)
|
||||
|
|
|
@ -28,7 +28,7 @@ TESTDIRS := $(TESTDIRS:$(PROJ_SRC_DIR)%=$(PROJ_OBJ_DIR)%)
|
|||
TESTDIRS += $(EXTRA_TESTDIRS)
|
||||
|
||||
# List of roots for auto-generated tests.
|
||||
TESTDIRS += $(PROJ_OBJ_DIR)/cpp11-migrate/autogen
|
||||
TESTDIRS += $(PROJ_OBJ_DIR)/cpp11-migrate/generated_tests
|
||||
|
||||
ifndef TESTARGS
|
||||
ifdef VERBOSE
|
||||
|
|
|
@ -10,20 +10,20 @@ set(generator_scripts
|
|||
|
||||
# macro that runs a generator script to produce an auto-generated file.
|
||||
# Generator scripts must follow scheme above. The resulting file is placed in:
|
||||
# ${CMAKE_CURRENT_BINARY_DIR})/autogen/dirname(<script name>).
|
||||
# ${CMAKE_CURRENT_BINARY_DIR})/generated_tests/dirname(<script name>).
|
||||
#
|
||||
# Two arguments are required:
|
||||
# script - The generator script (relative to ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
# output - Name of the variable to store the name of the generated file in.
|
||||
macro(autogenerate_file script output)
|
||||
get_filename_component(dir ${script} PATH)
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/autogen/${dir}")
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/generated_tests/${dir}")
|
||||
string(REGEX REPLACE "gen_(.*).py" "\\1" output_name ${script})
|
||||
set(script_file
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${script}"
|
||||
)
|
||||
set(output_file
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/autogen/${output_name}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/generated_tests/${output_name}"
|
||||
)
|
||||
set(gencmd
|
||||
${PYTHON_EXECUTABLE}
|
||||
|
@ -50,10 +50,10 @@ add_custom_target(cpp11-migrate-autogen
|
|||
DEPENDS ${depends}
|
||||
)
|
||||
|
||||
set(TEST_SOURCE_ROOT ${CMAKE_CURRENT_BINARY_DIR}/autogen)
|
||||
set(TEST_SOURCE_ROOT ${CMAKE_CURRENT_BINARY_DIR}/generated_tests)
|
||||
set(TEST_EXEC_ROOT ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(TESTSUITE_NAME "cpp11-migrate Auto-Generated Tests")
|
||||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../lit.site.cfg.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/autogen/lit.site.cfg
|
||||
${CMAKE_CURRENT_BINARY_DIR}/generated_tests/lit.site.cfg
|
||||
)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
# This Makefile is responsible for creating a LIT testsuite for auto-generated
|
||||
# tests. The recipe that runs llvm-lit needs to provide the following path of
|
||||
# the lit.site.cfg for the generated testsuite: $(PROJ_OBJ_DIR)/autogen.
|
||||
# the lit.site.cfg for the generated testsuite: $(PROJ_OBJ_DIR)/generated_tests.
|
||||
|
||||
CLANG_LEVEL := ../../../..
|
||||
include $(CLANG_LEVEL)/Makefile
|
||||
|
@ -26,24 +26,24 @@ GENERATOR_SCRIPTS := \
|
|||
# macro to be used with $(call) that generates a rule and recipe that causes a
|
||||
# file to be auto-generated from a generator script. Generator scripts must
|
||||
# follow scheme above. The resulting file is placed in:
|
||||
# $(PROJ_OBJ_DIR)/autogen/$(dir <script name>).
|
||||
# $(PROJ_OBJ_DIR)/generated_tests/$(dir <script name>).
|
||||
#
|
||||
# One argument required: the name of generator script relative to
|
||||
# $(PROJ_SRC_DIR).
|
||||
define autogenerate-file
|
||||
OUTFILE := $(addprefix autogen/$(dir $1), $(patsubst gen_%.py,%,$(notdir $1)))
|
||||
OUTFILE := $(addprefix generated_tests/$(dir $1), $(patsubst gen_%.py,%,$(notdir $1)))
|
||||
GENERATED_FILES := $$(GENERATED_FILES) $$(OUTFILE)
|
||||
$$(OUTFILE): $1
|
||||
@echo "Autogenerating $$<"
|
||||
@$(MKDIR) $(addprefix autogen/, $(dir $1))
|
||||
@$(MKDIR) $(addprefix generated_tests/, $(dir $1))
|
||||
@$(PYTHON) $$< > $$@
|
||||
endef
|
||||
$(foreach script, $(GENERATOR_SCRIPTS), $(eval $(call autogenerate-file,$(script))))
|
||||
|
||||
FORCE:
|
||||
|
||||
autogen/lit.site.cfg: FORCE
|
||||
@$(MKDIR) $(PROJ_OBJ_DIR)/autogen
|
||||
generated_tests/lit.site.cfg: FORCE
|
||||
@$(MKDIR) $(PROJ_OBJ_DIR)/generated_tests
|
||||
@echo "Making cpp11-migrate Auto-Generated Tests' 'lit.site.cfg' file..."
|
||||
@$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g > lit.tmp
|
||||
@$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> lit.tmp
|
||||
|
@ -52,15 +52,15 @@ autogen/lit.site.cfg: FORCE
|
|||
@$(ECHOPATH) s=@CLANG_TOOLS_SOURCE_DIR@=$(PROJ_SRC_DIR)/../..=g >> lit.tmp
|
||||
@$(ECHOPATH) s=@CLANG_TOOLS_BINARY_DIR@=$(PROJ_OBJ_DIR)/../..=g >> lit.tmp
|
||||
@$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> lit.tmp
|
||||
@$(ECHOPATH) s=@TEST_SOURCE_ROOT@=$(PROJ_OBJ_DIR)/autogen=g >> lit.tmp
|
||||
@$(ECHOPATH) s=@TEST_SOURCE_ROOT@=$(PROJ_OBJ_DIR)/generated_tests=g >> lit.tmp
|
||||
@$(ECHOPATH) s=@TEST_EXEC_ROOT@=$(PROJ_OBJ_DIR)=g >> lit.tmp
|
||||
@$(ECHOPATH) s=@TESTSUITE_NAME@=cpp11-migrate Auto-Generated Tests=g >> lit.tmp
|
||||
@sed -f lit.tmp $(PROJ_SRC_DIR)/../lit.site.cfg.in > $@
|
||||
@-rm -f lit.tmp
|
||||
|
||||
all:: $(GENERATED_FILES) autogen/lit.site.cfg
|
||||
all:: $(GENERATED_FILES) generated_tests/lit.site.cfg
|
||||
|
||||
clean::
|
||||
@rm -r autogen
|
||||
@-rm -r generated_tests
|
||||
|
||||
.PHONY: all clean
|
||||
|
|
|
@ -8,7 +8,7 @@ import subprocess
|
|||
|
||||
# Configuration file for the 'lit' test runner.
|
||||
|
||||
# weak PATH for Win32
|
||||
# Tweak PATH for Win32
|
||||
if platform.system() == 'Windows':
|
||||
# Seek sane tools in directories and set to $PATH.
|
||||
path = getattr(config, 'lit_tools_dir', None)
|
||||
|
|
Loading…
Reference in New Issue