Skip to content

Commit 5c021b2

Browse files
committed
tests were broken because macro name changed
make two variables CACHE INTERNAL so that their values are available in other scopes (i.e. in test dirs)
1 parent 10fb741 commit 5c021b2

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

cmake/SC_CXX_schema_macros.cmake

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ macro(P21_TESTS sfile)
2424
endforeach()
2525
endmacro(P21_TESTS sfile)
2626

27-
#
27+
# create p21read_sdai_*, lazy_sdai_*, any exes listed in SC_SDAI_ADDITIONAL_EXES_SRCS
2828
macro(SCHEMA_EXES)
2929
RELATIVE_PATH_TO_TOPLEVEL(${CMAKE_CURRENT_SOURCE_DIR} RELATIVE_PATH_COMPONENT)
3030
SC_ADDEXEC(p21read_${PROJECT_NAME} "${RELATIVE_PATH_COMPONENT}/src/test/p21read/p21read.cc" "${PROJECT_NAME};stepdai;stepcore;stepeditor;steputils;base" "TESTABLE")
@@ -85,13 +85,11 @@ macro(SCHEMA_TARGETS expFile schemaName sourceFiles)
8585
# to divert stdout, stderr in cmake except via execute_process
8686
add_custom_command(OUTPUT ${sourceFiles}
8787
COMMAND ${CMAKE_COMMAND} -DEXE=\"$<TARGET_FILE:exp2cxx>\" -DEXP=\"${expFile}\"
88-
-DONESHOT=\"${SC_GENERATE_CXX_ONESHOT}\"
89-
-DSDIR=\"${CMAKE_CURRENT_LIST_DIR}\"
88+
-DONESHOT=\"${SC_GENERATE_CXX_ONESHOT}\" -DSDIR=\"${CMAKE_CURRENT_LIST_DIR}\"
9089
-P ${SC_CMAKE_DIR}/SC_Run_exp2cxx.cmake
9190
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
9291
COMMENT "[exp2cxx] Generating ${${PROJECT_NAME}_file_count} C++ files for ${PROJECT_NAME}."
9392
)
94-
# will include_directories behave as desired in a macro?
9593
include_directories(
9694
${CMAKE_CURRENT_SOURCE_DIR} ${SC_SOURCE_DIR}/src/cldai ${SC_SOURCE_DIR}/src/cleditor
9795
${SC_SOURCE_DIR}/src/clutils ${SC_SOURCE_DIR}/src/clstepcore ${SC_SOURCE_DIR}/src/base
@@ -101,6 +99,7 @@ macro(SCHEMA_TARGETS expFile schemaName sourceFiles)
10199
SC_ADDLIB(${PROJECT_NAME} "${sourceFiles}" "stepdai;stepcore;stepeditor;steputils;base" "TESTABLE")
102100
add_dependencies(${PROJECT_NAME} generate_cpp_${PROJECT_NAME})
103101
102+
SCHEMA_EXES()
104103
SCHEMA_TESTS()
105104
P21_TESTS(${expFile})
106105
# TODO add test to verify that schema scanner output matches fedex_plus output

cmake/schema_scanner/schemaScanner.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
# SCANNER_BUILD_DIR: location scanner is built
1818

1919
set(SCANNER_SRC_DIR ${SC_CMAKE_DIR}/schema_scanner)
20-
set(SCANNER_BUILD_DIR ${SC_BINARY_DIR}/schema_scanner)
21-
set(SCANNER_OUT_DIR ${SC_BINARY_DIR}/bin)
20+
set(SCANNER_BUILD_DIR ${SC_BINARY_DIR}/schema_scanner CACHE INTERNAL "location for scanner build, config files (copied schemas)")
21+
set(SCANNER_OUT_DIR ${SC_BINARY_DIR}/bin CACHE INTERNAL "location for schema_scanner executable")
2222

2323
#write a cmake file for the cache. the alternative is a very long
2424
# command line - and the command line can't have newlines in it
@@ -76,7 +76,7 @@ macro(SCHEMA_CMLIST SCHEMA_FILE)
7676
)
7777
if(NOT "${_ss_stat}" STREQUAL "0")
7878
#check size of output, put in file if large?
79-
message(FATAL_ERROR "Schema scan exited with error code ${_ss_stat}. stdout:\n${_ss_out}\nstderr:\n${_ss_err}")
79+
message(FATAL_ERROR "Schema scan for '${SCHEMA_FILE}'\nexited with error code '${_ss_stat}'\nstdout:\n${_ss_out}\nstderr:\n${_ss_err}\n")
8080
endif(NOT "${_ss_stat}" STREQUAL "0")
8181
# scanner output format: each line contains an absolute path. each path is a dir containing a CMakeLists for one schema
8282
# there will usually be a single line of output, but it is not illegal for multiple schemas to exist in one .exp file

