VOL-5155 - triage failure in periodic-voltha-test-bbsim-2.12

jjb/pipeline/voltha/voltha-2.12/bbsim-tests.groovy
--------------------------------------------------
  o Remove {pgrep,pkill} switch --older [n], command version
    not yet supported on jenkins nodes.
  o Change pkill logic from [[ count ]] && kill to if [count]; then kill.
    See if lack of cmd && {true;} || {false;} threw an exception based
    on lack of a false case.

Change-Id: Icd61bf7089b293f4589d694123263c92f7979176
diff --git a/jjb/pipeline/voltha/voltha-2.12/bbsim-tests.groovy b/jjb/pipeline/voltha/voltha-2.12/bbsim-tests.groovy
index e8c2181..32065dd 100644
--- a/jjb/pipeline/voltha/voltha-2.12/bbsim-tests.groovy
+++ b/jjb/pipeline/voltha/voltha-2.12/bbsim-tests.groovy
@@ -73,7 +73,7 @@
 void pgrep_proc(String proc) {
     String cmd = [
 	'pgrep',
-	'--older', 5,  // delay to exclude pgrep
+	// '--older', 5, // switch not supported, nodes using older version
 	'--list-full',
 	proc,
     ].join(' ')
@@ -88,13 +88,16 @@
 void pkill_proc(String proc) {
     String cmd = [
 	'pkill',
-	'--older', 5,  // delay to exclude pkill
+	// switch not supported, nodes using older version
+	// NOTE: pkill should not kill it-self
+	// good old kill (ps | grep -v -e grep -e '$$-me') }
+	// '--older', 5,
 	'--echo',
 	proc,
     ].join(' ')
 
     println("** Running: ${cmd}")
-    sh(""" [[ \$(pgrep --count "${proc}") -gt 0 ]] && "${cmd}" """)
+    sh(""" if [[ \$(pgrep --count "${proc}") -gt 0 ]]; then "$cmd"; fi" """)
     return
 }