Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 33 additions & 72 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1493,68 +1493,7 @@ if(BUILD_TESTING)
"${GECODE_TEST_BLACKBOX_LOG}.dll_parallel")
endif()

set(GECODE_CHECK_TESTS
Branch::Int::Dense::3
Int::Arithmetic::Abs
Int::Arithmetic::ArgMax
Int::Arithmetic::Max::Nary
Int::Cumulative::Man::Fix::0::4
Int::Distinct::Random
Int::Extensional::Reg::Sparse::NFAPrefix
Int::Extensional::Reg::Sparse::RandomNFADifferential
Int::Extensional::TupleSet::Sparse::IncrementalDelta
Int::Extensional::TupleSet::Auto::DefaultDispatch
Int::Linear::Bool::Int::Lq
Int::MiniModel::LinExpr::Bool::352
NoGoods::Queens
Search::PBS::ConstructionFailure
Search::WorkerControl::
Search::DFS::Sol::Binary::Nary::Binary::1::1::1)
if(GECODE_ENABLE_FLATZINC)
list(INSERT GECODE_CHECK_TESTS 1
FlatZinc::Options
FlatZinc::magic_square
FlatZinc::blackbox)
endif()
if(GECODE_ENABLE_SET_VARS)
list(APPEND GECODE_CHECK_TESTS
Set::Dom::Dom::Gr
Set::RelOp::ConstSSI::Union
Set::Sequence::SeqU1
Set::Wait)
endif()
if(GECODE_ENABLE_FLOAT_VARS)
set(GECODE_FLOAT_CHECK_TESTS
Float::Arithmetic::PositiveNRootBounds
Float::Arithmetic::PowConsistency
Float::Arithmetic::MultZeroEndpoint
Float::Arithmetic::Pow::N::2::XY::Sol::C
Float::Arithmetic::NRoot::N::2::XY::Sol::C
Float::Arithmetic::Mult::XYZ::Sol::C)
list(APPEND GECODE_CHECK_TESTS ${GECODE_FLOAT_CHECK_TESTS})

# Keep the fast CI selection honest when Float regressions are added or
# the list above is edited. These names must remain registered in the
# ordinary check target rather than living only in ad-hoc test commands.
set(GECODE_REQUIRED_FLOAT_CHECK_TESTS
Float::Arithmetic::PositiveNRootBounds
Float::Arithmetic::PowConsistency
Float::Arithmetic::MultZeroEndpoint
Float::Arithmetic::Pow::N::2::XY::Sol::C
Float::Arithmetic::NRoot::N::2::XY::Sol::C
Float::Arithmetic::Mult::XYZ::Sol::C)
foreach(gecode_required_float_test ${GECODE_REQUIRED_FLOAT_CHECK_TESTS})
if(NOT gecode_required_float_test IN_LIST GECODE_CHECK_TESTS)
message(FATAL_ERROR
"Required Float check test is missing: ${gecode_required_float_test}")
endif()
endforeach()
endif()

set(GECODE_CHECK_ARGS -iter 2 -threads 0 -fixprob 1)
foreach(gecode_check_test ${GECODE_CHECK_TESTS})
list(APPEND GECODE_CHECK_ARGS -test ${gecode_check_test})
endforeach()
set(GECODE_CHECK_ARGS -iter 2 -threads 0 -fixprob 1 -tag check)

