<div dir="ltr"><div>From: Yicheng Qin <<a href="mailto:yichengq@google.com">yichengq@google.com</a>></div><div>Subject: [PATCH] test/zdtm: add -g option to generate binary only</div><div><br></div><div>Add -g option in zdtm.sh.</div>
<div><br></div><div>Using -g option can just generate binaries of all</div><div>tests to run in zdtm. Moreover, appending test name after</div><div>-g option can just generate the binary for the test.</div><div><br></div>
<div>Signed-off-by: Yicheng Qin <<a href="mailto:yichengq@google.com">yichengq@google.com</a>></div><div>---</div><div> test/zdtm.sh | 29 +++++++++++++++++++++++++++--</div><div> 1 file changed, 27 insertions(+), 2 deletions(-)</div>
<div><br></div><div>diff --git a/test/zdtm.sh b/test/zdtm.sh</div><div>index f640cd7..9e72fa3 100755</div><div>--- a/test/zdtm.sh</div><div>+++ b/test/zdtm.sh</div><div>@@ -156,10 +156,11 @@ TMP_TREE=""</div><div>
SCRIPTDIR=`dirname $CRIU`/test</div><div> POSTDUMP="--action-script $SCRIPTDIR/post-dump.sh"</div><div> </div><div>-test -x $CRIU || {</div><div>+# it doesn't need criu binary for compiling test programs</div>
<div>+if [[ "$1" != "-g" && ! -x $CRIU ]]; then</div><div> <span class="" style="white-space:pre">        </span>echo "$CRIU is unavailable"</div><div> <span class="" style="white-space:pre">        </span>exit 1</div>
<div>-}</div><div>+fi</div><div> </div><div> ARGS=""</div><div> </div><div>@@ -538,6 +539,19 @@ checkout()</div><div> <span class="" style="white-space:pre">        </span>make -C $TMP_TREE -j 32</div><div> }</div><div>
</div><div>+compile_test()</div><div>+{</div><div>+<span class="" style="white-space:pre">        </span>local test=$1</div><div>+</div><div>+<span class="" style="white-space:pre">        </span>test=${ZP}/${test#ns/}</div><div>+<span class="" style="white-space:pre">        </span>local tname=`basename $test`</div>
<div>+<span class="" style="white-space:pre">        </span>local tdir=`dirname $test`</div><div>+</div><div>+<span class="" style="white-space:pre">        </span>echo "Compile $test"</div><div>+</div><div>+<span class="" style="white-space:pre">        </span>make -C $tdir $tname || return 1</div>
<div>+}</div><div>+</div><div> cd `dirname $0` || exit 1</div><div> </div><div> while :; do</div><div>@@ -621,6 +635,16 @@ if [ $# -eq 0 ]; then</div><div> <span class="" style="white-space:pre">        </span>done</div><div> elif [ "$1" = "-l" ]; then</div>
<div> <span class="" style="white-space:pre">        </span>echo $TEST_LIST $UTS_TEST_LIST $MNT_TEST_LIST $IPC_TEST_LIST | tr ' ' '\n'</div><div>+elif [ "$1" = "-g" ]; then</div><div>+<span class="" style="white-space:pre">        </span>shift</div>
<div>+<span class="" style="white-space:pre">        </span>if [ $# -eq 0 ]; then</div><div>+<span class="" style="white-space:pre">                </span>for t in $TEST_LIST $UTS_TEST_LIST \</div><div>+<span class="" style="white-space:pre">                        </span>$MNT_TEST_LIST $IPC_TEST_LIST; do</div>
<div>+<span class="" style="white-space:pre">                        </span>compile_test $t || case_error $t</div><div>+<span class="" style="white-space:pre">                </span>done</div><div>+<span class="" style="white-space:pre">        </span>else</div><div>
+<span class="" style="white-space:pre">                </span>compile_test $1 || case_error $1</div><div>+<span class="" style="white-space:pre">        </span>fi</div><div> elif [ "$1" = "-h" ]; then</div><div> <span class="" style="white-space:pre">        </span>cat >&2 <<EOF</div>
<div> This script is used for executing unit tests.</div><div>@@ -637,6 +661,7 @@ Options:</div><div> <span class="" style="white-space:pre">        </span>-x <PATTERN>: Exclude pattern</div><div> <span class="" style="white-space:pre">        </span>-t : mount tmpfs for dump files</div>
<div> <span class="" style="white-space:pre">        </span>-a <FILE>.tar.gz : save archive with dump files and logs</div><div>+<span class="" style="white-space:pre">        </span>-g : Generate executables only</div><div> EOF</div>
<div> elif [ "${1:0:1}" = '-' ]; then</div><div> <span class="" style="white-space:pre">        </span>echo "unrecognized option $1"</div><div>-- </div><div>1.8.3</div><div><br></div></div>