Skip to content

Commit f072ff0

Browse files
Consolidate tests in a single location (#126)
1 parent d7c3c0b commit f072ff0

29 files changed

+61
-114
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,4 @@ target_compile_options(graph_compiler PRIVATE -fvisibility=hidden)
104104
target_link_options(graph_compiler PRIVATE -Wl,--gc-sections)
105105
target_link_libraries(graph_compiler PRIVATE ${GC_LIB_LINKED_LIBS})
106106

107-
add_subdirectory(unittests)
108107
add_subdirectory(test)

test/CMakeLists.txt

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,44 +10,4 @@ add_library(graph_compiler_static STATIC ${GC_LIB_SOURCES})
1010
target_include_directories(graph_compiler_static PUBLIC ${GC_LIB_INCLUDES})
1111

1212
add_subdirectory(dnnl)
13-
14-
llvm_canonicalize_cmake_booleans(
15-
GC_ENABLE_BINDINGS_PYTHON
16-
)
17-
configure_lit_site_cfg(
18-
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
19-
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
20-
MAIN_CONFIG
21-
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
22-
)
23-
24-
configure_lit_site_cfg(
25-
${CMAKE_CURRENT_SOURCE_DIR}/gc/Unit/lit.site.cfg.py.in
26-
${CMAKE_CURRENT_BINARY_DIR}/gc/Unit/lit.site.cfg.py
27-
MAIN_CONFIG
28-
${CMAKE_CURRENT_SOURCE_DIR}/gc/Unit/lit.cfg.py
29-
)
30-
31-
set(GC_OPT_TEST_DEPENDS
32-
FileCheck count not
33-
# mlir-gen
34-
gc-opt
35-
gc-cpu-runner
36-
GCUnitTests
37-
)
38-
39-
if(GC_ENABLE_BINDINGS_PYTHON)
40-
list(APPEND GC_OPT_TEST_DEPENDS GcPythonModules)
41-
endif()
42-
43-
add_lit_testsuite(gc-check "Running the regression tests"
44-
${CMAKE_CURRENT_BINARY_DIR}
45-
DEPENDS ${GC_OPT_TEST_DEPENDS}
46-
)
47-
48-
# Looks that this property is suitable for IDE
49-
# TODO: Check is this fine for IDE
50-
set_target_properties(gc-check PROPERTIES FOLDER "Tests")
51-
52-
add_lit_testsuites(GC_OPT ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${GC_OPT_TEST_DEPENDS})
53-
13+
add_subdirectory(mlir)

test/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# GC Tests
2+
3+
Tests structured the way MLIR part is similar to what one finds in the upstream (`mlir/unittest` for C++ tests and `mlir/test` for lits). These can be invoked by `gc-check` cmake target.
4+
5+
Backend specific tests are separate, gtest-based.
6+
7+
```
8+
tests
9+
\
10+
dnnl
11+
\
12+
dnnl-specific tests
13+
mlir <-------- file structure kept same as upstream
14+
\
15+
tests
16+
\
17+
mlir lit tests
18+
lit.cfg.py
19+
lit.site.cfg.py.in
20+
unittest
21+
\
22+
mlir unittests
23+
```

test/gc/Unit/lit.cfg.py

Lines changed: 0 additions & 50 deletions
This file was deleted.

test/gc/Unit/lit.site.cfg.py.in

Lines changed: 0 additions & 12 deletions
This file was deleted.

test/mlir/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
add_subdirectory(test)
2+
add_subdirectory(unittests)

test/mlir/test/CMakeLists.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
llvm_canonicalize_cmake_booleans(
2+
GC_ENABLE_BINDINGS_PYTHON
3+
)
4+
5+
configure_lit_site_cfg(
6+
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
7+
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
8+
MAIN_CONFIG
9+
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
10+
)
11+
12+
set(GC_OPT_TEST_DEPENDS
13+
FileCheck count not split-file
14+
# mlir-gen
15+
gc-opt
16+
gc-cpu-runner
17+
GCUnitTests
18+
)
19+
20+
if(GC_ENABLE_BINDINGS_PYTHON)
21+
list(APPEND GC_OPT_TEST_DEPENDS GcPythonModules)
22+
endif()
23+
24+
add_lit_testsuite(gc-check "Running the regression tests"
25+
${CMAKE_CURRENT_BINARY_DIR}
26+
DEPENDS ${GC_OPT_TEST_DEPENDS}
27+
)
28+
29+
# Looks that this property is suitable for IDE
30+
# TODO: Check is this fine for IDE
31+
set_target_properties(gc-check PROPERTIES FOLDER "Tests")
32+
33+
add_lit_testsuites(GC_OPT ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${GC_OPT_TEST_DEPENDS})
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

test/lit.cfg.py renamed to test/mlir/test/lit.cfg.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
# test_exec_root: The root path where tests should be run.
2626
config.test_exec_root = os.path.join(config.gc_obj_root, "test")
27+
config.gc_tools_dir = os.path.join(config.gc_obj_root, "bin")
2728

2829
config.substitutions.append(("%PATH%", config.environment["PATH"]))
2930
config.substitutions.append(("%shlibext", config.llvm_shlib_ext))
@@ -39,10 +40,6 @@
3940
# directories.
4041
config.excludes = []
4142

42-
# test_exec_root: The root path where tests should be run.
43-
config.test_exec_root = os.path.join(config.gc_obj_root, "test")
44-
config.gc_tools_dir = os.path.join(config.gc_obj_root, "bin")
45-
4643
# Tweak the PATH to include the tools dir.
4744
llvm_config.with_environment("PATH", config.llvm_tools_dir, append_path=True)
4845

test/lit.site.cfg.py.in renamed to test/mlir/test/lit.site.cfg.py.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ import lit.llvm
3636
lit.llvm.initialize(lit_config, config)
3737

3838
# Let the main config do the real work.
39-
lit_config.load_config(config, "@CMAKE_SOURCE_DIR@/test/lit.cfg.py")
39+
lit_config.load_config(config, "@CMAKE_SOURCE_DIR@/test/mlir/test/lit.cfg.py")

unittests/CMakeLists.txt renamed to test/mlir/unittests/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
if (NOT GC_TEST_ENABLE)
2-
message(STATUS "The unittests are not enabled.")
3-
return()
4-
endif ()
5-
61
if(GC_MLIR_CXX_FLAGS)
72
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GC_MLIR_CXX_FLAGS}")
83
endif()

0 commit comments

Comments
 (0)