# Keep ctest robust while leaving the large test binaries out of the default build.
set(GECODE_TEST_BUILD_TARGETS gecode-test)
Expand All @@ -1581,16 +1520,6 @@ if(BUILD_TESTING)
ENVIRONMENT "${GECODE_TEST_BLACKBOX_ENV}")
endif()
set(GECODE_CHECK_DEPENDS gecode-test)
if(GECODE_ENABLE_FLOAT_VARS)
add_custom_target(verify-gecode-check-tests
COMMAND ${CMAKE_COMMAND}
"-DTEST_EXECUTABLE=$<TARGET_FILE:gecode-test>"
"-DREQUIRED_TESTS=${GECODE_REQUIRED_FLOAT_CHECK_TESTS}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/VerifyTestSelection.cmake
DEPENDS gecode-test
VERBATIM)
list(APPEND GECODE_CHECK_DEPENDS verify-gecode-check-tests)
endif()
if(GECODE_ENABLE_FLATZINC)
list(APPEND GECODE_CHECK_DEPENDS
gecode-test-blackbox-exec
Expand All @@ -1603,11 +1532,35 @@ if(BUILD_TESTING)
$<TARGET_FILE:gecode-test> ${GECODE_CHECK_ARGS}
DEPENDS ${GECODE_CHECK_DEPENDS}
USES_TERMINAL)
add_custom_target(check-standard
COMMAND ${CMAKE_COMMAND} -E env
GECODE_TEST_BLACKBOX_EXEC=$<TARGET_FILE:gecode-test-blackbox-exec>
GECODE_TEST_BLACKBOX_DLL=$<TARGET_FILE:gecode-test-blackbox-dll>
GECODE_TEST_BLACKBOX_LOG=${GECODE_TEST_BLACKBOX_LOG}
$<TARGET_FILE:gecode-test> -tag standard
DEPENDS ${GECODE_CHECK_DEPENDS}
USES_TERMINAL)
add_custom_target(check-sweep
COMMAND ${CMAKE_COMMAND} -E env
GECODE_TEST_BLACKBOX_EXEC=$<TARGET_FILE:gecode-test-blackbox-exec>
GECODE_TEST_BLACKBOX_DLL=$<TARGET_FILE:gecode-test-blackbox-dll>
GECODE_TEST_BLACKBOX_LOG=${GECODE_TEST_BLACKBOX_LOG}
$<TARGET_FILE:gecode-test> -tag sweep
DEPENDS ${GECODE_CHECK_DEPENDS}
USES_TERMINAL)
else()
add_custom_target(check
COMMAND $<TARGET_FILE:gecode-test> ${GECODE_CHECK_ARGS}
DEPENDS ${GECODE_CHECK_DEPENDS}
USES_TERMINAL)
add_custom_target(check-standard
COMMAND $<TARGET_FILE:gecode-test> -tag standard
DEPENDS gecode-test
USES_TERMINAL)
add_custom_target(check-sweep
COMMAND $<TARGET_FILE:gecode-test> -tag sweep
DEPENDS gecode-test
USES_TERMINAL)
endif()
if(GECODE_ENABLE_FAULT_INJECTION)
set(GECODE_FAULT_CHECK_ARGS -iter 1 -threads 1 -test "^Fault::")
Expand All @@ -1625,10 +1578,18 @@ if(BUILD_TESTING)
message(WARNING "Skipping gecode-test/check targets because required modules are disabled")
add_custom_target(check
COMMAND ${CMAKE_COMMAND} -E echo "Skipping check target because required modules are disabled")
add_custom_target(check-standard
COMMAND ${CMAKE_COMMAND} -E echo "Skipping check-standard target because required modules are disabled")
add_custom_target(check-sweep
COMMAND ${CMAKE_COMMAND} -E echo "Skipping check-sweep target because required modules are disabled")
endif()
else()
add_custom_target(check
COMMAND ${CMAKE_COMMAND} -E echo "Skipping check target because BUILD_TESTING is OFF")
add_custom_target(check-standard
COMMAND ${CMAKE_COMMAND} -E echo "Skipping check-standard target because BUILD_TESTING is OFF")
add_custom_target(check-sweep
COMMAND ${CMAKE_COMMAND} -E echo "Skipping check-sweep target because BUILD_TESTING is OFF")
endif()

# ---------------------------------------------------------------------------
Expand Down
62 changes: 9 additions & 53 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -1503,72 +1503,28 @@ compileexamples: $(EXAMPLEEXE)
test: mkcompiledirs $(BLACKBOXFIXTURES)
@$(MAKE) $(VARIMP) $(TESTEXE) $(TESTPUBLICSMOKEEXES)

CHECKTESTS = Branch::Int::Dense::3 \
Int::Arithmetic::Abs \
Int::Arithmetic::ArgMax \
Int::Arithmetic::Max::Nary \
Int::Cumulative::Man::Fix::0::4 \
Int::Distinct::Random \
Int::Extensional::Reg::Sparse::NFAPrefix \
Int::Extensional::Reg::Sparse::RandomNFADifferential \
Int::Extensional::TupleSet::Sparse::IncrementalDelta \
Int::Extensional::TupleSet::Auto::DefaultDispatch \
Int::Linear::Bool::Int::Lq \
Int::MiniModel::LinExpr::Bool::352 \
NoGoods::Queens \
Search::PBS::ConstructionFailure \
Search::WorkerControl:: \
Search::DFS::Sol::Binary::Nary::Binary::1::1::1