data/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# To build one or more schemas, configure with
22
# 'cmake -DSC_BUILD_SCHEMAS="path/to/schema.exp;path/to/schema2.exp"
3+
# you can specify a schema in 3 ways:
4+
# * path relative to build dir
5+
# * path relative to sc/data (this dir)
6+
# * absolute path
7+
#
8+
# cmake goes through the above options in order until it finds one
9+
# that exists. if ${path} is a dir, cmake expects to find a single
10+
# .exp file inside, which it uses. otherwise, ${path} is assumed to
11+
# be an express file.
312

413
if(NOT "${SC_BUILD_SCHEMAS}" STREQUAL "")
514
include(${SC_CMAKE_DIR}/schema_scanner/schemaScanner.cmake)

test/cpp/schema_specific/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ endfunction( add_schema_dependent_test name sdai_lib exe_args )
3737
#if you need a schema that won't be built automatically (i.e. not in sc/data), put it in here
3838
#temporarily disabling testing ensures that the schema will be built before these tests run
3939
set(SC_ENABLE_TESTING OFF)
40-
BUILD_A_SCHEMA( ${SC_SOURCE_DIR}/test/unitary_schemas/array_bounds_expr.exp )
41-
BUILD_A_SCHEMA( ${SC_SOURCE_DIR}/test/unitary_schemas/inverse_attr.exp )
40+
SCHEMA_CMLIST(${SC_SOURCE_DIR}/test/unitary_schemas/array_bounds_expr.exp)
41+
SCHEMA_CMLIST(${SC_SOURCE_DIR}/test/unitary_schemas/inverse_attr.exp)
4242
set(SC_ENABLE_TESTING ON)
4343

4444
add_schema_dependent_test( "aggregate_bound_runtime" "array_bounds_expr"

test/p21/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ set_tests_properties(test_mismatch_schema_name test_missing_and_required_strict
8484

8585
#check for a segmentation fault with selects. the files are a subset of the 210e3 schema and of SurfaceMountFlasher.stp, respectively
8686
#p21read will report errors with the file, but they don't matter as long as there isn't a segfault.
87-
BUILD_A_SCHEMA(${SC_SOURCE_DIR}/test/misc/select_segfault_210e3.exp)
87+
SCHEMA_CMLIST(${SC_SOURCE_DIR}/test/misc/select_segfault_210e3.exp)
8888
add_test(test_select_segfault ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/p21read_sdai_select_segfault_210e3
8989
${CMAKE_CURRENT_SOURCE_DIR}/select_segfault_210e3.stp)
9090
set_tests_properties(test_select_segfault PROPERTIES DEPENDS build_cpp_sdai_select_segfault_210e3 LABELS exchange_file WILL_FAIL TRUE)
9191

9292
set(mid "multiple_inheritance_derived")
9393
#schema for multiple inheritance where two attrs with same name are inherited; one is derived
94-
BUILD_A_SCHEMA(${SC_SOURCE_DIR}/test/unitary_schemas/${mid}.exp)
94+
SCHEMA_CMLIST(${SC_SOURCE_DIR}/test/unitary_schemas/${mid}.exp)
9595

9696
INSTANCE_TEST(${mid} PASS "A();" )
9797
INSTANCE_TEST(${mid} FAIL "A(*);" )

0 commit comments

Comments
 (0)