public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] run-large-elf-file.sh: skip if free memory information is not available
@ 2019-11-14 15:50 Andreas Schwab
  2019-11-14 22:58 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2019-11-14 15:50 UTC (permalink / raw)
  To: elfutils-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] run-large-elf-file.sh: skip if free memory information is not available
  2019-11-14 15:50 [PATCH] run-large-elf-file.sh: skip if free memory information is not available Andreas Schwab
@ 2019-11-14 22:58 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2019-11-14 22:58 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: elfutils-devel

On Thu, Nov 14, 2019 at 04:50:26PM +0100, Andreas Schwab wrote:
> +2019-11-14  Andreas Schwab  <schwab@suse.de>
> +
> +	* run-large-elf-file.sh: Skip if available memory cannot be
> +	determined.

Yes, good idea. When /usr/bin/free isn't installed we would otherwise
always run the test. Pushed to master.

Thanks,

Mark

P.S. You forgot the Signed-off-by line.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-14 22:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-14 15:50 [PATCH] run-large-elf-file.sh: skip if free memory information is not available Andreas Schwab
2019-11-14 22:58 ` Mark Wielaard

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