- Remove nested minimum required to supress warnings. - Declare SystemC as system library to supress warnings in headers. - Add a BUILD_SHARED_LIBS option - Remove hardcoded STATIC in various add_library calls to honor the BUILD_SHARED_LIBS option - Remove _deps/ directory from the build directory in GitLab pipeline - Remove *.tdb files after test stage in pipeline - Set Ninja as the default generator for the dev preset and re-enable colored diagnostics
103 lines
5.2 KiB
CMake
103 lines
5.2 KiB
CMake
# Copyright (c) 2023, RPTU Kaiserslautern-Landau
|
|
# All rights reserved.
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without
|
|
# modification, are permitted provided that the following conditions are
|
|
# met:
|
|
#
|
|
# 1. Redistributions of source code must retain the above copyright notice,
|
|
# this list of conditions and the following disclaimer.
|
|
#
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
# documentation and/or other materials provided with the distribution.
|
|
#
|
|
# 3. Neither the name of the copyright holder nor the names of its
|
|
# contributors may be used to endorse or promote products derived from
|
|
# this software without specific prior written permission.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
|
|
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
#
|
|
# Authors:
|
|
# Derek Christ
|
|
|
|
###############################################
|
|
### tests_regression ###
|
|
###############################################
|
|
|
|
project(tests_regression)
|
|
|
|
find_program(SqlDiff sqldiff)
|
|
|
|
if(NOT SqlDiff)
|
|
message(WARNING "Regression tests require sqldiff to be installed")
|
|
return()
|
|
endif()
|
|
|
|
set(TABLES_TO_COMPARE
|
|
Phases
|
|
Transactions
|
|
Power
|
|
)
|
|
|
|
function(test_standard standard test_name base_config resource_dir output_filename)
|
|
if(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${standard})
|
|
message(WARNING "Cannot find regression test ${standard}")
|
|
return()
|
|
endif()
|
|
|
|
# Put all the generated files into a subdirectory
|
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_name})
|
|
|
|
# Test to create database
|
|
add_test(
|
|
NAME Regression${test_name}.CreateDatabase
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_name}
|
|
COMMAND $<TARGET_FILE:DRAMSys> ${base_config} ${resource_dir}
|
|
)
|
|
set_tests_properties(Regression${test_name}.CreateDatabase PROPERTIES FIXTURES_SETUP Regression${test_name}.CreateDatabase)
|
|
|
|
# Test to diff the whole database. This test should not fail.
|
|
# The purpose of this test is solely to output the differences of the two databases
|
|
# so that they can be inspected easily.
|
|
add_test(
|
|
NAME Regression${test_name}.SqlDiff
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_name}
|
|
COMMAND sqldiff ${CMAKE_CURRENT_SOURCE_DIR}/${standard}/expected/${output_filename} ${output_filename}
|
|
)
|
|
set_tests_properties(Regression${test_name}.SqlDiff PROPERTIES FIXTURES_REQUIRED Regression${test_name}.CreateDatabase)
|
|
|
|
# Tests to diff individual tables
|
|
foreach(table IN LISTS TABLES_TO_COMPARE)
|
|
add_test(
|
|
NAME Regression${test_name}.SqlDiff.${table}
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_name}
|
|
COMMAND sqldiff --table ${table} ${CMAKE_CURRENT_SOURCE_DIR}/${standard}/expected/${output_filename} ${output_filename}
|
|
)
|
|
set_tests_properties(Regression${test_name}.SqlDiff.${table} PROPERTIES FIXTURES_REQUIRED Regression${test_name}.CreateDatabase)
|
|
|
|
# Only pass test if output is empty
|
|
set_tests_properties(Regression${test_name}.SqlDiff.${table} PROPERTIES PASS_REGULAR_EXPRESSION "^$")
|
|
endforeach()
|
|
endfunction()
|
|
|
|
test_standard(DDR3 DDR3 ${CMAKE_CURRENT_SOURCE_DIR}/DDR3/ddr3-example.json ${CMAKE_CURRENT_SOURCE_DIR}/DDR3 DRAMSys_ddr3-dual-rank_ddr3_ch0.tdb)
|
|
test_standard(DDR4 DDR4 ${CMAKE_CURRENT_SOURCE_DIR}/DDR4/ddr4-example.json ${CMAKE_CURRENT_SOURCE_DIR}/DDR4 DRAMSys_ddr4-bankgrp_ddr4_ch0.tdb)
|
|
test_standard(DDR5 DDR5.Ch0 ${CMAKE_CURRENT_SOURCE_DIR}/DDR5/ddr5-example.json ${CMAKE_CURRENT_SOURCE_DIR}/DDR5 DRAMSys_ddr5-example_ddr5_ch0.tdb)
|
|
test_standard(DDR5 DDR5.Ch1 ${CMAKE_CURRENT_SOURCE_DIR}/DDR5/ddr5-example.json ${CMAKE_CURRENT_SOURCE_DIR}/DDR5 DRAMSys_ddr5-example_ddr5_ch1.tdb)
|
|
test_standard(LPDDR4 LPDDR4 ${CMAKE_CURRENT_SOURCE_DIR}/LPDDR4/lpddr4-example.json ${CMAKE_CURRENT_SOURCE_DIR}/LPDDR4 DRAMSys_lpddr4-example_lpddr4_ch0.tdb)
|
|
test_standard(LPDDR5 LPDDR5 ${CMAKE_CURRENT_SOURCE_DIR}/LPDDR5/lpddr5-example.json ${CMAKE_CURRENT_SOURCE_DIR}/LPDDR5 DRAMSys_lpddr5-example_lpddr5_ch0.tdb)
|
|
test_standard(HBM2 HBM2.Ch0 ${CMAKE_CURRENT_SOURCE_DIR}/HBM2/hbm2-example.json ${CMAKE_CURRENT_SOURCE_DIR}/HBM2 DRAMSys_hbm2-example_hbm2_ch0.tdb)
|
|
test_standard(HBM2 HBM2.Ch1 ${CMAKE_CURRENT_SOURCE_DIR}/HBM2/hbm2-example.json ${CMAKE_CURRENT_SOURCE_DIR}/HBM2 DRAMSys_hbm2-example_hbm2_ch1.tdb)
|
|
test_standard(HBM3 HBM3 ${CMAKE_CURRENT_SOURCE_DIR}/HBM3/hbm3-example.json ${CMAKE_CURRENT_SOURCE_DIR}/HBM3 DRAMSys_hbm3-example_hbm3_ch0.tdb)
|