diff options
-rw-r--r-- | yaksh/evaluator_tests/test_bash_evaluation.py | 5 | ||||
-rw-r--r-- | yaksh/evaluator_tests/test_c_cpp_evaluation.py | 5 | ||||
-rw-r--r-- | yaksh/evaluator_tests/test_java_evaluation.py | 5 | ||||
-rw-r--r-- | yaksh/hook_evaluator.py | 5 |
4 files changed, 17 insertions, 3 deletions
diff --git a/yaksh/evaluator_tests/test_bash_evaluation.py b/yaksh/evaluator_tests/test_bash_evaluation.py index ee6949d..352e95f 100644 --- a/yaksh/evaluator_tests/test_bash_evaluation.py +++ b/yaksh/evaluator_tests/test_bash_evaluation.py @@ -536,6 +536,11 @@ class BashHookEvaluationTestCases(EvaluatorBaseTest): # Then self.assertFalse(result.get('success')) self.assert_correct_output(self.timeout_msg, result.get('error')) + parent_proc = Process(os.getpid()).children() + if parent_proc: + self.assertFalse(any(Process(parent_proc[0].pid)\ + .children(recursive=True))) + if __name__ == '__main__': diff --git a/yaksh/evaluator_tests/test_c_cpp_evaluation.py b/yaksh/evaluator_tests/test_c_cpp_evaluation.py index d3147f5..79227f5 100644 --- a/yaksh/evaluator_tests/test_c_cpp_evaluation.py +++ b/yaksh/evaluator_tests/test_c_cpp_evaluation.py @@ -977,7 +977,10 @@ class CppHookEvaluationTestCases(EvaluatorBaseTest): # Then self.assertFalse(result.get('success')) self.assert_correct_output(self.timeout_msg, result.get('error')) - + parent_proc = Process(os.getpid()).children() + if parent_proc: + self.assertFalse(any(Process(parent_proc[0].pid)\ + .children(recursive=True))) if __name__ == '__main__': unittest.main() diff --git a/yaksh/evaluator_tests/test_java_evaluation.py b/yaksh/evaluator_tests/test_java_evaluation.py index 2c49a50..39c5ee9 100644 --- a/yaksh/evaluator_tests/test_java_evaluation.py +++ b/yaksh/evaluator_tests/test_java_evaluation.py @@ -844,8 +844,13 @@ class JavaHookEvaluationTestCases(EvaluatorBaseTest): result = grader.evaluate(kwargs) # Then + self.assertFalse(result.get('success')) self.assert_correct_output(self.timeout_msg, result.get('error')) + parent_proc = Process(os.getpid()).children() + if parent_proc: + self.assertFalse(any(Process(parent_proc[0].pid)\ + .children(recursive=True))) if __name__ == '__main__': diff --git a/yaksh/hook_evaluator.py b/yaksh/hook_evaluator.py index b86640c..f5364d6 100644 --- a/yaksh/hook_evaluator.py +++ b/yaksh/hook_evaluator.py @@ -2,13 +2,14 @@ import sys import traceback import os +import signal +import psutil # Local imports from .file_utils import copy_files, delete_files from .base_evaluator import BaseEvaluator from .grader import TimeoutException -import signal -import psutil + class HookEvaluator(BaseEvaluator): def __init__(self, metadata, test_case_data): |