Skip to content

Commit

Permalink
added skeleton LIT tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nishant-sachdeva committed Feb 6, 2024
1 parent 7be435b commit b3d306b
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,15 @@ add_custom_target(verify-flowaware
VERBATIM
)

add_custom_target(verify-all DEPENDS verify-symbolic verify-flowaware)
add_custom_target(check
COMMAND python3 my-lit.py -v .
COMMENT "Running LIT based test-suite"
WORKING_DIRECTORY ./test-suite
DEPENDS ${PROJECT_NAME}
VERBATIM
)

add_custom_target(verify-all DEPENDS verify-symbolic verify-flowaware)

# Fetch gTest
include(FetchContent)
Expand Down
5 changes: 5 additions & 0 deletions src/test-suite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ file(COPY PE-benchmarks-llfiles-llvm17 DESTINATION ./)
file(COPY oracle DESTINATION ./)
file(COPY ../../vocabulary DESTINATION ./)
file(COPY index-llvm17.files DESTINATION ./)


configure_file(lit.site.cfg.py.in lit.site.cfg.py @ONLY)
file(COPY my-lit.py DESTINATION ./)
file(COPY test.lit DESTINATION ./)
9 changes: 9 additions & 0 deletions src/test-suite/lit.cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import lit.formats

config.name = "LIT Hello World Tests"
config.test_format = lit.formats.ShTest(True)

config.suffixes = [".lit"]

config.test_source_root = os.path.dirname(__file__)
config.test_exec_root = os.path.join(config.my_obj_root, "test-suite")
7 changes: 7 additions & 0 deletions src/test-suite/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import os

config.my_src_root = r'@CMAKE_SOURCE_DIR@'
config.my_obj_root = r'@CMAKE_BINARY_DIR@'

lit_config.load_config(
config, os.path.join(config.my_src_root, "test-suite/lit.cfg.py"))
5 changes: 5 additions & 0 deletions src/test-suite/my-lit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python
from lit.main import main

if __name__ == "__main__":
main()
3 changes: 3 additions & 0 deletions src/test-suite/test.lit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// RUN: bash sanity_check.sh FA llvm17

// RUN: bash ./sanity_check.sh SYM llvm17

0 comments on commit b3d306b

Please sign in to comment.