Closed Hanseltu closed 4 years ago
hello, this is not hard to to. first, you should run gcc under the "timeout" command, or something like it: https://www.howtogeek.com/423286/how-to-use-the-timeout-command-on-linux/ second, you need to inspect the exit code and if it is the one corresponding to a timeout, return 0 from the interestingness test. you will find that reductions like this are very slow, but they mostly work. the "mostly" part is because your machine will not deterministically time out when the execution time of the partially reduced program becomes very close to the timeout value.
Hi, Regehr.
Thanks for your guidance. I think I can handle this now.
Here is an example script to reduce a CPP code. Hope to help someone with the same issue.
#!/bin/bash
timeout 5 g++ small.cc >& /dev/null
n=`echo $?`
if [ $n == 124 ]
then
exit 0
else
exit 1
fi
I just close this, thanks again :)
great! this script looks like what I would have written
Hi, all.
I am doing a compiler testing work recently and encountered some code that let GCC compiles a long time.
I want to reduce this special case using C-Reduce. I am pretty sure C-Reduce can do this, but I can't work it out for my knowledge limit.
Can anyone help me out how to write an interesting timeout script? Thank you very much.
Best Haoxin