public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH] tests: Check addsections test binary is 64bit for run-large-elf-file.sh
Date: Mon, 21 Mar 2022 00:17:14 +0100	[thread overview]
Message-ID: <20220320231714.156219-1-mark@klomp.org> (raw)

The test binary should be 64bit to be able to create 4GB, or larger,
ELF files.

https://sourceware.org/bugzilla/show_bug.cgi?id=28975

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 tests/ChangeLog             |  4 ++++
 tests/run-large-elf-file.sh | 11 +++++++++++
 2 files changed, 15 insertions(+)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index c97ed52e..c195f9f7 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2022-03-20  Mark Wielaard  <mark@klomp.org>
+
+	* run-large-elf-file.sh: Check elf class of addsections binary.
+
 2021-12-17  Mark Wielaard  <mark@klomp.org>
 
 	* run-debuginfod-query-retry.sh: Use /bin/sh instead of /bin/ls.
diff --git a/tests/run-large-elf-file.sh b/tests/run-large-elf-file.sh
index 667d24d8..7116de53 100755
--- a/tests/run-large-elf-file.sh
+++ b/tests/run-large-elf-file.sh
@@ -1,5 +1,6 @@
 #! /usr/bin/env bash
 # Copyright (C) 2019 Red Hat, Inc.
+# Copyright (C) 2022 Mark J. Wielaard <mark@klomp.org>
 # This file is part of elfutils.
 #
 # This file is free software; you can redistribute it and/or modify
@@ -26,6 +27,16 @@ if test $long_bit -ne 64; then
   exit 77
 fi
 
+# The test binary also needs to be 64bits itself
+elfclass=64
+testrun ${abs_top_builddir}/src/readelf -h ${abs_builddir}/addsections | grep ELF32 \
+	&& elfclass=32
+echo elfclass: $elfclass
+if test $elfclass -ne 64; then
+  echo "Only 64bit binaries can create > 4GB ELF files"
+  exit 77
+fi
+
 # These tests need lots of disk space since they test files > 4GB.
 # Skip if there just isn't enough (2.5 * 4 = 10GB).
 space_available=$[$(stat -f --format="%a*%S" .)/(1024 * 1024 * 1024)]
-- 
2.30.2


             reply	other threads:[~2022-03-20 23:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-20 23:17 Mark Wielaard [this message]
2022-03-24 11:33 ` 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=20220320231714.156219-1-mark@klomp.org \
    --to=mark@klomp.org \
    --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).