public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: elfutils-devel@sourceware.org
Subject: [PATCH] run-large-elf-file.sh: skip if free memory information is not available
Date: Thu, 14 Nov 2019 15:50:00 -0000	[thread overview]
Message-ID: <mvmwoc2v4n1.fsf@suse.de> (raw)

---
 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."

             reply	other threads:[~2019-11-14 15:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14 15:50 Andreas Schwab [this message]
2019-11-14 22:58 ` Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mvmwoc2v4n1.fsf@suse.de \
    --to=schwab@suse.de \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).