diff options
author | Chung-Lin Tang <cltang@codesourcery.com> | 2021-10-21 21:41:21 +0800 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-10-21 11:23:53 -0300 |
commit | e6fd79f3795d46dfb583e124be49fc063bc3d58b (patch) | |
tree | 1d2b1f6ac65243c5f3e8f9c5283ec14751d136a7 /support/test-run-command.c | |
parent | 0ff2d30daedb6d0d00401f1f2a48a80ff99d7c25 (diff) | |
download | glibc-e6fd79f3795d46dfb583e124be49fc063bc3d58b.zip glibc-e6fd79f3795d46dfb583e124be49fc063bc3d58b.tar.gz glibc-e6fd79f3795d46dfb583e124be49fc063bc3d58b.tar.bz2 |
elf: Testing infrastructure for ld.so DSO sorting (BZ #17645)
This is the first of a 2-part patch set that fixes slow DSO sorting behavior in
the dynamic loader, as reported in BZ #17645. In order to facilitate such a
large modification to the dynamic loader, this first patch implements a testing
framework for validating shared object sorting behavior, to enable comparison
between old/new sorting algorithms, and any later enhancements.
This testing infrastructure consists of a Python script
scripts/dso-ordering-test.py' which takes in a description language, consisting
of strings that describe a set of link dependency relations between DSOs, and
generates testcase programs and Makefile fragments to automatically test the
described situation, for example:
a->b->c->d # four objects linked one after another
a->[bc]->d;b->c # a depends on b and c, which both depend on d,
# b depends on c (b,c linked to object a in fixed order)
a->b->c;{+a;%a;-a} # a, b, c serially dependent, main program uses
# dlopen/dlsym/dlclose on object a
a->b->c;{}!->[abc] # a, b, c serially dependent; multiple tests generated
# to test all permutations of a, b, c ordering linked
# to main program
(Above is just a short description of what the script can do, more
documentation is in the script comments.)
Two files containing several new tests, elf/dso-sort-tests-[12].def are added,
including test scenarios for BZ #15311 and Redhat issue #1162810 [1].
Due to the nature of dynamic loader tests, where the sorting behavior and test
output occurs before/after main(), generating testcases to use
support/test-driver.c does not suffice to control meaningful timeout for ld.so.
Therefore a new utility program 'support/test-run-command', based on
test-driver.c/support_test_main.c has been added. This does the same testcase
control, but for a program specified through a command-line rather than at the
source code level. This utility is used to run the dynamic loader testcases
generated by dso-ordering-test.py.
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1162810
Signed-off-by: Chung-Lin Tang <cltang@codesourcery.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'support/test-run-command.c')
-rw-r--r-- | support/test-run-command.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/support/test-run-command.c b/support/test-run-command.c new file mode 100644 index 0000000..61560d7 --- /dev/null +++ b/support/test-run-command.c @@ -0,0 +1,22 @@ +/* Main program for test-run-command support utility. + Copyright (C) 2021 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/>. */ + +/* This is basically a configuration of test-driver.c into a general + command-line program runner. */ +#define RUN_COMMAND_MODE +#include <test-driver.c> |