ifeq "@enable_set_vars@" "yes"
CHECKTESTS += \
Set::Dom::Dom::Gr \
Set::RelOp::ConstSSI::Union \
Set::Sequence::SeqU1 \
Set::Wait
endif

ifeq "@enable_flatzinc@" "yes"
CHECKTESTS += FlatZinc::magic_square FlatZinc::Options FlatZinc::blackbox
BLACKBOXCHECKENV = \
GECODE_TEST_BLACKBOX_EXEC=$(abspath $(BLACKBOXEXEC)) \
GECODE_TEST_BLACKBOX_DLL=$(abspath $(BLACKBOXDLL)) \
GECODE_TEST_BLACKBOX_LOG=$(BLACKBOXLOG)
endif

ifeq "@enable_float_vars@" "yes"
FLOATCHECKTESTS = Float::Arithmetic::PositiveNRootBounds \
Float::Arithmetic::PowConsistency \
Float::Arithmetic::MultZeroEndpoint \
Float::Arithmetic::Pow::N::2::XY::Sol::C \
Float::Arithmetic::NRoot::N::2::XY::Sol::C \
Float::Arithmetic::Mult::XYZ::Sol::C
CHECKTESTS += $(FLOATCHECKTESTS)
REQUIREDFLOATCHECKTESTS = Float::Arithmetic::PositiveNRootBounds \
Float::Arithmetic::PowConsistency \
Float::Arithmetic::MultZeroEndpoint \
Float::Arithmetic::Pow::N::2::XY::Sol::C \
Float::Arithmetic::NRoot::N::2::XY::Sol::C \
Float::Arithmetic::Mult::XYZ::Sol::C
endif

# A basic integrity test
check: test
@for t in $(TESTPUBLICSMOKEEXES); do \
$(RUNENVIRONMENT) $$t || exit 1; \
done
@for t in $(REQUIREDFLOATCHECKTESTS); do \
case " $(CHECKTESTS) " in *" $$t "*) ;; \
*) echo "Required Float check test is missing: $$t" >&2; exit 1 ;; \
esac; \
if ! $(RUNENVIRONMENT) $(TESTEXE) -list | grep -Fqx "$$t"; then \
echo "Required Float check test is not registered: $$t" >&2; \
exit 1; \
fi; \
done
$(BLACKBOXCHECKENV) $(RUNENVIRONMENT) \
$(TESTEXE) -iter 2 -threads 0 -fixprob 1 \
$(CHECKTESTS:%=-test %)
$(TESTEXE) -iter 2 -threads 0 -fixprob 1 -tag check

# The standard test suite without sweep tests
check-standard: test
$(BLACKBOXCHECKENV) $(RUNENVIRONMENT) $(TESTEXE) -tag standard

# Really heavy sweep tests
check-sweep: test
$(BLACKBOXCHECKENV) $(RUNENVIRONMENT) $(TESTEXE) -tag sweep

.PHONY: regenerate
regenerate:
Expand Down
9 changes: 9 additions & 0 deletions changelog.in
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ The factories retain nondeterminism without determinization or minimization;
epsilon transitions are not supported. Regular propagation now preserves
branching assigned prefixes when cloning such automata.

[ENTRY]
Module: test
What: new
Rank: major
[DESCRIPTION]
Add self-declared check, standard, and sweep tags to the public test harness.
The standard check targets use a focused integrity selection, while standard
testing retains broad coverage without the exhaustive multi-hour sweeps.

[ENTRY]
Module: test
What: new
Expand Down
24 changes: 0 additions & 24 deletions cmake/VerifyTestSelection.cmake

This file was deleted.

22 changes: 22 additions & 0 deletions docs/cmake-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,28 @@ cmake --install build/vs2022-vcpkg --config Release --prefix C:/path/to/install
Visual Studio is a multi-config generator, so use `--config Release` (or
`Debug`) for build/install/check commands rather than `CMAKE_BUILD_TYPE`.

## Test Targets

When `BUILD_TESTING=ON`, CMake builds the `gecode-test` test runner on demand.
The standard `check` target runs the basic integrity suite:

```bash
cmake --build build --target check
```

Two additional targets expose broader tag-based suites:

```bash
cmake --build build --target check-standard
cmake --build build --target check-sweep
```

`check-standard` runs the standard test suite. `check-sweep` runs tests tagged as
heavy sweep tests and is intended for deliberate, longer-running validation.

Use `gecode-test -help` for runner options and `gecode-test -list-with-tags`
to inspect test assignments.

## Build Conventions and Key Options

