<div dir="ltr"><div>From: Yicheng Qin &lt;<a href="mailto:yichengq@google.com">yichengq@google.com</a>&gt;</div><div>Subject: [PATCH] test: adjust the output for tests</div><div><br></div><div>Adjust the format of information printed.</div>
<div>Print out more necessary debug information.</div><div>Display error message in STDERR and make it more readable.</div><div><br></div><div>Signed-off-by: Yicheng Qin &lt;<a href="mailto:yichengq@google.com">yichengq@google.com</a>&gt;</div>
<div>---</div><div> test/tcp/run.sh | 10 ++++++++--</div><div> test/zdtm.sh    | 34 +++++++++++++++++++++++++++-------</div><div> 2 files changed, 35 insertions(+), 9 deletions(-)</div><div><br></div><div>diff --git a/test/tcp/run.sh b/test/tcp/run.sh</div>
<div>index 0dd0e70..873c7d1 100644</div><div>--- a/test/tcp/run.sh</div><div>+++ b/test/tcp/run.sh</div><div>@@ -34,12 +34,16 @@ echo &quot;Make it run&quot;</div><div> echo &quot;${TEXT}&quot; &gt;&amp;3</div><div> </div>
<div> function fail {</div><div>-<span class="" style="white-space:pre">        </span>echo &quot;$@&quot;</div><div>+<span class="" style="white-space:pre">        </span>echo &quot;$@&quot; &gt;&amp;2</div><div> <span class="" style="white-space:pre">        </span>kill -9 ${CLN_PID}</div>
<div> <span class="" style="white-space:pre">        </span>kill -9 ${SRV_PID}</div><div>+<span class="" style="white-space:pre">        </span>echo ${CLN_LOG}: &gt;&amp;2</div><div>+<span class="" style="white-space:pre">        </span>cat ${CLN_LOG} &gt;&amp;2</div>
<div> <span class="" style="white-space:pre">        </span>exit 1</div><div> }</div><div> </div><div>+kill -s 0 ${CLN_PID} || fail &quot;Client is dead&quot;</div><div>+</div><div> echo &quot;Suspend server&quot;</div><div> ${CRIU} dump -D ${DDIR} -o dump.log -t ${SRV_PID} --tcp-established -vvvv || fail &quot;Fail to dump server&quot;</div>
<div> sleep 1</div><div>@@ -51,5 +55,7 @@ echo &quot;${TEXT}&quot; &gt;&amp;3</div><div> </div><div> echo &quot;Collect results&quot;</div><div> exec 3&gt;&amp;-</div><div>-wait ${CLN_PID}</div><div>+wait ${CLN_PID} || fail &quot;Client exits abruptly&quot;</div>
<div> kill -9 ${SRV_PID}</div><div>+</div><div>+echo PASS</div><div>diff --git a/test/zdtm.sh b/test/zdtm.sh</div><div>index 9e72fa3..5b064f7 100755</div><div>--- a/test/zdtm.sh</div><div>+++ b/test/zdtm.sh</div><div>@@ -179,6 +179,10 @@ check_mainstream()</div>
<div> <span class="" style="white-space:pre">        </span>local -a ver_arr</div><div> <span class="" style="white-space:pre">        </span>local ver_str=`uname -r`</div><div> </div><div>+<span class="" style="white-space:pre">        </span>cat &gt;&amp;2 &lt;&lt;EOF</div>
<div>+========================== CRIU CHECK =============================</div><div>+EOF</div><div>+</div><div> <span class="" style="white-space:pre">        </span>$CRIU check &amp;&amp; return 0</div><div> <span class="" style="white-space:pre">        </span>MAINSTREAM_KERNEL=1</div>
<div> </div><div>@@ -262,6 +266,8 @@ export MAKEFLAGS=--no-print-directory</div><div> </div><div> start_test()</div><div> {</div><div>+<span class="" style="white-space:pre">        </span>echo Start test $2 at $(date)</div><div>
+</div><div> <span class="" style="white-space:pre">        </span>local tdir=$1</div><div> <span class="" style="white-space:pre">        </span>local tname=$2</div><div> <span class="" style="white-space:pre">        </span>export ZDTM_ROOT</div>
<div>@@ -500,6 +506,7 @@ EOF</div><div> <span class="" style="white-space:pre">        </span>cat $test.out</div><div> <span class="" style="white-space:pre">        </span>cat $test.out | grep -q PASS || return 2</div><div> <span class="" style="white-space:pre">        </span>[ &quot;$CLEANUP&quot; -ne 0 ] &amp;&amp; rm -rf `dirname $ddump`</div>
<div>+<span class="" style="white-space:pre">        </span>echo &quot;Test: $test, Result: PASS&quot;</div><div> <span class="" style="white-space:pre">        </span>return 0</div><div> }</div><div> </div><div>@@ -510,23 +517,36 @@ case_error()</div>
<div> </div><div> <span class="" style="white-space:pre">        </span>ZDTM_FAILED=1</div><div> </div><div>-<span class="" style="white-space:pre">        </span>echo &quot;Test: $test&quot;</div><div>-<span class="" style="white-space:pre">        </span>echo &quot;====================== ERROR ======================&quot;</div>
<div>+<span class="" style="white-space:pre">        </span>echo &quot;Test: $test, Result: FAIL&quot;</div><div>+<span class="" style="white-space:pre">        </span>echo &quot;====================== ERROR ======================&quot; &gt;&amp;2</div>
<div>+<span class="" style="white-space:pre">        </span>echo &quot;Test: $test, Namespace: ${PIDNS}&quot; &gt;&amp;2</div><div> </div><div> <span class="" style="white-space:pre">        </span>if [ -n &quot;$DUMP_PATH&quot; ]; then</div>
<div> <span class="" style="white-space:pre">                </span>[ -e &quot;$DUMP_PATH/dump.log&quot; ] &amp;&amp; {</div><div>-<span class="" style="white-space:pre">                        </span>echo &quot;Dump log   : $DUMP_PATH/dump.log&quot;</div>
<div>-<span class="" style="white-space:pre">                        </span>cat $DUMP_PATH/dump.log* | grep Error</div><div>+<span class="" style="white-space:pre">                        </span>echo &quot;Dump log   : $DUMP_PATH/dump.log&quot; &gt;&amp;2</div><div>
+<span class="" style="white-space:pre">                        </span>cat $DUMP_PATH/dump.log* | grep Error &gt;&amp;2</div><div>+<span class="" style="white-space:pre">                        </span>echo &quot;* * * * * * * * * * * * * * *&quot; &gt;&amp;2</div>
<div>+<span class="" style="white-space:pre">                        </span>tail -n 40 $DUMP_PATH/dump.log* &gt;&amp;2</div><div>+<span class="" style="white-space:pre">                        </span>echo &quot;*****************************&quot; &gt;&amp;2</div>
<div> <span class="" style="white-space:pre">                </span>}</div><div> <span class="" style="white-space:pre">                </span>[ -e &quot;$DUMP_PATH/restore.log&quot; ] &amp;&amp; {</div><div>-<span class="" style="white-space:pre">                        </span>echo &quot;Restore log: $DUMP_PATH/restore.log&quot;</div>
<div>-<span class="" style="white-space:pre">                        </span>cat $DUMP_PATH/restore.log* | grep Error</div><div>+<span class="" style="white-space:pre">                        </span>echo &quot;Restore log: $DUMP_PATH/restore.log&quot; &gt;&amp;2</div>
<div>+<span class="" style="white-space:pre">                        </span>cat $DUMP_PATH/restore.log* | grep Error &gt;&amp;2</div><div>+<span class="" style="white-space:pre">                        </span>echo &quot;* * * * * * * * * * * * * * *&quot; &gt;&amp;2</div>
<div>+<span class="" style="white-space:pre">                        </span>tail -n 40 $DUMP_PATH/restore.log* &gt;&amp;2</div><div>+<span class="" style="white-space:pre">                        </span>echo &quot;*****************************&quot; &gt;&amp;2</div>
<div> <span class="" style="white-space:pre">                </span>}</div><div> <span class="" style="white-space:pre">        </span>fi</div><div> <span class="" style="white-space:pre">        </span>[ -e &quot;$test_log&quot; ] &amp;&amp;</div><div>
-<span class="" style="white-space:pre">                </span>echo &quot;Output file: $test_log&quot;</div><div>+<span class="" style="white-space:pre">                </span>echo &quot;Output file: $test_log&quot; &gt;&amp;2</div><div>+<span class="" style="white-space:pre">                </span>cat $test_log* &gt;&amp;2</div>
<div>+<span class="" style="white-space:pre">                </span>echo &quot;*****************************&quot; &gt;&amp;2</div><div>+</div><div> <span class="" style="white-space:pre">        </span>[ -n &quot;$HEAD&quot; ] &amp;&amp;</div>
<div> <span class="" style="white-space:pre">                </span>echo &quot;The initial HEAD was $HEAD&quot;</div><div>+</div><div>+<span class="" style="white-space:pre">        </span>echo &quot;==================== ERROR OVER ====================&quot; &gt;&amp;2</div>
<div>+</div><div> <span class="" style="white-space:pre">        </span>exit 1</div><div> }</div><div> </div><div>-- </div><div>1.8.3</div><div><br></div></div>