]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
tests: Print metrics for both ports on error and fix port selection
authorMark Wielaard <mark@klomp.org>
Mon, 6 Sep 2021 21:04:06 +0000 (23:04 +0200)
committerMark Wielaard <mark@klomp.org>
Mon, 6 Sep 2021 21:04:11 +0000 (23:04 +0200)
On error we would only print the metrics of one port (twice) because
of a typo. Also PORT1 and PORT2 could be equal because of a logic
error. Fix the typo and simplify the port selection by using
non-overlapping ranges to select PORT1 and PORT2.

tests/ChangeLog
tests/debuginfod-subr.sh

index c1760877f77114d9ca51dc7a64fc72f64f224f90..14eb4d9831770ec5cd4d67d9a98694d6b821c8e2 100644 (file)
@@ -1,3 +1,10 @@
+2021-09-06  Mark Wielaard  <mark@klomp.org>
+
+       * debuginfod-subr.sh (err): Change ports to port in for loop so both
+       PORT1 and PORT2 are used.
+       (get_ports): Simplify port selection by using for 50 for PORT1 and
+       second 50 for PORT2.
+
 2021-09-06  Mark Wielaard  <mark@klomp.org>
 
        * run-debuginfod-file.sh: Set DEBUGINFOD_CACHE_PATH. Export
index 3222a2b017c46a3861596f3a627b03e6e02aae4d..7d238436e8d29d70e86db95d6674ec51e30de0a2 100755 (executable)
@@ -39,7 +39,7 @@ trap cleanup 0 1 2 3 5 9 15
 errfiles_list=
 err() {
     echo ERROR REPORTS
-    for ports in $PORT1 $PORT2
+    for port in $PORT1 $PORT2
     do
         echo ERROR REPORT $port metrics
         curl -s http://127.0.0.1:$port/metrics
@@ -129,13 +129,13 @@ archive_test() {
 
 get_ports() {
   while true; do
-    PORT1=`expr '(' $RANDOM % 100 ')' + $base`
+    PORT1=`expr '(' $RANDOM % 50 ')' + $base`
     ss -atn | fgrep ":$PORT1" || break
   done
 # Some tests will use two servers, so assign the second var
   while true; do
-    PORT2=`expr '(' $RANDOM % 100 ')' + $base`
-    ss -atn | fgrep ":$PORT2" && $PORT1 -ne $PORT2 || break
+    PORT2=`expr '(' $RANDOM % 50 ')' + $base + 50`
+    ss -atn | fgrep ":$PORT2" || break
   done
 
 }