I've got a series of cpp source file and I want to write another program to JUDGE if they can run correctly (give input and compare their output with standart output) . so how to:
- call/spawn another program, and give a file to be its standard input
- limit the time and memory of the child process (maybe setrlimit thing? is there any examples?)
- donot let the process to read/write any file
- use a file to be its standard output
- compare the output with the standard output.
I think the 2nd and 3rd are the core part of this prob. Is there any way to do this?
ps. system is Linux
./program <input.txt >output.txt; if cmp output.txt known-good.txt; then echo "yay"; fiulimitfor how to limit resource consumption.