Skip to content

Commit

Permalink
Use CMake build types in CI and for benchmarking (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
smarr authored Jul 28, 2024
2 parents ed23dbb + 5725440 commit 0aa3c03
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 61 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
echo cmake . -DGC_TYPE=${{ matrix.gc}} ${{ matrix.integers }}
mkdir cmake-build
cd cmake-build
cmake .. -DGC_TYPE=${{ matrix.gc}} ${{ matrix.integers }}
cmake .. -DGC_TYPE=${{ matrix.gc}} ${{ matrix.integers }} -DCMAKE_BUILD_TYPE=Debug
make -j5
- name: Run Unit Tests
Expand All @@ -67,6 +67,8 @@ jobs:
run: |
clang-tidy-18 --config-file=.clang-tidy src/**/*.cpp -- -fdiagnostics-absolute-paths -DGC_TYPE=${{ matrix.gc}} ${{ matrix.integers }} -DUNITTESTS
- name: Test SomSom
run: |
cmake-build/SOM++ -cp Smalltalk:TestSuite:core-lib/SomSom/src/compiler:core-lib/SomSom/src/interpreter:core-lib/SomSom/src/primitives:core-lib/SomSom/src/vm:core-lib/SomSom/src/vmobjects core-lib/SomSom/tests/SomSomTests.som
# Disabled because it's too slow with the sanitizers
# - name: Test SomSom
# run: |
# export ASAN_OPTIONS=detect_leaks=0
# cmake-build/SOM++ -cp Smalltalk:TestSuite:core-lib/SomSom/src/compiler:core-lib/SomSom/src/interpreter:core-lib/SomSom/src/primitives:core-lib/SomSom/src/vm:core-lib/SomSom/src/vmobjects core-lib/SomSom/tests/SomSomTests.som
25 changes: 21 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ build_and_test:

tags: [$MACHINE]
script:
- rm -rf cmake-build && mkdir cmake-build
- rm -rf release && mkdir release
- rm -rf debug && mkdir debug

- if [ "$COMPILER" = "gcc" ]; then export CC=gcc-13; export CXX=g++-13; fi
- if [ "$COMPILER" = "clang" ]; then export CC=clang-17; export CXX=clang++-17; fi

Expand All @@ -60,14 +62,29 @@ build_and_test:
fi
NAME=`echo "$NAME" | tr '[:upper:]' '[:lower:]'`
- cd cmake-build
- cmake .. $INTEGERS -DGC_TYPE=$GC
- cd release
- cmake .. $INTEGERS -DGC_TYPE=$GC -DCMAKE_BUILD_TYPE=Release
- make -j10
- mv SOM++ ../$NAME
- cd ..

- cd debug
- cmake .. $INTEGERS -DGC_TYPE=$GC -DCMAKE_BUILD_TYPE=Debug
- make -j10
- ./SOM++ -cp ../Smalltalk ../TestSuite/TestHarness.som
- ./unittests -cp ../Smalltalk:../TestSuite/BasicInterpreterTests ../Examples/Hello.som
- mv SOM++ ../$NAME
- cd ..

# Test SomSom
- |+
if [ "$COMPILER" = "clang" ]; then
# this is to load balance the SomSom testing
# only when compiling with Clang, and only on one machine for each integer configuration
if [ "$MACHINE $INTEGERS" = "yuria -DUSE_TAGGING=true" ] || [ "$MACHINE $INTEGERS" = "yuria2 -DUSE_TAGGING=false -DCACHE_INTEGER=true" ] || [ "$MACHINE $INTEGERS" = "yuria3 -DUSE_TAGGING=false -DCACHE_INTEGER=false" ]; then
./$NAME -cp Smalltalk:TestSuite:core-lib/SomSom/src/compiler:core-lib/SomSom/src/interpreter:core-lib/SomSom/src/primitives:core-lib/SomSom/src/vm:core-lib/SomSom/src/vmobjects core-lib/SomSom/tests/SomSomTests.som
fi
fi
# run the benchmarks
- rebench --experiment="CI ID $CI_PIPELINE_ID" --branch="$CI_COMMIT_REF_NAME" -c rebench.conf all "e:${NAME}" "m:$MACHINE"

Expand Down
108 changes: 56 additions & 52 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ set(CMAKE_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_CXX_STANDARD 14)

set(ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(SRC_DIR "${ROOT_DIR}/src")
set(COMPILER_DIR "${SRC_DIR}/compiler")
set(INTERPRETER_DIR "${SRC_DIR}/interpreter")
set(MEMORY_DIR "${SRC_DIR}/memory")
set(MISC_DIR "${SRC_DIR}/misc")
set(VM_DIR "${SRC_DIR}/vm")
set(VMOBJECTS_DIR "${SRC_DIR}/vmobjects")
set(UNITTEST_DIR "${SRC_DIR}/unitTests")
set(SRC_DIR "${ROOT_DIR}/src")
set(COMPILER_DIR "${SRC_DIR}/compiler")
set(INTERPRETER_DIR "${SRC_DIR}/interpreter")
set(MEMORY_DIR "${SRC_DIR}/memory")
set(MISC_DIR "${SRC_DIR}/misc")
set(VM_DIR "${SRC_DIR}/vm")
set(VMOBJECTS_DIR "${SRC_DIR}/vmobjects")
set(UNITTEST_DIR "${SRC_DIR}/unitTests")

set(PRIMITIVES_DIR "${SRC_DIR}/primitives")
set(PRIMITIVESCORE_DIR "${SRC_DIR}/primitivesCore")
Expand Down Expand Up @@ -68,15 +68,15 @@ option(FOR_PROFILING "Compile for profiling" FALSE)
if (USE_TAGGING)
add_definitions(-DUSE_TAGGING)
if (CACHE_INTEGER)
message(FATAL_ERROR "CACHE_INTEGER needs to be disabled when tagging is used.")
endif ()
message(FATAL_ERROR "CACHE_INTEGER needs to be disabled when tagging is used.")
endif ()
endif()

if (CACHE_INTEGER)
add_definitions(
-DCACHE_INTEGER
-DINT_CACHE_MIN_VALUE=${INT_CACHE_MIN_VALUE}
-DINT_CACHE_MAX_VALUE=${INT_CACHE_MAX_VALUE})
add_definitions(
-DCACHE_INTEGER
-DINT_CACHE_MIN_VALUE=${INT_CACHE_MIN_VALUE}
-DINT_CACHE_MAX_VALUE=${INT_CACHE_MAX_VALUE})
endif ()

if (GENERATE_INTEGER_HISTOGRAM)
Expand All @@ -102,69 +102,73 @@ endif ()
add_definitions(-DGC_TYPE=${GC_TYPE})

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_definitions(-fdiagnostics-absolute-paths)
add_definitions(-fdiagnostics-absolute-paths)
endif()

add_executable(SOM++ "")

target_sources(SOM++ PRIVATE
${COMPILER_SRC}
${INTERPRETER_SRC}
${MEMORY_SRC}
${MISC_SRC}
${VM_SRC}
${VMOBJECTS_SRC}
${COMPILER_SRC}
${INTERPRETER_SRC}
${MEMORY_SRC}
${MISC_SRC}
${VM_SRC}
${VMOBJECTS_SRC}

${MAIN_SRC}
${PRIMITIVES_SRC}
${PRIMITIVESCORE_SRC})
${MAIN_SRC}
${PRIMITIVES_SRC}
${PRIMITIVESCORE_SRC})

target_compile_options(SOM++ PRIVATE
-m64
-Wno-endif-labels)
-m64
-Wno-endif-labels)

