<div dir="ltr"><div>From: Yicheng Qin <<a href="mailto:yichengq@google.com">yichengq@google.com</a>></div><div>Subject: [PATCH] test/zdtm: add -n option to run in-namespace tests only</div><div><br></div><div>Support -n option in zdtm, which means that only in-namespace tests</div>
<div>will be run.</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 | 12 ++++++++++++</div><div> 1 file changed, 12 insertions(+)</div>
<div><br></div><div>diff --git a/test/zdtm.sh b/test/zdtm.sh</div><div>index 5b064f7..6db2bf0 100755</div><div>--- a/test/zdtm.sh</div><div>+++ b/test/zdtm.sh</div><div>@@ -173,6 +173,7 @@ CLEANUP=0</div><div> PAGE_SERVER=0</div>
<div> PS_PORT=12345</div><div> TCPDUMP_PID=</div><div>+NS_TEST_ONLY=0</div><div> </div><div> check_mainstream()</div><div> {</div><div>@@ -358,6 +359,11 @@ run_test()</div><div> <span class="" style="white-space:pre">        </span>expr "$test" : 'ns/' > /dev/null && PIDNS=1 || PIDNS=""</div>
<div> <span class="" style="white-space:pre">        </span>test=${ZP}/${test#ns/}</div><div> </div><div>+<span class="" style="white-space:pre">        </span># option '-n' to skip tests without namespace</div><div>+<span class="" style="white-space:pre">        </span>if [[ $NS_TEST_ONLY -eq 1 ]] && [[ "$PIDNS" == "" ]]; then</div>
<div>+<span class="" style="white-space:pre">                </span>return</div><div>+<span class="" style="white-space:pre">        </span>fi</div><div>+</div><div> <span class="" style="white-space:pre">        </span>shift</div><div> <span class="" style="white-space:pre">        </span>local args=$*</div>
<div> <span class="" style="white-space:pre">        </span>local tname=`basename $test`</div><div>@@ -629,6 +635,11 @@ while :; do</div><div> <span class="" style="white-space:pre">                </span>shift</div><div> <span class="" style="white-space:pre">                </span>continue;</div>
<div> <span class="" style="white-space:pre">        </span>fi</div><div>+<span class="" style="white-space:pre">        </span>if [ "$1" = "-n" ]; then</div><div>+<span class="" style="white-space:pre">                </span>shift</div>
<div>+<span class="" style="white-space:pre">                </span>NS_TEST_ONLY=1</div><div>+<span class="" style="white-space:pre">                </span>continue</div><div>+<span class="" style="white-space:pre">        </span>fi</div><div> <span class="" style="white-space:pre">        </span>if [ "$1" = "-s" ]; then</div>
<div> <span class="" style="white-space:pre">                </span>SNAPSHOT=1</div><div> <span class="" style="white-space:pre">                </span>shift</div><div>@@ -682,6 +693,7 @@ Options:</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>+<span class="" style="white-space:pre">        </span>-n : Run tests in namespace 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>