Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion emulation/rocjitsu/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ endif()
rj_add_gtest_tests(
rocjitsu_tests
TEST_FILTER
"-*Benchmark*:*RequestExitWakesAllPartitions*:*DispatchedWaitSurvivesAConcurrentFinalClose*"
"-*Benchmark*:*RequestExitWakesAllPartitions*:*DispatchedWaitSurvivesAConcurrentFinalClose*:*EffectiveConfigTest.ReadsNativeLaunchConfigHandoff"
)

# RequestExitWakesAllPartitions may require several runs to show regression
Expand Down Expand Up @@ -1334,6 +1334,30 @@ get_filename_component(
)
set(RJ_CLI "$<TARGET_FILE:rocjitsu_bin>")

rj_add_test(
NAME "EffectiveConfigTest.ReadsNativeLaunchConfigHandoff"
COMMAND
${RJ_CLI}
--config
${CMAKE_SOURCE_DIR}/configs/gfx942_cdna3.json
--cpu-thread-budget
4
--
$<TARGET_FILE:rocjitsu_tests>
--gtest_filter=EffectiveConfigTest.ReadsNativeLaunchConfigHandoff
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
TIMEOUT 60
INSTALL_COMMAND
"\${RJ_INSTALLED_BINDIR}/rocjitsu"
"--config"
"\${RJ_INSTALLED_CONFIG_DIR}/gfx942_cdna3.json"
"--cpu-thread-budget"
"4"
"--"
"bin/rocjitsu_tests"
"--gtest_filter=EffectiveConfigTest.ReadsNativeLaunchConfigHandoff"
)

function(rj_detect_kfd_gfx_target_versions out_var)
set(_versions)
foreach(
Expand Down
28 changes: 28 additions & 0 deletions emulation/rocjitsu/tests/config_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1233,6 +1233,34 @@ TEST(EffectiveConfigTest, ReportsAnUnwritableRuntimeDirectory) {
std::runtime_error);
}

// This case is registered as a native CLI test because it expects the launcher
// to have created the invocation handoff before this child process starts.
TEST(EffectiveConfigTest, ReadsNativeLaunchConfigHandoff) {
const char *invocation_dir = std::getenv(rocjitsu::kRpcInvocationDirEnv);
ASSERT_NE(invocation_dir, nullptr);
ASSERT_NE(*invocation_dir, '\0');

const std::filesystem::path invocation_path(invocation_dir);
std::ifstream handoff(invocation_path / "config_path");
ASSERT_TRUE(handoff.is_open());

std::string effective_path;
ASSERT_TRUE(std::getline(handoff, effective_path));
ASSERT_FALSE(effective_path.empty());

EXPECT_EQ(std::filesystem::absolute(effective_path).lexically_normal(),
(invocation_path / config::kEffectiveConfigName).lexically_normal());
ASSERT_TRUE(std::filesystem::exists(effective_path));

const std::string source_path = test::config_path("gfx942_cdna3.json");
const std::string source_before = config::read_config_file(source_path);
const auto settings =
config::load_execution_thread_settings(effective_path, rocjitsu::kEmbeddedSchema);

EXPECT_EQ(settings.request.budget, 4u);
EXPECT_EQ(config::read_config_file(source_path), source_before);
}

TEST(ConfigLoaderTest, RejectsUnresolvedAutomaticDbtHandoffWrite) {
const test::ScopedTempDirectory runtime("rocjitsu-runtime-config-unresolved-");
test::ScopedEnvironmentVariable runtime_dir("ROCJITSU_RUNTIME_DIR", runtime.path());
Expand Down
Loading