target_include_directories(SOM++ PRIVATE ${SRC_DIR})

target_link_libraries(SOM++)

add_executable(unittests "")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_executable(unittests "")

target_sources(unittests PRIVATE
${COMPILER_SRC}
${INTERPRETER_SRC}
${MEMORY_SRC}
${MISC_SRC}
${VM_SRC}
${VMOBJECTS_SRC}
target_sources(unittests PRIVATE
${COMPILER_SRC}
${INTERPRETER_SRC}
${MEMORY_SRC}
${MISC_SRC}
${VM_SRC}
${VMOBJECTS_SRC}

${PRIMITIVES_SRC}
${PRIMITIVESCORE_SRC}
${PRIMITIVES_SRC}
${PRIMITIVESCORE_SRC}

${UNITTEST_SRC})
${UNITTEST_SRC})

target_compile_options(unittests PRIVATE
-DDEBUG -O0 -g -DUNITTESTS)
add_definitions(-DDEBUG -DUNITTESTS)

target_include_directories(unittests PRIVATE
${SRC_DIR}
/opt/local/include)
target_compile_options(unittests PRIVATE -O0 -g)

find_library(LIB_CPPUNIT
NAMES cppunit
HINTS /opt/local/lib)
target_include_directories(unittests PRIVATE
${SRC_DIR}
/opt/local/include)

find_library(LIB_CPPUNIT
NAMES cppunit
HINTS /opt/local/lib)

target_link_libraries(unittests ${LIB_CPPUNIT})
endif()

target_link_libraries(unittests ${LIB_CPPUNIT})

enable_testing()

add_test(
NAME unittests
COMMAND unittests -cp ${ROOT_DIR}/Smalltalk ${ROOT_DIR}/Examples/Hello.som)
NAME unittests
COMMAND unittests -cp ${ROOT_DIR}/Smalltalk ${ROOT_DIR}/Examples/Hello.som)

add_test(
NAME som-tests
COMMAND SOM++ -cp ${ROOT_DIR}/Smalltalk ${ROOT_DIR}/TestSuite/TestHarness.som)
NAME som-tests
COMMAND SOM++ -cp ${ROOT_DIR}/Smalltalk ${ROOT_DIR}/TestSuite/TestHarness.som)

add_test(
NAME benchmarks
COMMAND SOM++ -cp ${ROOT_DIR}/Smalltalk:${ROOT_DIR}/Examples/Benchmarks/LanguageFeatures ${ROOT_DIR}/Examples/Benchmarks/All.som)
NAME benchmarks
COMMAND SOM++ -cp ${ROOT_DIR}/Smalltalk:${ROOT_DIR}/Examples/Benchmarks/LanguageFeatures ${ROOT_DIR}/Examples/Benchmarks/All.som)
2 changes: 1 addition & 1 deletion rebench.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ reporting:
project_name: SOMpp

runs:
max_invocation_time: 60
max_invocation_time: 300

benchmark_suites:
macro:
Expand Down

0 comments on commit 0aa3c03

Please sign in to comment.