Skip to content

Commit

Permalink
Refactor C++ unit tests to allow finer grained filtering (#4533)
Browse files Browse the repository at this point in the history
Running all of the C++ unit tests can take a long time.

This PR splits the file-based tests into small versus large tests.  The large tests (usually named file_large_test) can be skipped by setting the following environment variable:

`export GTEST_FILTER="-*large*"`

You can skip both the large tests and the benchmark tests with the following:

`export GTEST_FILTER="-*benchmark*:*large*"`

By default all tests will be run.

Authors:
  - Chuck Hastings (https://github.com/ChuckHastings)

Approvers:
  - Joseph Nke (https://github.com/jnke2016)
  - Seunghwa Kang (https://github.com/seunghwak)

URL: #4533
  • Loading branch information
ChuckHastings authored Jul 18, 2024
1 parent 55cb992 commit 599a3bf
Show file tree
Hide file tree
Showing 43 changed files with 464 additions and 108 deletions.
20 changes: 17 additions & 3 deletions cpp/tests/centrality/edge_betweenness_centrality_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ TEST_P(Tests_EdgeBetweennessCentrality_Rmat, CheckInt64Int64FloatFloat)
}

INSTANTIATE_TEST_SUITE_P(
file_test_pass,
file_test,
Tests_EdgeBetweennessCentrality_File,
::testing::Combine(
// enable correctness checks
Expand All @@ -230,8 +230,22 @@ INSTANTIATE_TEST_SUITE_P(
EdgeBetweennessCentrality_Usecase{20, true, false, true},
EdgeBetweennessCentrality_Usecase{20, true, true, false},
EdgeBetweennessCentrality_Usecase{20, true, true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"),
cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"))));

INSTANTIATE_TEST_SUITE_P(
file_large_test,
Tests_EdgeBetweennessCentrality_File,
::testing::Combine(
// enable correctness checks
::testing::Values(EdgeBetweennessCentrality_Usecase{20, false, false, false},
EdgeBetweennessCentrality_Usecase{20, false, false, true},
EdgeBetweennessCentrality_Usecase{20, false, true, false},
EdgeBetweennessCentrality_Usecase{20, false, true, true},
EdgeBetweennessCentrality_Usecase{20, true, false, false},
EdgeBetweennessCentrality_Usecase{20, true, false, true},
EdgeBetweennessCentrality_Usecase{20, true, true, false},
EdgeBetweennessCentrality_Usecase{20, true, true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
cugraph::test::File_Usecase("test/datasets/webbase-1M.mtx"))));

INSTANTIATE_TEST_SUITE_P(
Expand Down
16 changes: 13 additions & 3 deletions cpp/tests/centrality/eigenvector_centrality_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,26 @@ TEST_P(Tests_EigenvectorCentrality_Rmat, CheckInt64Int64FloatFloat)
}

INSTANTIATE_TEST_SUITE_P(
file_test_pass,
file_test_test,
Tests_EigenvectorCentrality_File,
::testing::Combine(
// enable correctness checks
::testing::Values(EigenvectorCentrality_Usecase{500, false, false},
EigenvectorCentrality_Usecase{500, false, true},
EigenvectorCentrality_Usecase{500, true, false},
EigenvectorCentrality_Usecase{500, true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"),
cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"))));

INSTANTIATE_TEST_SUITE_P(
file_large_test,
Tests_EigenvectorCentrality_File,
::testing::Combine(
// enable correctness checks
::testing::Values(EigenvectorCentrality_Usecase{500, false, false},
EigenvectorCentrality_Usecase{500, false, true},
EigenvectorCentrality_Usecase{500, true, false},
EigenvectorCentrality_Usecase{500, true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
cugraph::test::File_Usecase("test/datasets/ljournal-2008.mtx"),
cugraph::test::File_Usecase("test/datasets/webbase-1M.mtx"))));

Expand Down
14 changes: 12 additions & 2 deletions cpp/tests/centrality/katz_centrality_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,18 @@ INSTANTIATE_TEST_SUITE_P(
KatzCentrality_Usecase{false, true},
KatzCentrality_Usecase{true, false},
KatzCentrality_Usecase{true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"),
cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"))));

INSTANTIATE_TEST_SUITE_P(
file_large_test,
Tests_KatzCentrality_File,
::testing::Combine(
// enable correctness checks
::testing::Values(KatzCentrality_Usecase{false, false},
KatzCentrality_Usecase{false, true},
KatzCentrality_Usecase{true, false},
KatzCentrality_Usecase{true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
cugraph::test::File_Usecase("test/datasets/ljournal-2008.mtx"),
cugraph::test::File_Usecase("test/datasets/webbase-1M.mtx"))));

Expand Down
20 changes: 17 additions & 3 deletions cpp/tests/centrality/mg_betweenness_centrality_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ TEST_P(Tests_MGBetweennessCentrality_Rmat, CheckInt64Int64FloatFloat)
}

INSTANTIATE_TEST_SUITE_P(
file_test_pass,
file_test,
Tests_MGBetweennessCentrality_File,
::testing::Combine(
// enable correctness checks
Expand All @@ -230,8 +230,22 @@ INSTANTIATE_TEST_SUITE_P(
BetweennessCentrality_Usecase{20, false, true, false, true},
BetweennessCentrality_Usecase{20, false, true, true, false},
BetweennessCentrality_Usecase{20, false, true, true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"),
cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"))));

INSTANTIATE_TEST_SUITE_P(
file_large_test,
Tests_MGBetweennessCentrality_File,
::testing::Combine(
// enable correctness checks
::testing::Values(BetweennessCentrality_Usecase{20, false, false, false, false},
BetweennessCentrality_Usecase{20, false, false, false, true},
BetweennessCentrality_Usecase{20, false, false, true, false},
BetweennessCentrality_Usecase{20, false, false, true, true},
BetweennessCentrality_Usecase{20, false, true, false, false},
BetweennessCentrality_Usecase{20, false, true, false, true},
BetweennessCentrality_Usecase{20, false, true, true, false},
BetweennessCentrality_Usecase{20, false, true, true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
cugraph::test::File_Usecase("test/datasets/ljournal-2008.mtx"),
cugraph::test::File_Usecase("test/datasets/webbase-1M.mtx"))));

Expand Down
16 changes: 13 additions & 3 deletions cpp/tests/centrality/mg_edge_betweenness_centrality_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,26 @@ TEST_P(Tests_MGEdgeBetweennessCentrality_Rmat, CheckInt64Int64FloatFloat)
}

INSTANTIATE_TEST_SUITE_P(
file_test_pass,
file_test,
Tests_MGEdgeBetweennessCentrality_File,
::testing::Combine(
// enable correctness checks
::testing::Values(EdgeBetweennessCentrality_Usecase{20, false, false, false},
EdgeBetweennessCentrality_Usecase{20, false, false, true},
EdgeBetweennessCentrality_Usecase{20, false, true, false},
EdgeBetweennessCentrality_Usecase{20, false, true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"),
cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"))));

INSTANTIATE_TEST_SUITE_P(
file_large_test,
Tests_MGEdgeBetweennessCentrality_File,
::testing::Combine(
// enable correctness checks
::testing::Values(EdgeBetweennessCentrality_Usecase{20, false, false, false},
EdgeBetweennessCentrality_Usecase{20, false, false, true},
EdgeBetweennessCentrality_Usecase{20, false, true, false},
EdgeBetweennessCentrality_Usecase{20, false, true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
cugraph::test::File_Usecase("test/datasets/ljournal-2008.mtx"),
cugraph::test::File_Usecase("test/datasets/webbase-1M.mtx"))));

Expand Down
14 changes: 12 additions & 2 deletions cpp/tests/centrality/mg_eigenvector_centrality_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,18 @@ INSTANTIATE_TEST_SUITE_P(
EigenvectorCentrality_Usecase{500, false, true},
EigenvectorCentrality_Usecase{500, true, false},
EigenvectorCentrality_Usecase{500, true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"),
cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"))));

INSTANTIATE_TEST_SUITE_P(
file_large_test,
Tests_MGEigenvectorCentrality_File,
::testing::Combine(
// enable correctness checks
::testing::Values(EigenvectorCentrality_Usecase{500, false, false},
EigenvectorCentrality_Usecase{500, false, true},
EigenvectorCentrality_Usecase{500, true, false},
EigenvectorCentrality_Usecase{500, true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
cugraph::test::File_Usecase("test/datasets/ljournal-2008.mtx"),
cugraph::test::File_Usecase("test/datasets/webbase-1M.mtx"))));

Expand Down
14 changes: 12 additions & 2 deletions cpp/tests/centrality/mg_katz_centrality_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,18 @@ INSTANTIATE_TEST_SUITE_P(
KatzCentrality_Usecase{false, true},
KatzCentrality_Usecase{true, false},
KatzCentrality_Usecase{true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"),
cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"))));

INSTANTIATE_TEST_SUITE_P(
file_large_test,
Tests_MGKatzCentrality_File,
::testing::Combine(
// enable correctness checks
::testing::Values(KatzCentrality_Usecase{false, false},
KatzCentrality_Usecase{false, true},
KatzCentrality_Usecase{true, false},
KatzCentrality_Usecase{true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
cugraph::test::File_Usecase("test/datasets/ljournal-2008.mtx"),
cugraph::test::File_Usecase("test/datasets/webbase-1M.mtx"))));

Expand Down
2 changes: 1 addition & 1 deletion cpp/tests/community/mg_weighted_matching_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Tests_MGWeightedMatching

constexpr bool multi_gpu = true;

bool test_weighted = false;
bool test_weighted = true;
bool renumber = true;
bool drop_self_loops = false;
bool drop_multi_edges = false;
Expand Down
16 changes: 13 additions & 3 deletions cpp/tests/link_analysis/hits_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,21 @@ INSTANTIATE_TEST_SUITE_P(
Hits_Usecase{true, false, true},
Hits_Usecase{true, true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"),
cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
cugraph::test::File_Usecase("test/datasets/ljournal-2008.mtx"),
cugraph::test::File_Usecase("test/datasets/webbase-1M.mtx"),
cugraph::test::File_Usecase("test/datasets/dolphins.mtx"))));

INSTANTIATE_TEST_SUITE_P(
file_large_test,
Tests_Hits_File,
::testing::Combine(
// enable correctness checks
::testing::Values(Hits_Usecase{false, false, true},
Hits_Usecase{false, true, true},
Hits_Usecase{true, false, true},
Hits_Usecase{true, true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
cugraph::test::File_Usecase("test/datasets/ljournal-2008.mtx"),
cugraph::test::File_Usecase("test/datasets/webbase-1M.mtx"))));

INSTANTIATE_TEST_SUITE_P(rmat_small_test,
Tests_Hits_Rmat,
// enable correctness checks
Expand Down
14 changes: 12 additions & 2 deletions cpp/tests/link_analysis/mg_hits_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,18 @@ INSTANTIATE_TEST_SUITE_P(
Hits_Usecase{false, true},
Hits_Usecase{true, false},
Hits_Usecase{true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"),
cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"))));

INSTANTIATE_TEST_SUITE_P(
file_large_test,
Tests_MGHits_File,
::testing::Combine(
// enable correctness checks
::testing::Values(Hits_Usecase{false, false},
Hits_Usecase{false, true},
Hits_Usecase{true, false},
Hits_Usecase{true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
cugraph::test::File_Usecase("test/datasets/ljournal-2008.mtx"),
cugraph::test::File_Usecase("test/datasets/webbase-1M.mtx"))));

Expand Down
19 changes: 16 additions & 3 deletions cpp/tests/link_analysis/mg_pagerank_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,22 @@ TEST_P(Tests_MGPageRank_Rmat, CheckInt64Int64FloatFloat)
std::get<0>(param), override_Rmat_Usecase_with_cmd_line_arguments(std::get<1>(param)));
}

INSTANTIATE_TEST_SUITE_P(file_tests,
Tests_MGPageRank_File,
::testing::Combine(
// enable correctness checks
::testing::Values(PageRank_Usecase{0.0, false, false},
PageRank_Usecase{0.0, false, true},
PageRank_Usecase{0.0, true, false},
PageRank_Usecase{0.0, true, true},
PageRank_Usecase{0.5, false, false},
PageRank_Usecase{0.5, false, true},
PageRank_Usecase{0.5, true, false},
PageRank_Usecase{0.5, true, true}),
::testing::Values(cugraph::test::File_Usecase("karate.csv"))));

INSTANTIATE_TEST_SUITE_P(
file_tests,
file_large_tests,
Tests_MGPageRank_File,
::testing::Combine(
// enable correctness checks
Expand All @@ -310,8 +324,7 @@ INSTANTIATE_TEST_SUITE_P(
PageRank_Usecase{0.5, false, true},
PageRank_Usecase{0.5, true, false},
PageRank_Usecase{0.5, true, true}),
::testing::Values(cugraph::test::File_Usecase("karate.csv"),
cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
::testing::Values(cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
cugraph::test::File_Usecase("test/datasets/ljournal-2008.mtx"),
cugraph::test::File_Usecase("test/datasets/webbase-1M.mtx"))));

Expand Down
12 changes: 10 additions & 2 deletions cpp/tests/prims/mg_count_if_e.cu
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,21 @@ TEST_P(Tests_MGCountIfE_Rmat, CheckInt64Int64FloatTransposeTrue)
INSTANTIATE_TEST_SUITE_P(
file_test,
Tests_MGCountIfE_File,
::testing::Combine(::testing::Values(Prims_Usecase{false, false, true},
Prims_Usecase{false, true, true},
Prims_Usecase{true, false, true},
Prims_Usecase{true, true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"))));

INSTANTIATE_TEST_SUITE_P(
file_large_test,
Tests_MGCountIfE_File,
::testing::Combine(
::testing::Values(Prims_Usecase{false, false, true},
Prims_Usecase{false, true, true},
Prims_Usecase{true, false, true},
Prims_Usecase{true, true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"),
cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
::testing::Values(cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
cugraph::test::File_Usecase("test/datasets/ljournal-2008.mtx"),
cugraph::test::File_Usecase("test/datasets/webbase-1M.mtx"))));

Expand Down
9 changes: 7 additions & 2 deletions cpp/tests/prims/mg_count_if_v.cu
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,15 @@ TEST_P(Tests_MGCountIfV_Rmat, CheckInt64Int64FloatTransposeTrue)
INSTANTIATE_TEST_SUITE_P(
file_test,
Tests_MGCountIfV_File,
::testing::Combine(::testing::Values(Prims_Usecase{true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"))));

INSTANTIATE_TEST_SUITE_P(
file_large_test,
Tests_MGCountIfV_File,
::testing::Combine(
::testing::Values(Prims_Usecase{true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"),
cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
::testing::Values(cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
cugraph::test::File_Usecase("test/datasets/ljournal-2008.mtx"),
cugraph::test::File_Usecase("test/datasets/webbase-1M.mtx"))));

Expand Down
9 changes: 7 additions & 2 deletions cpp/tests/prims/mg_extract_transform_e.cu
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,15 @@ TEST_P(Tests_MGExtractTransformE_Rmat, CheckInt64Int64FloatInt32Int32)
INSTANTIATE_TEST_SUITE_P(
file_test,
Tests_MGExtractTransformE_File,
::testing::Combine(::testing::Values(Prims_Usecase{false, true}, Prims_Usecase{true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"))));

INSTANTIATE_TEST_SUITE_P(
file_large_test,
Tests_MGExtractTransformE_File,
::testing::Combine(
::testing::Values(Prims_Usecase{false, true}, Prims_Usecase{true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"),
cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
::testing::Values(cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
cugraph::test::File_Usecase("test/datasets/ljournal-2008.mtx"),
cugraph::test::File_Usecase("test/datasets/webbase-1M.mtx"))));

Expand Down
9 changes: 7 additions & 2 deletions cpp/tests/prims/mg_extract_transform_v_frontier_outgoing_e.cu
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,15 @@ TEST_P(Tests_MGExtractTransformVFrontierOutgoingE_Rmat, CheckInt64Int64FloatInt3
INSTANTIATE_TEST_SUITE_P(
file_test,
Tests_MGExtractTransformVFrontierOutgoingE_File,
::testing::Combine(::testing::Values(Prims_Usecase{false, true}, Prims_Usecase{true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"))));

INSTANTIATE_TEST_SUITE_P(
file_large_test,
Tests_MGExtractTransformVFrontierOutgoingE_File,
::testing::Combine(
::testing::Values(Prims_Usecase{false, true}, Prims_Usecase{true, true}),
::testing::Values(cugraph::test::File_Usecase("test/datasets/karate.mtx"),
cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
::testing::Values(cugraph::test::File_Usecase("test/datasets/web-Google.mtx"),
cugraph::test::File_Usecase("test/datasets/ljournal-2008.mtx"),
cugraph::test::File_Usecase("test/datasets/webbase-1M.mtx"))));

Expand Down
Loading

0 comments on commit 599a3bf

Please sign in to comment.