X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftest-harness.cpp;h=4237327f5dd7a9c417f054c6d856107df9a26308;hb=HEAD;hp=86874fd2a85fb77ef9e66fa6547bca372405ffc9;hpb=7562b511d06c8a8157883e35308aaa65e4e10810;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-harness.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-harness.cpp index 86874fd..4237327 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-harness.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-harness.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -122,6 +122,18 @@ std::string TestModuleName(const char* processName) return oss.str(); } +std::string GetWChan(int pid) +{ + std::ostringstream procwchan; + procwchan << "/proc/" << pid << "/wchan"; + std::ifstream ifs; + ifs.open(procwchan.str(), std::ifstream::in); + std::string line; + std::getline(ifs, line); + ifs.close(); + return line; +} + std::string ReadAndEscape(std::string filename) { std::ostringstream os; @@ -496,11 +508,21 @@ int32_t RunAllInParallel(const char* processName, ::testcase tc_array[], std::st for(auto& tc : children) { std::chrono::steady_clock::duration timeSpan = endTime - tc.second.startTime; - std::chrono::duration seconds = std::chrono::duration_cast>(timeSpan); - if(seconds.count() > MAXIMUM_CHILD_LIFETIME) + double seconds = double(timeSpan.count()) * std::chrono::steady_clock::period::num / std::chrono::steady_clock::period::den; + + if(4.9999 < seconds && seconds < 5 && !tc.second.finished) + { + printf("Child process %s is delayed: WCHAN:%s\n", tc.second.name, GetWChan(tc.first).c_str()); + } + else if(seconds > MAXIMUM_CHILD_LIFETIME) { // Kill the child process. A subsequent call to waitpid will process signal result below. - kill(tc.first, SIGKILL); + if(!tc.second.finished) + { + printf("Child process %s WCHAN:%s\n", tc.second.name, GetWChan(tc.first).c_str()); + kill(tc.first, SIGKILL); + tc.second.finished = true; // Only send kill signal once. + } } } } @@ -513,8 +535,9 @@ int32_t RunAllInParallel(const char* processName, ::testcase tc_array[], std::st { if(WIFEXITED(status)) { - auto& testCase = children[childPid]; - testCase.result = WEXITSTATUS(status); + auto& testCase = children[childPid]; + testCase.result = WEXITSTATUS(status); + testCase.finished = true; if(testCase.result) { printf("Test case %s failed: %d\n", testCase.name, testCase.result); @@ -535,6 +558,7 @@ int32_t RunAllInParallel(const char* processName, ::testcase tc_array[], std::st RunningTestCases::iterator iter = children.find(childPid); if(iter != children.end()) { + iter->second.finished = true; printf("Test case %s exited with signal %s\n", iter->second.name, strsignal(status)); iter->second.result = 1; failedTestCases.push_back(iter->second.testCase);