pynguin icon indicating copy to clipboard operation
pynguin copied to clipboard

pynguin takes long time even when specifying timeout options

Open exKAZUu opened this issue 2 years ago • 1 comments

Describe the bug When pynguin generates test cases for a program that may occur an infinite loop, pynguin takes long time (even when specifying timeout options).

To Reproduce

  1. Create loop.py with the following content:
def func(n: int):
    while n == 0:
        pass
    return n
  1. Run pynguin with the following command: PYNGUIN_DANGER_AWARE=1 pynguin --project-path . --output-path output --module-name loop --maximum-search-time 1 --maximum-slicing-time 1 --maximum-test-execution-timeout 1 --maximum-test-execution-timeout 1 --test-execution-time-per-statement 1 --max-size 1 --max-length-test-case 1 --max-int 10 --assertion_generation SIMPLE --algorithm MOSA
  2. pynguin takes about 30 seconds

Expected behavior I can imagine there are various mandatory processes where it is difficult to limit execution times, but, I'd like pynguin stop until 5 seconds when specifying the above options.

Screenshots image

Software Version:

  • OS: macOS
  • Python: 3.10.9
  • Poetry: 1.4.0
  • Pynguin: 0.33.0

exKAZUu avatar Jul 11 '23 02:07 exKAZUu

Dear @exKAZUu ,

Thank you for your interest in Pynguin and reporting this bug. I agree that this is definitely a bug and a behaviour that should be fixed. The problem seems to be in the execution, where one of the generated inputs triggers an infinite loop. The thread used for execution is then killed, which causes the RuntimeError.

Unfortunately, I am very busy with other things, thus I cannot promise when I can work on a fix for this. I'll keep this bug open and refer to it whenever I find the time.

stephanlukasczyk avatar Jul 11 '23 07:07 stephanlukasczyk