<div dir="ltr">I doubt whether I need to umount and remove ZDTM_ROOT.<div><br></div><div>ZDTM_ROOT is mounted when calling start_test() at the first time, and is unmounted at exit_callback() when the script is over. So it is only mounted once in all.</div>
<div><br></div><div>In batch-test mode, when some test failed, we just want to cleanup its related resources. Based on the fact that ZDTM_TEST could be used still, I think I should reserve it.</div><div><br></div><div>After consideration, it seems that %.cleanout is unnecessary and may delete some import debug info. I will delete that one.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 13, 2013 at 8:34 AM, Andrew Vagin <span dir="ltr">&lt;<a href="mailto:avagin@parallels.com" target="_blank">avagin@parallels.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, Aug 13, 2013 at 08:20:32AM -0700, Yicheng Qin wrote:<br>
&gt; It is set in case_error().<br>
&gt; Whenever it calls case_error, ZDTM_FAILED will be set to 1.<br>
<br>
</div>Ok. It&#39;s my fault. I thought that this patch adds ZDTM_FAILED.<br>
<div class="HOEnZb"><div class="h5"><br>
&gt;<br>
&gt; It is a variable that has been in the script. The call of it is as follows in<br>
&gt; exit_callback():<br>
&gt;<br>
&gt;<br>
&gt; [[ -n &quot;$ZDTM_FAILED&quot; &amp;&amp; -n &quot;$DUMP_ARCHIVE&quot; ]] &amp;&amp; tar -czf $DUMP_ARCHIVE dump<br>
&gt;<br>
&gt;<br>
&gt; I think it is definitely used to indicate whether zdtm tests failed or not.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Aug 13, 2013 at 2:38 AM, Andrew Vagin &lt;<a href="mailto:avagin@parallels.com">avagin@parallels.com</a>&gt; wrote:<br>
&gt;<br>
&gt;     On Tue, Aug 13, 2013 at 01:34:02AM -0700, Yicheng Qin wrote:<br>
&gt;     &gt; In batch-test mode, the script skips failed individual tests<br>
&gt;     &gt; instead of exiting. This ensures that all zdtm tests can be run<br>
&gt;     &gt; in one pass, which provides better overview of test result.<br>
&gt;     &gt;<br>
&gt;     &gt; Signed-off-by: Yicheng Qin &lt;<a href="mailto:yichengq@google.com">yichengq@google.com</a>&gt;<br>
&gt;     &gt; ---<br>
&gt;     &gt; Changelog since v1:<br>
&gt;     &gt; - add option -n<br>
&gt;     &gt;<br>
&gt;     &gt;  test/zdtm.sh | 34 +++++++++++++++++++++++++++++++---<br>
&gt;     &gt;  1 file changed, 31 insertions(+), 3 deletions(-)<br>
&gt;     &gt;<br>
&gt;     &gt; diff --git a/test/zdtm.sh b/test/zdtm.sh<br>
&gt;     &gt; index 8881b3a..2ca48f5 100755<br>
&gt;     &gt; --- a/test/zdtm.sh<br>
&gt;     &gt; +++ b/test/zdtm.sh<br>
&gt;     &gt; @@ -168,6 +168,7 @@ PAGE_SERVER=0<br>
&gt;     &gt;  PS_PORT=12345<br>
&gt;     &gt;  TCPDUMP_PID=<br>
&gt;     &gt;  COMPILE_ONLY=0<br>
&gt;     &gt; +BATCH_TEST=0<br>
&gt;     &gt;<br>
&gt;     &gt;  check_criu()<br>
&gt;     &gt;  {<br>
&gt;     &gt; @@ -439,7 +440,11 @@ EOF<br>
&gt;     &gt;               # with some error code, or checkpoint is complete but<br>
&gt;     return<br>
&gt;     &gt;               # code is non-zero because of post dump action.<br>
&gt;     &gt;               if [ &quot;$retcode&quot; -ne 0 ] &amp;&amp; [[ &quot;$retcode&quot; -ne 32 || -z<br>
&gt;     &quot;$dump_only&quot; ]]; then<br>
&gt;     &gt; -                     echo WARNING: $tname returned $retcode and left<br>
&gt;     running for debug needs<br>
&gt;     &gt; +                     if [ $BATCH_TEST -eq 0 ]; then<br>
&gt;     &gt; +                             echo WARNING: $tname returned $retcode and<br>
&gt;     left running for debug needs<br>
&gt;     &gt; +                     else<br>
&gt;     &gt; +                             echo WARNING: $tname failed and returned<br>
&gt;     $retcode<br>
&gt;     &gt; +                     fi<br>
&gt;     &gt;                       return 1<br>
&gt;     &gt;               fi<br>
&gt;     &gt;<br>
&gt;     &gt; @@ -556,7 +561,15 @@ case_error()<br>
&gt;     &gt;<br>
&gt;     &gt;       echo &quot;==================== ERROR OVER ====================&quot;<br>
&gt;     &gt;  )<br>
&gt;     &gt; -     exit 1<br>
&gt;     &gt; +     if [ $BATCH_TEST -eq 0 ]; then<br>
&gt;     &gt; +             exit 1<br>
&gt;     &gt; +     else<br>
&gt;     &gt; +             # cleanout failed test to prepare for next one<br>
&gt;     &gt; +             local tname=`basename $test`<br>
&gt;     &gt; +             local tdir=`dirname $test`<br>
&gt;     &gt; +             killall -9 $tname &gt; /dev/null 2&gt;&amp;1<br>
&gt;     &gt; +             make -C $tdir $tname.cleanout<br>
&gt;     &gt; +     fi<br>
&gt;     &gt;  }<br>
&gt;     &gt;<br>
&gt;     &gt;  checkout()<br>
&gt;     &gt; @@ -635,6 +648,11 @@ while :; do<br>
&gt;     &gt;               shift<br>
&gt;     &gt;               continue<br>
&gt;     &gt;       fi<br>
&gt;     &gt; +     if [ &quot;$1&quot; = &quot;-n&quot; ]; then<br>
&gt;     &gt; +             BATCH_TEST=1<br>
&gt;     &gt; +             shift<br>
&gt;     &gt; +             continue<br>
&gt;     &gt; +     fi<br>
&gt;     &gt;       break;<br>
&gt;     &gt;  done<br>
&gt;     &gt;<br>
&gt;     &gt; @@ -661,6 +679,7 @@ Options:<br>
&gt;     &gt;       -t : mount tmpfs for dump files<br>
&gt;     &gt;       -a &lt;FILE&gt;.tar.gz : save archive with dump files and logs<br>
&gt;     &gt;       -g : Generate executables only<br>
&gt;     &gt; +     -n : Batch test<br>
&gt;     &gt;  EOF<br>
&gt;     &gt;  elif [ &quot;${1:0:1}&quot; = &#39;-&#39; ]; then<br>
&gt;     &gt;       echo &quot;unrecognized option $1&quot;<br>
&gt;     &gt; @@ -688,6 +707,15 @@ else<br>
&gt;     &gt;       for t in $(echo &quot;$IPC_TEST_LIST&quot; | grep -x &quot;$pattern&quot;); do<br>
&gt;     &gt;               run_test $t -n ipc || case_error $t<br>
&gt;     &gt;       done<br>
&gt;     &gt; +<br>
&gt;     &gt; +     if [ $COMPILE_ONLY -eq 0 ]; then<br>
&gt;     &gt; +             if [ -n &quot;$ZDTM_FAILED&quot; ]; then<br>
&gt;<br>
&gt;     where is ZDTM_FAILED set?<br>
&gt;<br>
&gt;     &gt; +                     echo ZDTM tests FAIL.<br>
&gt;     &gt; +             else<br>
&gt;     &gt; +                     echo ZDTM tests PASS.<br>
&gt;     &gt; +             fi<br>
&gt;     &gt; +     fi<br>
&gt;     &gt;  fi<br>
&gt;     &gt;<br>
&gt;     &gt; -[ -n &quot;$TMP_TREE&quot; ] &amp;&amp; rm -rf $TMP_TREE || exit 0<br>
&gt;     &gt; +[ -n &quot;$TMP_TREE&quot; ] &amp;&amp; rm -rf $TMP_TREE<br>
&gt;     &gt; +[ -n &quot;$ZDTM_FAILED&quot; ] &amp;&amp; exit 1<br>
&gt;     &gt; --<br>
&gt;     &gt; 1.8.3<br>
&gt;     &gt;<br>
&gt;     &gt; _______________________________________________<br>
&gt;     &gt; CRIU mailing list<br>
&gt;     &gt; <a href="mailto:CRIU@openvz.org">CRIU@openvz.org</a><br>
&gt;     &gt; <a href="https://lists.openvz.org/mailman/listinfo/criu" target="_blank">https://lists.openvz.org/mailman/listinfo/criu</a><br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br></div>