From b1468a51933c82fe126a416bd45698cebfa1069c Mon Sep 17 00:00:00 2001 From: Ed Seidl Date: Mon, 22 Jan 2024 13:55:57 -0800 Subject: [PATCH] Add CUDF_TEST_PROGRAM_MAIN macro to tests lacking it (#14751) `JSON_PATH_TEST` and `ROW_CONVERSION_TEST` were not using the `CUDF_TEST_PROGRAM_MAIN`, and thus were not picking up the `GTEST_CUDF_RMM_MODE` env variable during nightly testing. Authors: - Ed Seidl (https://github.com/etseidl) Approvers: - David Wendt (https://github.com/davidwendt) - Mike Wilson (https://github.com/hyperbolic2346) URL: https://github.com/rapidsai/cudf/pull/14751 --- cpp/tests/json/json_tests.cpp | 5 ++++- cpp/tests/transform/row_conversion.cpp | 19 +++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/cpp/tests/json/json_tests.cpp b/cpp/tests/json/json_tests.cpp index a03880eef5d..548047f0410 100644 --- a/cpp/tests/json/json_tests.cpp +++ b/cpp/tests/json/json_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023, NVIDIA CORPORATION. + * Copyright (c) 2021-2024, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ #include #include +#include #include @@ -1016,3 +1017,5 @@ TEST_F(JsonPathTests, MissingFieldsAsNulls) do_test("$.x[*].array", "", "null", false); do_test("$.tup[*].a.x", "[\"5\"]", "[null,null,null,\"5\"]"); } + +CUDF_TEST_PROGRAM_MAIN() diff --git a/cpp/tests/transform/row_conversion.cpp b/cpp/tests/transform/row_conversion.cpp index 542ccc5e2d5..77cc236a4c4 100644 --- a/cpp/tests/transform/row_conversion.cpp +++ b/cpp/tests/transform/row_conversion.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -164,7 +165,7 @@ TEST_F(ColumnToRowTests, ManyStrings) return TEST_STRINGS[rand() % (sizeof(TEST_STRINGS) / sizeof(TEST_STRINGS[0]))]; }); - auto const num_rows = 1000000; + auto const num_rows = 1'000'000; auto const num_cols = 50; std::vector schema; @@ -763,7 +764,7 @@ TEST_F(RowToColumnTests, Bigger) std::vector views; std::vector schema; - // 28 columns of 1 million rows + // 128 columns of 1 million rows constexpr auto num_rows = 1024 * 1024; for (int i = 0; i < 128; ++i) { cols.push_back(cudf::test::fixed_width_column_wrapper(r + num_rows * i, @@ -792,8 +793,8 @@ TEST_F(RowToColumnTests, Biggest) std::vector views; std::vector schema; - // 128 columns of 1 million rows - constexpr auto num_rows = 5 * 1024 * 1024; + // 128 columns of 2 million rows + constexpr auto num_rows = 2 * 1024 * 1024; for (int i = 0; i < 128; ++i) { cols.push_back(cudf::test::fixed_width_column_wrapper(r + num_rows * i, r + num_rows * i + num_rows)); @@ -916,6 +917,10 @@ TEST_F(RowToColumnTests, BigStrings) TEST_F(RowToColumnTests, ManyStrings) { + // The sizing of this test is very sensitive to the state of the random number generator, + // i.e., depending on the order of execution, the number of times the largest string is + // selected will lead to out-of-memory exceptions. Seeding the RNG here helps prevent that. + srand(1); char const* TEST_STRINGS[] = { "These", "are", @@ -954,7 +959,7 @@ TEST_F(RowToColumnTests, ManyStrings) "this string is the longest string because it is duplicated more than you can imagine " "this string is the longest string because it is duplicated more than you can imagine " "this string is the longest string because it is duplicated more than you can imagine " - "this string is the longest string because it is duplicated more than you can imagine " + "this string is the longest string because it is duplicated more than you can imagine ", "a", "good test", "is required to produce reasonable confidence that this is working", @@ -971,7 +976,7 @@ TEST_F(RowToColumnTests, ManyStrings) return TEST_STRINGS[rand() % (sizeof(TEST_STRINGS) / sizeof(TEST_STRINGS[0]))]; }); - auto const num_rows = 500000; + auto const num_rows = 300'000; auto const num_cols = 50; std::vector schema; @@ -1002,3 +1007,5 @@ TEST_F(RowToColumnTests, ManyStrings) CUDF_TEST_EXPECT_TABLES_EQUIVALENT(in_view[0], *new_cols); } } + +CUDF_TEST_PROGRAM_MAIN()