<div dir="ltr"><div>From: Yicheng Qin &lt;<a href="mailto:yichengq@google.com">yichengq@google.com</a>&gt;</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 &lt;<a href="mailto:yichengq@google.com">yichengq@google.com</a>&gt;</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 &quot;$test&quot; : &#39;ns/&#39; &gt; /dev/null &amp;&amp; PIDNS=1 || PIDNS=&quot;&quot;</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 &#39;-n&#39; to skip tests without namespace</div><div>+<span class="" style="white-space:pre">        </span>if [[ $NS_TEST_ONLY -eq 1 ]] &amp;&amp; [[ &quot;$PIDNS&quot; == &quot;&quot; ]]; 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 [ &quot;$1&quot; = &quot;-n&quot; ]; 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 [ &quot;$1&quot; = &quot;-s&quot; ]; 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 &lt;FILE&gt;.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 [ &quot;${1:0:1}&quot; = &#39;-&#39; ]; then</div><div> <span class="" style="white-space:pre">        </span>echo &quot;unrecognized option $1&quot;</div><div>-- </div><div>1.8.3</div><div><br></div></div>