Repository navigation
hip-tests: write contract test artifacts to the temp dir, not cwd #11734
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
658ccdc
hip-tests: write contract test artifacts to the temp dir, not cwd
iassiour eedf5a9
Merge branch 'develop' of https://github.com/ROCm/rocm-systems into u…
iassiour f958679
hip-tests: move IPC socket paths to the temp dir and simplify artifac…
iassiour e8ba70c
hip-tests: report over-long IPC socket paths without perror
iassiour dc43f30
hip-tests: release socket and handle on IPC setup failure paths
iassiour c1eb0ac
hip-tests: share the IPC socket naming between mempool and VMM
iassiour d489de8
hip-tests: narrow this PR to the contract test artifacts
iassiour 152f562
hip-tests: name contract artifacts with a random suffix, not the pid
iassiour d6a8994
hip-tests: share the temp artifact naming and seed it with the pid
iassiour aa99e14
hip-tests: trim the temp path comments
iassiour File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,45 @@ | ||
| /* | ||
| * Copyright (c) Advanced Micro Devices, Inc., or its affiliates. | ||
| * | ||
| * SPDX-License-Identifier: MIT | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "hip_test_filesystem.hh" | ||
|
|
||
| #include <cstdint> | ||
| #include <cstdio> | ||
| #include <random> | ||
| #include <string> | ||
|
|
||
| #ifdef _WIN32 | ||
| #include <process.h> | ||
| #define HIP_TEST_GETPID _getpid | ||
| #else | ||
| #include <unistd.h> | ||
| #define HIP_TEST_GETPID getpid | ||
| #endif | ||
|
|
||
| // Naming for temporary test artifacts. The temp directory is shared, so names | ||
| // must be unguessable: a predictable path can be pre-seeded with a symlink. | ||
| namespace hip_test { | ||
|
|
||
| // 64 bits from std::random_device as 16 hex chars. The pid keeps the name | ||
| // unique if random_device degenerates to a fixed sequence, which the standard | ||
| // permits; live pids in a namespace are distinct, clock readings are not. | ||
| inline std::string RandomTag() { | ||
| std::random_device dev; | ||
| uint64_t value = (static_cast<uint64_t>(dev()) << 32) ^ dev(); | ||
| value ^= static_cast<uint64_t>(HIP_TEST_GETPID()); | ||
| char buf[17]; | ||
| snprintf(buf, sizeof(buf), "%016llx", static_cast<unsigned long long>(value)); | ||
| return std::string(buf); | ||
| } | ||
|
|
||
| // <temp dir>/<stem>-<tag><extension>. | ||
| inline std::string TempPath(const std::string& stem, const std::string& extension) { | ||
| return (fs::temp_directory_path() / (stem + "-" + RandomTag() + extension)).string(); | ||
| } | ||
|
|
||
| } // namespace hip_test | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.