From 732c3cfa8f6a5419c4b377e574e1585c6c3ff4e7 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Thu, 20 Feb 2025 00:40:15 +0000 Subject: [PATCH] rocrtst: Disable RLIMIT for negative queue tests The negative queue tests generate an exception which triggers a coredump generation. Disable RLIMIT so that the coredumps are not generated for these tests. [ROCm/ROCR-Runtime commit: 4cb6a6d45db3657a9a445937acaa7f844b500160] --- .../suites/negative/queue_validation.cc | 18 ++++++++++++++++++ .../rocrtst/suites/negative/queue_validation.h | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/projects/rocr-runtime/rocrtst/suites/negative/queue_validation.cc b/projects/rocr-runtime/rocrtst/suites/negative/queue_validation.cc index 16b08e1b7e..232d12c8cf 100755 --- a/projects/rocr-runtime/rocrtst/suites/negative/queue_validation.cc +++ b/projects/rocr-runtime/rocrtst/suites/negative/queue_validation.cc @@ -123,6 +123,20 @@ void QueueValidation::SetUp(void) { TestBase::SetUp(); + /* The queue exceptions will trigger a coredump. Set the limit to 0 to disable */ + if (getrlimit(RLIMIT_CORE, &rlimit_)) { + perror("Could not get system rlimit\n"); + } else { + struct rlimit rlimit_set; + + rlimit_set.rlim_cur = 0; + rlimit_set.rlim_max = 0; + + /* Do not error if system does not allow disabling limit */ + if (setrlimit(RLIMIT_CORE, &rlimit_set)) + perror("Could not set core file size\n"); + } + err = rocrtst::SetDefaultAgents(this); ASSERT_EQ(HSA_STATUS_SUCCESS, err); @@ -159,6 +173,10 @@ void QueueValidation::DisplayResults(void) const { } void QueueValidation::Close() { + /* Restore rlimit to initial value before test - do not error if fails */ + if (setrlimit(RLIMIT_CORE, &rlimit_)) + perror("Could not set core file size\n"); + // This will close handles opened within rocrtst utility calls and call // hsa_shut_down(), so it should be done after other hsa cleanup TestBase::Close(); diff --git a/projects/rocr-runtime/rocrtst/suites/negative/queue_validation.h b/projects/rocr-runtime/rocrtst/suites/negative/queue_validation.h index 5ce9f8cf9e..2f8ae5d5de 100755 --- a/projects/rocr-runtime/rocrtst/suites/negative/queue_validation.h +++ b/projects/rocr-runtime/rocrtst/suites/negative/queue_validation.h @@ -48,6 +48,8 @@ #include "common/base_rocr.h" #include "hsa/hsa.h" #include "suites/test_common/test_base.h" +#include + class QueueValidation : public TestBase { public: @@ -93,6 +95,8 @@ class QueueValidation : public TestBase { private: + struct rlimit rlimit_; //value of rlimit before test starts + void QueueValidationForInvalidDimension(hsa_agent_t cpuAgent, hsa_agent_t gpuAgent); void QueueValidationInvalidGroupMemory(hsa_agent_t cpuAgent, hsa_agent_t gpuAgent); void QueueValidationForInvalidKernelObject(hsa_agent_t cpuAgent, hsa_agent_t gpuAgent);