1 /* Test running statically linked programs using ld.so.
2 Copyright (C) 2021-2022 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #include <support/check.h>
20 #include <support/support.h>
21 #include <support/capture_subprocess.h>
28 char *ldconfig_path
= xasprintf ("%s/elf/ldconfig", support_objdir_root
);
31 char *argv
[] = { (char *) "ld.so", ldconfig_path
, (char *) "--help", NULL
};
32 struct support_capture_subprocess cap
33 = support_capture_subprogram (support_objdir_elf_ldso
, argv
);
34 support_capture_subprocess_check (&cap
, "no --argv0", 0, sc_allow_stdout
);
35 puts ("info: output without --argv0:");
36 puts (cap
.out
.buffer
);
37 TEST_VERIFY (strstr (cap
.out
.buffer
, "Usage: ldconfig [OPTION...]\n")
39 support_capture_subprocess_free (&cap
);
45 (char *) "ld.so", (char *) "--argv0", (char *) "ldconfig-argv0",
46 ldconfig_path
, (char *) "--help", NULL
48 struct support_capture_subprocess cap
49 = support_capture_subprogram (support_objdir_elf_ldso
, argv
);
50 support_capture_subprocess_check (&cap
, "with --argv0", 0, sc_allow_stdout
);
51 puts ("info: output with --argv0:");
52 puts (cap
.out
.buffer
);
53 TEST_VERIFY (strstr (cap
.out
.buffer
, "Usage: ldconfig-argv0 [OPTION...]\n")
55 support_capture_subprocess_free (&cap
);
62 #include <support/test-driver.c>