about summary refs log tree commit diff
path: root/elf/tst-rtld-argv0.sh
diff options
context:
space:
mode:
authorVincent Mihalkovic <vmihalko@redhat.com>2020-09-29 12:34:39 +0200
committerFlorian Weimer <fweimer@redhat.com>2020-09-29 12:34:40 +0200
commitc6702789344043fa998923c8f32ed0bdb2edfa9c (patch)
tree60362f3e9d0e1f5a886469d0575df25f5c71a2eb /elf/tst-rtld-argv0.sh
parentd3c57027470b78dba79c6d931e4e409b1fecfc80 (diff)
downloadglibc-c6702789344043fa998923c8f32ed0bdb2edfa9c.tar.gz
glibc-c6702789344043fa998923c8f32ed0bdb2edfa9c.tar.xz
glibc-c6702789344043fa998923c8f32ed0bdb2edfa9c.zip
ld.so: add an --argv0 option [BZ #16124]
Diffstat (limited to 'elf/tst-rtld-argv0.sh')
-rwxr-xr-xelf/tst-rtld-argv0.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/elf/tst-rtld-argv0.sh b/elf/tst-rtld-argv0.sh
new file mode 100755
index 0000000000..14d97fb375
--- /dev/null
+++ b/elf/tst-rtld-argv0.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Test for --argv0 option ld.so.
+# Copyright (C) 2020 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+#
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <https://www.gnu.org/licenses/>.
+
+set -e
+
+rtld=$1
+test_program=$2
+test_wrapper_env=$3
+run_program_env=$4
+library_path=$5
+argv0=$6
+
+echo "# [${test_wrapper_env}] [${run_program_env}] [$rtld] [--library-path]" \
+     "[$library_path] [--argv0] [$argv0] [$test_program]"
+${test_wrapper_env} \
+${run_program_env} \
+$rtld --library-path "$library_path" \
+  --argv0 "$argv0" $test_program 2>&1 && rc=0 || rc=$?
+echo "# exit status $rc"
+
+exit $rc