Operating Sytem Write C unflake program

Write an unflake program that will rerun a test if it fails the first time (or the 2nd time or 3rd time …). you also need to keep track of stdout and stderr in a single file from the tests, so you need to log them to a file. once the program completes, you need to print how many times the program ran, the exit code or signal that killed the program, and print the program output. the exit code of unflake must match the exit code of the last run. if the last run will killed with a signal, unflake should have an exit code of 255.

the flaky tests sometimes hang, so if a timeout is exceeded, you need to force the running test to stop.

specification

unflake max_tries max_timeout test_command args…

max_tries – is the maximum amount of times you will try rerunning the test before giving up.

max_timeout – the maximum allowed time for a test to run

test_command – the command you will be running for the test

args – any arguments the test may take

when unflake finishes the current directory will contain files of the form: test_output.X where X is the try number (starting at 1). this file will contain both the stdout and stderr of the test run.

when unflake finishes, it will dump the information about the run and contents of the last run to the screen and exit with a return code of the last run.

make sure you match the format exactly. extra spaces or incorrect capitalization will cause you to lose points. make sure you don’t have any extra print statements and that each line ends in a linefeed (‘\n’). make sure your files are also named correctly with lower case letters.

SAMPLE ASSIGNMENT

Sample-2

Powered by WordPress