Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch test executions by default #46934

Merged
merged 2 commits into from
Jan 25, 2021
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
6 changes: 5 additions & 1 deletion build-scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ num_jobs=3
function run_tests
{
# --min-duration shows timing lines for tests with a duration of at least that many seconds.
$WINE "$@" --min-duration 0.2 --use-colour yes --rng-seed time $EXTRA_TEST_OPTS
$WINE "$@" --min-duration 0.2 --use-colour yes --rng-seed time $EXTRA_TEST_OPTS "crafting_skill_gain"&
$WINE "$@" --min-duration 0.2 --use-colour yes --rng-seed time $EXTRA_TEST_OPTS "[slow] !crafting_skill_gain"&
$WINE "$@" --min-duration 0.2 --use-colour yes --rng-seed time $EXTRA_TEST_OPTS "~[slow] ~[.]"&
wait -n
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait on Mac doesn't recognise -n

wait -n
}

# We might need binaries installed via pip, so ensure that our personal bin dir is on the PATH
Expand Down
12 changes: 9 additions & 3 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,14 @@ $(TEST_TARGET): $(OBJS) $(CATA_LIB)
$(PCH_P): $(PCH_H)
-$(CXX) $(CPPFLAGS) $(DEFINES) $(subst -Werror,,$(CXXFLAGS)) -Wno-non-virtual-dtor -Wno-unused-macros -I. -c $(PCH_H) -o $(PCH_P)

# Iterate over all the individual tests.
check: $(TEST_TARGET)
TEST_BATCHES = "crafting_skill_gain" "[slow]\ ~crafting_skill_gain" "~[slow]\ ~[.]"

$(TEST_BATCHES): $(TEST_TARGET)
cd .. && tests/$(TEST_TARGET) --min-duration 0.2 --rng-seed time $@

check: $(TEST_TARGET) $(TEST_BATCHES)

check-single: $(TEST_TARGET)
cd .. && tests/$(TEST_TARGET) --min-duration 0.2 --rng-seed time

clean:
Expand All @@ -77,7 +83,7 @@ $(shell mkdir -p $(ODIR))
$(ODIR)/%.o: %.cpp $(PCH_P)
$(CXX) $(CPPFLAGS) $(DEFINES) $(CXXFLAGS) $(subst main-pch,tests-pch,$(PCHFLAGS)) -c ../tests/$< -o $@

.PHONY: clean check tests precompile_header
.PHONY: clean check check-single tests precompile_header

.SECONDARY: $(OBJS)

Expand Down
2 changes: 1 addition & 1 deletion tests/crafting_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ static void test_skill_progression( const recipe_id &test_recipe, int expected_t
CHECK( actual_turns_taken == expected_turns_taken );
}

TEST_CASE( "crafting skill gain" )
TEST_CASE( "crafting_skill_gain", "[skill],[crafting],[slow]" )
{
SECTION( "lvl 0 -> 1" ) {
GIVEN( "nominal morale" ) {
Expand Down