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