ci / nightly sweep (1) (push) Skipped
ci / nightly sweep (11) (push) Skipped
ci / nightly sweep (12) (push) Skipped
ci / nightly sweep (16) (push) Skipped
ci / nightly sweep (2) (push) Skipped
ci / nightly sweep (24) (push) Skipped
ci / nightly sweep (32) (push) Skipped
ci / nightly sweep (4) (push) Skipped
ci / nightly sweep (7) (push) Skipped
ci / cold cache (push) Skipped
ci / nightly sweep (8) (push) Skipped
ci / baseline (11 bit) (push) Canceled after 33m54s
ci / cell 8 (push) Canceled after 0s
ci / cell 16 (push) Canceled after 0s
ci / cell 32 (push) Canceled after 0s
`ctest --test-dir build -j` now runs the whole baseline (8 entries, 9 s) instead of six commands typed from memory, and .gitea/workflows/ci.yml drives it: baseline 11 bits, full ctest on every push widths -DR8FORGE_CELL_SIZE=8/16/32, the `widthfree` label only nightly the width sweep for cell 1..32 plus a cold cache run The tests carry labels for that reason: `widthfree` means "true at any width" (bit level slices, the synthesizer, the looping demo, the macro comment format), while flagship / byte_ops / examples pin the 11 bit word (2047 style values, 8 bit era pair counts) and are only meaningful at the default geometry. Cold cache job: throw .r8forge_cache away and let the searcher find the blocks again -- it fails if the fresh results no longer match what the repo ships, which is the cheap version of "the cache is only recomputed when the search changes". Labels in the workflow are `ubuntu-latest`; change them if the self hosted act_runner advertises something else.
83 lines
3.8 KiB
CMake
83 lines
3.8 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
project(R8Forge)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
include_directories(include)
|
|
|
|
# The width of a cell. 11 is the project default; the tests and the VMs follow
|
|
# it, so `-DR8FORGE_CELL_SIZE=16` builds an entirely 16 bit toolchain.
|
|
set(R8FORGE_CELL_SIZE 11 CACHE STRING "bits per cell (1..32)")
|
|
add_compile_definitions(R8FORGE_CELL_SIZE=${R8FORGE_CELL_SIZE})
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
add_library(r8forge_core src/r8asm.cc src/synth.cc)
|
|
target_link_libraries(r8forge_core PUBLIC Threads::Threads)
|
|
|
|
# 别再 set(CMAKE_CXX_FLAGS ...) 了:那会把默认 flag 整个换掉,MSVC 下丢 /EHsc、
|
|
# 还会把 -O3 塞进 Debug 和 /RTC1 打架。Release 配置本来就带 -O3 / /O2 和 NDEBUG。
|
|
if(NOT MSVC)
|
|
add_compile_options($<$<CONFIG:Release>:-march=native>)
|
|
endif()
|
|
|
|
add_executable(r8forge tests/asm_test.cc)
|
|
target_link_libraries(r8forge r8forge_core)
|
|
|
|
add_executable(r8forge_synth_test tests/synth_test.cc)
|
|
target_link_libraries(r8forge_synth_test r8forge_core)
|
|
|
|
add_executable(r8forge_derive src/derive.cc)
|
|
target_link_libraries(r8forge_derive r8forge_core)
|
|
|
|
# A second, independent ROT-8 interpreter: runs a .rot8 file with no assembler
|
|
# and no macros involved, so its verdict can be checked against r8forge_derive.
|
|
add_executable(r8forge_tape_run tests/tape_run.cc)
|
|
|
|
# Runs the byte level library macros (raw_add / raw_and / raw_or / raw_xor /
|
|
# raw_inc) over every input combination.
|
|
add_executable(r8forge_byte_op_test tests/byte_op_test.cc)
|
|
target_link_libraries(r8forge_byte_op_test r8forge_core)
|
|
|
|
# Checks that every %macro in asm/ carries a doc comment in the house format.
|
|
add_executable(r8forge_macro_docs_test tests/macro_docs_test.cc)
|
|
|
|
# Runs every examples/*.r8asm as a stand alone program and compares its OUT
|
|
# stream with the `; out ...` line in the file header.
|
|
add_executable(r8forge_examples_test tests/examples_test.cc)
|
|
target_link_libraries(r8forge_examples_test r8forge_core)
|
|
|
|
add_executable(r8forge_cost_par tests/cost_par.cc)
|
|
target_link_libraries(r8forge_cost_par r8forge_core)
|
|
|
|
add_executable(r8forge_cost_search tests/cost_search.cc)
|
|
target_link_libraries(r8forge_cost_search r8forge_core)
|
|
# ---- tests ------------------------------------------------------------------
|
|
# `ctest --test-dir build -j` runs the whole baseline. Every entry is a program
|
|
# under tests/ that exits non zero on failure; the working directory is the repo
|
|
# root because the drivers use relative paths.
|
|
#
|
|
# Labels: `widthfree` means "true at any cell width" (bit level slices, the
|
|
# synthesizer, the looping demo, the macro comment format). Everything else
|
|
# assumes the default 11 bit geometry -- examples/ fixes 2047 style values and
|
|
# byte_op_test drives the 8/11 bit word macros -- so a CI matrix over
|
|
# -DR8FORGE_CELL_SIZE runs only the widthfree set.
|
|
enable_testing()
|
|
set(R8FORGE_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
add_test(NAME flagship COMMAND r8forge asm/test.r8asm)
|
|
add_test(NAME byte_ops COMMAND r8forge_byte_op_test)
|
|
add_test(NAME examples COMMAND r8forge_examples_test examples)
|
|
add_test(NAME synth_full_add COMMAND r8forge_synth_test examples/full_add.r8asm)
|
|
add_test(NAME bit_add_slice COMMAND r8forge verify_clb_bit_add_nc.r8asm)
|
|
add_test(NAME bit_inc_slice COMMAND r8forge verify_clb_bit_inc_nc.r8asm)
|
|
add_test(NAME loop_derive COMMAND r8forge_derive verify_loop.r8asm -1 0=5)
|
|
add_test(NAME macro_docs COMMAND r8forge_macro_docs_test)
|
|
|
|
set_tests_properties(flagship byte_ops examples PROPERTIES LABELS "default-width")
|
|
set_tests_properties(synth_full_add bit_add_slice bit_inc_slice loop_derive
|
|
macro_docs PROPERTIES LABELS "widthfree")
|
|
set_tests_properties(flagship byte_ops examples synth_full_add bit_add_slice
|
|
bit_inc_slice loop_derive macro_docs
|
|
PROPERTIES WORKING_DIRECTORY ${R8FORGE_TEST_DIR}) |