[PATCH] run-large-elf-file.sh: skip if free memory information is not available

Andreas Schwab schwab@suse.de
Thu Nov 14 15:50:00 GMT 2019


---
 tests/ChangeLog             | 5 +++++
 tests/run-large-elf-file.sh | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 97b8dedb..f37f6cd6 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-14  Andreas Schwab  <schwab@suse.de>
+
+	* run-large-elf-file.sh: Skip if available memory cannot be
+	determined.
+
 2019-09-02  Mark Wielaard  <mark@klomp.org>
 
 	* run-readelf-s.sh: Add --dyn-syms case.
diff --git a/tests/run-large-elf-file.sh b/tests/run-large-elf-file.sh
index 6146cfed..cbe30615 100755
--- a/tests/run-large-elf-file.sh
+++ b/tests/run-large-elf-file.sh
@@ -42,9 +42,9 @@ if [ "x$VALGRIND_CMD" != "x" ]; then
   mem_needed=$[${mem_needed} + 2]
 fi
 echo "mem_needed: $mem_needed"
-mem_available=$(free -g | grep ^Mem: | awk -F ' +' '{print $7}')
+mem_available=$(free -g 2>/dev/null | grep ^Mem: | awk -F ' +' '{print $7}')
 echo "mem_available: $mem_available"
-if test $mem_available -lt $mem_needed; then
+if test -z "$mem_available" || test $mem_available -lt $mem_needed; then
   echo "Need at least ${mem_needed}GB free available memory"
   exit 77
 fi
-- 
2.24.0


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



More information about the Elfutils-devel mailing list