Skip to content

Commit

Permalink
test_parreduce.cpp: fix with new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vlkale authored Apr 10, 2024
1 parent d146c28 commit 22ba2e4
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions tests/sampler/test_parreduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ static const std::vector<std::string> matchers{
*/

static const std::vector<std::string> matchers{
"KokkosP: sample 6 calling child-begin function...",
"KokkosP: sample 6 finished with child-begin function.",
"KokkosP: sample 6 calling child-end function...",
"KokkosP: sample 6 finished with child-end function.",
"KokkosP: sample 11 calling child-begin function...",
"KokkosP: sample 11 finished with child-begin function.",
"KokkosP: sample 11 calling child-end function...",
"KokkosP: sample 11 finished with child-end function."};

/**
* @test This test checks that the tool effectively samples.
*
*/
TEST(SamplerTest, ktoEnvVarDefault) {
//! Initialize @c Kokkos.
Kokkos::initialize();
Expand All @@ -71,8 +86,27 @@ TEST(SamplerTest, ktoEnvVarDefault) {
}

EXPECT_THAT(output.str(), Not(HasSubstr("KokkosP: sample 1 calling")));
EXPECT_THAT(output.str(), Not(HasSubstr("KokkosP: sample 75 calling")));
EXPECT_THAT(output.str(), Not(HasSubstr("KokkosP: sample 149 calling")));
EXPECT_THAT(output.str(), Not(HasSubstr("KokkosP: sample 2 calling")));
EXPECT_THAT(output.str(), Not(HasSubstr("KokkosP: sample 3 calling")));
EXPECT_THAT(output.str(), Not(HasSubstr("KokkosP: sample 4 calling")));
EXPECT_THAT(output.str(), Not(HasSubstr("KokkosP: sample 5 calling")));
EXPECT_THAT(output.str(), Not(HasSubstr("KokkosP: sample 7 calling")));
EXPECT_THAT(output.str(), Not(HasSubstr("KokkosP: sample 8 calling")));
EXPECT_THAT(output.str(), Not(HasSubstr("KokkosP: sample 9 calling")));
EXPECT_THAT(output.str(), Not(HasSubstr("KokkosP: sample 10 calling")));
EXPECT_THAT(output.str(), Not(HasSubstr("KokkosP: sample 12 calling")));
EXPECT_THAT(output.str(), Not(HasSubstr("KokkosP: sample 13 calling")));
EXPECT_THAT(output.str(), Not(HasSubstr("KokkosP: sample 14 calling")));
EXPECT_THAT(output.str(), Not(HasSubstr("KokkosP: sample 15 calling")));

int occurrences = 0;
while (std::string::size_type pos = 0;
(pos = s.find("calling child-begin function", pos)) !=
std::string::npos) {
++occurrences;
pos += target.length();
}
EXPECT_EQ(occurrences, 2);

EXPECT_THAT(output.str(), Not(HasSubstr("KokkosP: FATAL: No child library of "
"sampler utility library to call")));
Expand Down

0 comments on commit 22ba2e4

Please sign in to comment.