-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow tracing tests to be run in parallel with other tests (#95)
* Only consider relevant test trace data in tracing tests * Allow having existing tracing sessions during tracing tests But make sure the tests do not leave tracing sessions behind. Signed-off-by: Christophe Bedard <christophe.bedard@apex.ai>
- Loading branch information
1 parent
975bf6a
commit dfeb3d1
Showing
20 changed files
with
410 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2024 Apex.AI, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef TEST_TRACETOOLS__MARK_PROCESS_HPP_ | ||
#define TEST_TRACETOOLS__MARK_PROCESS_HPP_ | ||
|
||
#include <string> | ||
|
||
namespace test_tracetools | ||
{ | ||
|
||
/// Mark process to link it to a trace test. | ||
/** | ||
* This should be called once by each test application (process) to mark the process so that it can | ||
* be linked to the trace test that spawned it. | ||
* | ||
* The process responsible for spawning the current process is responsible for setting the | ||
* `TRACETOOLS_TEST_TRACE_TEST_ID` environment variable to a unique value. | ||
* | ||
* If the `TRACETOOLS_TEST_TRACE_TEST_ID` environment variable is set and not empty, this marks the | ||
* current process by triggering an `lttng_ust_tracef:event` trace event with a `msg` field value | ||
* equal to: `"TRACETOOLS_TEST_TRACE_TEST_ID=<value of TRACETOOLS_TEST_TRACE_TEST_ID>"`. | ||
* | ||
* \see tracetools_test | ||
*/ | ||
void mark_trace_test_process(); | ||
|
||
} // namespace test_tracetools | ||
|
||
#endif // TEST_TRACETOOLS__MARK_PROCESS_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2024 Apex.AI, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef TRACETOOLS_DISABLED | ||
#include <lttng/tracef.h> | ||
|
||
#include "rcpputils/env.hpp" | ||
#endif // TRACETOOLS_DISABLED | ||
|
||
#include "test_tracetools/mark_process.hpp" | ||
|
||
namespace test_tracetools | ||
{ | ||
|
||
namespace | ||
{ | ||
|
||
/** | ||
* \see tracetools_test | ||
*/ | ||
constexpr std::string_view trace_test_id_env_var = "TRACETOOLS_TEST_TRACE_TEST_ID"; | ||
|
||
} // namespace | ||
|
||
void mark_trace_test_process() | ||
{ | ||
#ifndef TRACETOOLS_DISABLED | ||
// See tracetools_test.mark_process for more details | ||
const std::string env_var{trace_test_id_env_var}; | ||
const auto test_id = rcpputils::get_env_var(env_var.c_str()); | ||
if (!test_id.empty()) { | ||
lttng_ust__tracef("%s=%s", env_var.c_str(), test_id.c_str()); | ||
} | ||
#endif // TRACETOOLS_DISABLED | ||
} | ||
|
||
} // namespace test_tracetools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.