|
|
93dc2d |
commit b4bbedb1e75737a80bcc3d53d6eef1fbe0b5f4d5
|
|
|
93dc2d |
Author: H.J. Lu <hjl.tools@gmail.com>
|
|
|
93dc2d |
Date: Sat Nov 6 14:13:27 2021 -0700
|
|
|
93dc2d |
|
|
|
93dc2d |
dso-ordering-test.py: Put all sources in one directory [BZ #28550]
|
|
|
93dc2d |
|
|
|
93dc2d |
Put all sources for DSO sorting tests in the dso-sort-tests-src directory
|
|
|
93dc2d |
and compile test relocatable objects with
|
|
|
93dc2d |
|
|
|
93dc2d |
$(objpfx)tst-dso-ordering1-dir/tst-dso-ordering1-a.os: $(objpfx)dso-sort-tests-src/tst-dso-ordering1-a.c
|
|
|
93dc2d |
$(compile.c) $(OUTPUT_OPTION)
|
|
|
93dc2d |
|
|
|
93dc2d |
to avoid random $< values from $(before-compile) when compiling test
|
|
|
93dc2d |
relocatable objects with
|
|
|
93dc2d |
|
|
|
93dc2d |
$(objpfx)%$o: $(objpfx)%.c $(before-compile); $$(compile-command.c)
|
|
|
93dc2d |
compile-command.c = $(compile.c) $(OUTPUT_OPTION) $(compile-mkdep-flags)
|
|
|
93dc2d |
compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS)
|
|
|
93dc2d |
|
|
|
93dc2d |
for 3 "make -j 28" parallel builds on a machine with 112 cores at the
|
|
|
93dc2d |
same time.
|
|
|
93dc2d |
|
|
|
93dc2d |
This partially fixes BZ #28550.
|
|
|
93dc2d |
|
|
|
93dc2d |
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
|
|
93dc2d |
|
|
|
93dc2d |
diff --git a/scripts/dso-ordering-test.py b/scripts/dso-ordering-test.py
|
|
|
93dc2d |
index 944ee740527d60fd..bde0406be9da14fc 100644
|
|
|
93dc2d |
--- a/scripts/dso-ordering-test.py
|
|
|
93dc2d |
+++ b/scripts/dso-ordering-test.py
|
|
|
93dc2d |
@@ -526,9 +526,13 @@ def process_testcase(t):
|
|
|
93dc2d |
base_test_name = t.test_name
|
|
|
93dc2d |
test_subdir = base_test_name + "-dir"
|
|
|
93dc2d |
testpfx = objpfx + test_subdir + "/"
|
|
|
93dc2d |
+ test_srcdir = "dso-sort-tests-src/"
|
|
|
93dc2d |
+ testpfx_src = objpfx + test_srcdir
|
|
|
93dc2d |
|
|
|
93dc2d |
if not os.path.exists(testpfx):
|
|
|
93dc2d |
os.mkdir(testpfx)
|
|
|
93dc2d |
+ if not os.path.exists(testpfx_src):
|
|
|
93dc2d |
+ os.mkdir(testpfx_src)
|
|
|
93dc2d |
|
|
|
93dc2d |
def find_objs_not_depended_on(t):
|
|
|
93dc2d |
objs_not_depended_on = []
|
|
|
93dc2d |
@@ -595,6 +599,11 @@ def process_testcase(t):
|
|
|
93dc2d |
# Print out needed Makefile fragments for use in glibc/elf/Makefile.
|
|
|
93dc2d |
module_names = ""
|
|
|
93dc2d |
for o in test_descr.objs:
|
|
|
93dc2d |
+ rule = ("$(objpfx)" + test_subdir + "/" + test_name
|
|
|
93dc2d |
+ + "-" + o + ".os: $(objpfx)" + test_srcdir
|
|
|
93dc2d |
+ + test_name + "-" + o + ".c\n"
|
|
|
93dc2d |
+ "\t$(compile.c) $(OUTPUT_OPTION)\n")
|
|
|
93dc2d |
+ makefile.write (rule)
|
|
|
93dc2d |
module_names += " " + test_subdir + "/" + test_name + "-" + o
|
|
|
93dc2d |
makefile.write("modules-names +=%s\n" % (module_names))
|
|
|
93dc2d |
|
|
|
93dc2d |
@@ -637,7 +646,7 @@ def process_testcase(t):
|
|
|
93dc2d |
# object. This only needs to be done at most once for
|
|
|
93dc2d |
# an object name.
|
|
|
93dc2d |
if not dep in fake_created:
|
|
|
93dc2d |
- f = open(testpfx + test_name + "-" + dep
|
|
|
93dc2d |
+ f = open(testpfx_src + test_name + "-" + dep
|
|
|
93dc2d |
+ ".FAKE.c", "w")
|
|
|
93dc2d |
f.write(" \n")
|
|
|
93dc2d |
f.close()
|
|
|
93dc2d |
@@ -648,6 +657,12 @@ def process_testcase(t):
|
|
|
93dc2d |
% (test_name + "-" + dep + ".FAKE.so",
|
|
|
93dc2d |
("$(objpfx)" + test_subdir + "/"
|
|
|
93dc2d |
+ test_name + "-" + dep + ".so")))
|
|
|
93dc2d |
+ rule = ("$(objpfx)" + test_subdir + "/"
|
|
|
93dc2d |
+ + test_name + "-" + dep + ".FAKE.os: "
|
|
|
93dc2d |
+ "$(objpfx)" + test_srcdir
|
|
|
93dc2d |
+ + test_name + "-" + dep + ".FAKE.c\n"
|
|
|
93dc2d |
+ "\t$(compile.c) $(OUTPUT_OPTION)\n")
|
|
|
93dc2d |
+ makefile.write (rule)
|
|
|
93dc2d |
makefile.write \
|
|
|
93dc2d |
("modules-names += %s\n"
|
|
|
93dc2d |
% (test_subdir + "/"
|
|
|
93dc2d |
@@ -687,6 +702,10 @@ def process_testcase(t):
|
|
|
93dc2d |
+ test_descr.soname_map['#'] + ".so")
|
|
|
93dc2d |
ldflags += (" -Wl,-soname=" + soname)
|
|
|
93dc2d |
makefile.write("LDFLAGS-%s = %s\n" % (test_name, ldflags))
|
|
|
93dc2d |
+ rule = ("$(objpfx)" + test_subdir + "/" + test_name + ".o: "
|
|
|
93dc2d |
+ "$(objpfx)" + test_srcdir + test_name + ".c\n"
|
|
|
93dc2d |
+ "\t$(compile.c) $(OUTPUT_OPTION)\n")
|
|
|
93dc2d |
+ makefile.write (rule)
|
|
|
93dc2d |
|
|
|
93dc2d |
not_depended_objs = find_objs_not_depended_on(test_descr)
|
|
|
93dc2d |
if not_depended_objs:
|
|
|
93dc2d |
@@ -745,7 +764,7 @@ def process_testcase(t):
|
|
|
93dc2d |
" something_failed=true\n"
|
|
|
93dc2d |
"else\n"
|
|
|
93dc2d |
" diff -wu ${common_objpfx}elf/%s/%s%s.output \\\n"
|
|
|
93dc2d |
- " ${common_objpfx}elf/%s/%s%s.exp\n"
|
|
|
93dc2d |
+ " ${common_objpfx}elf/%s%s%s.exp\n"
|
|
|
93dc2d |
" if [ $? -ne 0 ]; then\n"
|
|
|
93dc2d |
" echo '%sFAIL: %s%s expected output comparison'\n"
|
|
|
93dc2d |
" something_failed=true\n"
|
|
|
93dc2d |
@@ -753,14 +772,14 @@ def process_testcase(t):
|
|
|
93dc2d |
"fi\n"
|
|
|
93dc2d |
% (("X" if xfail else ""), test_name, tunable_descr,
|
|
|
93dc2d |
test_subdir, test_name, tunable_sfx,
|
|
|
93dc2d |
- test_subdir, base_test_name, exp_tunable_sfx,
|
|
|
93dc2d |
+ test_srcdir, base_test_name, exp_tunable_sfx,
|
|
|
93dc2d |
("X" if xfail else ""), test_name, tunable_descr))
|
|
|
93dc2d |
|
|
|
93dc2d |
# Generate C files according to dependency and calling relations from
|
|
|
93dc2d |
# description string.
|
|
|
93dc2d |
for obj in test_descr.objs:
|
|
|
93dc2d |
src_name = test_name + "-" + obj + ".c"
|
|
|
93dc2d |
- f = open(testpfx + src_name, "w")
|
|
|
93dc2d |
+ f = open(testpfx_src + src_name, "w")
|
|
|
93dc2d |
if obj in test_descr.callrefs:
|
|
|
93dc2d |
called_objs = test_descr.callrefs[obj]
|
|
|
93dc2d |
for callee in called_objs:
|
|
|
93dc2d |
@@ -804,7 +823,7 @@ def process_testcase(t):
|
|
|
93dc2d |
f.close()
|
|
|
93dc2d |
|
|
|
93dc2d |
# Open C file for writing main program
|
|
|
93dc2d |
- f = open(testpfx + test_name + ".c", "w")
|
|
|
93dc2d |
+ f = open(testpfx_src + test_name + ".c", "w")
|
|
|
93dc2d |
|
|
|
93dc2d |
# if there are some operations in main(), it means we need -ldl
|
|
|
93dc2d |
f.write("#include <stdio.h>\n")
|
|
|
93dc2d |
@@ -885,7 +904,7 @@ def process_testcase(t):
|
|
|
93dc2d |
for obj in test_descr.objs:
|
|
|
93dc2d |
src_name = test_name + "-" + obj + ".c"
|
|
|
93dc2d |
obj_name = test_name + "-" + obj + ".os"
|
|
|
93dc2d |
- run_cmd([build_gcc, "-c", "-fPIC", testpfx + src_name,
|
|
|
93dc2d |
+ run_cmd([build_gcc, "-c", "-fPIC", testpfx_src + src_name,
|
|
|
93dc2d |
"-o", testpfx + obj_name])
|
|
|
93dc2d |
|
|
|
93dc2d |
obj_processed = {}
|
|
|
93dc2d |
@@ -903,10 +922,12 @@ def process_testcase(t):
|
|
|
93dc2d |
deps.append(dep + ".FAKE")
|
|
|
93dc2d |
if not dep in fake_created:
|
|
|
93dc2d |
base_name = testpfx + test_name + "-" + dep
|
|
|
93dc2d |
+ src_base_name = (testpfx_src + test_name
|
|
|
93dc2d |
+ + "-" + dep)
|
|
|
93dc2d |
cmd = [build_gcc, "-Wl,--no-as-needed",
|
|
|
93dc2d |
("-Wl,-soname=" + base_name + ".so"),
|
|
|
93dc2d |
"-shared", base_name + ".FAKE.c",
|
|
|
93dc2d |
- "-o", base_name + ".FAKE.so"]
|
|
|
93dc2d |
+ "-o", src_base_name + ".FAKE.so"]
|
|
|
93dc2d |
run_cmd(cmd)
|
|
|
93dc2d |
fake_created[dep] = True
|
|
|
93dc2d |
dso_deps = map(lambda d: testpfx + test_name + "-" + d + ".so",
|
|
|
93dc2d |
@@ -932,7 +953,7 @@ def process_testcase(t):
|
|
|
93dc2d |
main_deps = map(lambda d: testpfx + test_name + "-" + d + ".so",
|
|
|
93dc2d |
deps)
|
|
|
93dc2d |
cmd = [build_gcc, "-Wl,--no-as-needed", "-o", testpfx + test_name,
|
|
|
93dc2d |
- testpfx + test_name + ".c", "-L%s" % (os.getcwd()),
|
|
|
93dc2d |
+ testpfx_src + test_name + ".c", "-L%s" % (os.getcwd()),
|
|
|
93dc2d |
"-Wl,-rpath-link=%s" % (os.getcwd())]
|
|
|
93dc2d |
if '#' in test_descr.soname_map:
|
|
|
93dc2d |
soname = ("-Wl,-soname=" + testpfx + test_name + "-"
|
|
|
93dc2d |
@@ -987,14 +1008,14 @@ def process_testcase(t):
|
|
|
93dc2d |
sfx = ""
|
|
|
93dc2d |
if r[0] != "":
|
|
|
93dc2d |
sfx = "-" + r[0].replace("=","_")
|
|
|
93dc2d |
- f = open(testpfx + t.test_name + sfx + ".exp", "w")
|
|
|
93dc2d |
+ f = open(testpfx_src + t.test_name + sfx + ".exp", "w")
|
|
|
93dc2d |
(output, xfail) = r[1]
|
|
|
93dc2d |
f.write('%s' % output)
|
|
|
93dc2d |
f.close()
|
|
|
93dc2d |
|
|
|
93dc2d |
# Create header part of top-level testcase shell script, to wrap execution
|
|
|
93dc2d |
# and output comparison together.
|
|
|
93dc2d |
- t.sh = open(testpfx + t.test_name + ".sh", "w")
|
|
|
93dc2d |
+ t.sh = open(testpfx_src + t.test_name + ".sh", "w")
|
|
|
93dc2d |
t.sh.write("#!/bin/sh\n")
|
|
|
93dc2d |
t.sh.write("# Test driver for %s, generated by "
|
|
|
93dc2d |
"dso-ordering-test.py\n" % (t.test_name))
|
|
|
93dc2d |
@@ -1022,12 +1043,12 @@ def process_testcase(t):
|
|
|
93dc2d |
sfx = ""
|
|
|
93dc2d |
if r[0] != "":
|
|
|
93dc2d |
sfx = "-" + r[0].replace("=","_")
|
|
|
93dc2d |
- expected_output_files += " $(objpfx)%s/%s%s.exp" % (test_subdir,
|
|
|
93dc2d |
+ expected_output_files += " $(objpfx)%s%s%s.exp" % (test_srcdir,
|
|
|
93dc2d |
t.test_name, sfx)
|
|
|
93dc2d |
makefile.write \
|
|
|
93dc2d |
- ("$(objpfx)%s.out: $(objpfx)%s/%s.sh%s "
|
|
|
93dc2d |
+ ("$(objpfx)%s.out: $(objpfx)%s%s.sh%s "
|
|
|
93dc2d |
"$(common-objpfx)support/test-run-command\n"
|
|
|
93dc2d |
- % (t.test_name, test_subdir, t.test_name,
|
|
|
93dc2d |
+ % (t.test_name, test_srcdir, t.test_name,
|
|
|
93dc2d |
expected_output_files))
|
|
|
93dc2d |
makefile.write("\t$(SHELL) $< $(common-objpfx) '$(test-wrapper-env)' "
|
|
|
93dc2d |
"'$(run-program-env)' > $@; $(evaluate-test)\n")
|