### Common CMake options
Expand Down
7 changes: 6 additions & 1 deletion test/branch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,8 +732,13 @@ namespace Test { namespace Branch {
}

#ifdef GECODE_HAS_SET_VARS
SetTest::SetTest(TestTags tags, const std::string& s, int a,
const Gecode::IntSet& d)
: Base("Set::Branch::"+s,tags), arity(a), dom(d) {
}

SetTest::SetTest(const std::string& s, int a, const Gecode::IntSet& d)
: Base("Set::Branch::"+s), arity(a), dom(d) {
: SetTest(TestTags::standard(),s,a,d) {
}

bool
Expand Down
3 changes: 3 additions & 0 deletions test/branch.hh
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ namespace Test {
/// Domain of variables
Gecode::IntSet dom;
public:
/// Construct and register test with explicitly assigned tags
SetTest(TestTags tags, const std::string& s, int a,
const Gecode::IntSet& d);
/// Construct and register test
SetTest(const std::string& s, int a, const Gecode::IntSet& d);
/// Perform test
Expand Down
8 changes: 4 additions & 4 deletions test/branch/set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ namespace Test { namespace Branch {
class Set : public SetTest {
public:
/// Create and register test
Set(const std::string& s, const Gecode::IntSet& d, int n)
: SetTest(s,n,d) {}
Set(TestTags tags, const std::string& s, const Gecode::IntSet& d, int n)
: SetTest(tags,s,n,d) {}
/// Post propagators on variables \a x
virtual void post(Gecode::Space& home, Gecode::SetVarArray& x) {
Gecode::SetVarArgs xx(x.size()-1);
Expand All @@ -57,8 +57,8 @@ namespace Test { namespace Branch {
const int v_sparse[6] = {-100,-10,0,10,100,1000};
Gecode::IntSet d_sparse(v_sparse,6);

Set d_3("Dense::3",d_dense,3);
Set s_3("Sparse::3",d_sparse,3);
Set d_3(TestTags::standard(),"Dense::3",d_dense,3);
Set s_3(TestTags::sweep(),"Sparse::3",d_sparse,3);
}

}}
Expand Down
24 changes: 21 additions & 3 deletions test/flatzinc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ namespace Test { namespace FlatZinc {
}
public:
GistStatisticsMode(void)
: Base("FlatZinc::Options::GistStatisticsMode") {}
: Base("FlatZinc::Options::GistStatisticsMode",
TestTags::check()) {}

virtual bool run(void) {
return
Expand All @@ -96,6 +97,7 @@ namespace Test { namespace FlatZinc {
#ifndef GECODE_HAS_GIST
/// Verify that unavailable Gist mode is rejected instead of running search.
FlatZincErrorTest gist_unavailable(
TestTags::check(),
"Options::GistUnavailable",
"var 1..1: x :: output_var;\nsolve satisfy;\n",
{"-mode", "gist", "-s"},
Expand All @@ -108,15 +110,31 @@ namespace Test { namespace FlatZinc {
const std::string& expected, bool allSolutions,
std::vector<std::string> cmdlineOpt,
OutputCheck check, BeforeRun before)
: Base("FlatZinc::"+name), _name(name), _source(source), _expected(expected),
: FlatZincTest(TestTags::standard(), name, source, expected, allSolutions,
cmdlineOpt, check, before) {}

FlatZincTest::FlatZincTest(TestTags tags, const std::string& name,
const std::string& source,
const std::string& expected, bool allSolutions,
std::vector<std::string> cmdlineOpt,
OutputCheck check, BeforeRun before)
: Base("FlatZinc::"+name, tags), _name(name), _source(source),
_expected(expected),
_allSolutions(allSolutions), _cmdlineOpt(cmdlineOpt),
_check(check), _before(before) {}

FlatZincErrorTest::FlatZincErrorTest(const std::string& name,
const std::string& source,
std::vector<std::string> cmdlineOpt,
std::string expectedMessage)
: FlatZincTest(name, source, "", false, cmdlineOpt),
: FlatZincErrorTest(TestTags::standard(), name, source, cmdlineOpt,
expectedMessage) {}

FlatZincErrorTest::FlatZincErrorTest(TestTags tags, const std::string& name,
const std::string& source,
std::vector<std::string> cmdlineOpt,
std::string expectedMessage)
: FlatZincTest(tags, name, source, "", false, cmdlineOpt),
_expectedMessage(expectedMessage) {}

bool
Expand Down
Loading
Loading