From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 88FE8385780E for ; Thu, 11 Nov 2021 17:52:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 88FE8385780E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: QhXY0sPwgalSBQAB+HvHUrSgvxllsMxaQxuNRgylPtAf+Q6jm+GhHphaJdj9+3iEDz/sSQSxBR hBOktJ07/EXDEzo8QvVYaopxsSHX4dOjjq6ZzL6TGwAS4It05R1GCFt5m0AxJ5vAVxJvqOe5Ya C/gPNEmSsfp44oKHUUPm9CgRWuLx3i3DMc2XB6XZS7cZ0iq6b2j+aez2N3ldx/UVnYfmRuAUnw 9y5DhxjlEP59OySFqaC2b5dc3tEtC/ajhehrKv3rIfOhC2Yv88VPsjELZR+eomE1zn4hWBnsdK xhb9R+JMZAetVB3bFhDex8pI X-IronPort-AV: E=Sophos;i="5.87,226,1631606400"; d="scan'208";a="68219293" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 11 Nov 2021 09:52:52 -0800 IronPort-SDR: Ro1YfJh8xVmxxvheTDrqs2PwNV00r7HxeezFEOHWKHnFVCVTO0czUB8zVHSMaywajeC1gWb4XB bYpm+hdnRKopCjPR8SRYUceloArJRsdWk2lTgdZBXYU+/NLgnuhxqlGxB8UnjA0Vzoy2CcECGm 7PGkO9hh4LZzeBg6uUL3Qtlx2Q2MCyd247E88/jeCeZEgqHp+Q6kk+5WTkhCg64T8v7XxZphAZ deW1zxLGzcV2G8GOc9R78otmLpxonoC7mrb1WHFl5Gx6pSzkWnctNVpOV+NiURGjhOLdcgzUHO zYI= Message-ID: Date: Fri, 12 Nov 2021 01:52:43 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: [PATCH v2 1/2] dso-ordering-test.py: Put all sources in one directory [BZ #28550] Content-Language: en-US To: "H.J. Lu" , CC: Florian Weimer References: <20211108154211.167829-1-hjl.tools@gmail.com> <20211108154211.167829-2-hjl.tools@gmail.com> From: Chung-Lin Tang In-Reply-To: <20211108154211.167829-2-hjl.tools@gmail.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: svr-orw-mbx-08.mgc.mentorg.com (147.34.90.208) To svr-orw-mbx-02.mgc.mentorg.com (147.34.90.202) X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Nov 2021 17:52:55 -0000 On 2021/11/8 11:42 PM, H.J. Lu via Libc-alpha wrote: > Put all sources for DSO sorting tests in the dso-sort-tests-src directory > and compile test relocatable objects with > > $(objpfx)tst-dso-ordering1-dir/tst-dso-ordering1-a.os: $(objpfx)dso-sort-tests-src/tst-dso-ordering1-a.c > $(compile.c) $(OUTPUT_OPTION) > > to avoid random $< values from $(before-compile) when compiling test > relocatable objects with > > $(objpfx)%$o: $(objpfx)%.c $(before-compile); $$(compile-command.c) > compile-command.c = $(compile.c) $(OUTPUT_OPTION) $(compile-mkdep-flags) > compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS) I kind of see what you mean, but it appears that the explicit compile rule is the main required addition? If so, why the directory change to "dso-sort-tests-src"? (it kind of adds more complexity to the already somewhat complex placement of files, at least to someone new to the setup) Chung-Lin > for 3 "make -j 28" parallel builds on a machine with 112 cores at the > same time. > > This partially fixes BZ #28550. > --- > scripts/dso-ordering-test.py | 47 ++++++++++++++++++++++++++---------- > 1 file changed, 34 insertions(+), 13 deletions(-) > > diff --git a/scripts/dso-ordering-test.py b/scripts/dso-ordering-test.py > index 944ee74052..bde0406be9 100644 > --- a/scripts/dso-ordering-test.py > +++ b/scripts/dso-ordering-test.py > @@ -526,9 +526,13 @@ def process_testcase(t): > base_test_name = t.test_name > test_subdir = base_test_name + "-dir" > testpfx = objpfx + test_subdir + "/" > + test_srcdir = "dso-sort-tests-src/" > + testpfx_src = objpfx + test_srcdir > > if not os.path.exists(testpfx): > os.mkdir(testpfx) > + if not os.path.exists(testpfx_src): > + os.mkdir(testpfx_src) > > def find_objs_not_depended_on(t): > objs_not_depended_on = [] > @@ -595,6 +599,11 @@ def process_testcase(t): > # Print out needed Makefile fragments for use in glibc/elf/Makefile. > module_names = "" > for o in test_descr.objs: > + rule = ("$(objpfx)" + test_subdir + "/" + test_name > + + "-" + o + ".os: $(objpfx)" + test_srcdir > + + test_name + "-" + o + ".c\n" > + "\t$(compile.c) $(OUTPUT_OPTION)\n") > + makefile.write (rule) > module_names += " " + test_subdir + "/" + test_name + "-" + o > makefile.write("modules-names +=%s\n" % (module_names)) > > @@ -637,7 +646,7 @@ def process_testcase(t): > # object. This only needs to be done at most once for > # an object name. > if not dep in fake_created: > - f = open(testpfx + test_name + "-" + dep > + f = open(testpfx_src + test_name + "-" + dep > + ".FAKE.c", "w") > f.write(" \n") > f.close() > @@ -648,6 +657,12 @@ def process_testcase(t): > % (test_name + "-" + dep + ".FAKE.so", > ("$(objpfx)" + test_subdir + "/" > + test_name + "-" + dep + ".so"))) > + rule = ("$(objpfx)" + test_subdir + "/" > + + test_name + "-" + dep + ".FAKE.os: " > + "$(objpfx)" + test_srcdir > + + test_name + "-" + dep + ".FAKE.c\n" > + "\t$(compile.c) $(OUTPUT_OPTION)\n") > + makefile.write (rule) > makefile.write \ > ("modules-names += %s\n" > % (test_subdir + "/" > @@ -687,6 +702,10 @@ def process_testcase(t): > + test_descr.soname_map['#'] + ".so") > ldflags += (" -Wl,-soname=" + soname) > makefile.write("LDFLAGS-%s = %s\n" % (test_name, ldflags)) > + rule = ("$(objpfx)" + test_subdir + "/" + test_name + ".o: " > + "$(objpfx)" + test_srcdir + test_name + ".c\n" > + "\t$(compile.c) $(OUTPUT_OPTION)\n") > + makefile.write (rule) > > not_depended_objs = find_objs_not_depended_on(test_descr) > if not_depended_objs: > @@ -745,7 +764,7 @@ def process_testcase(t): > " something_failed=true\n" > "else\n" > " diff -wu ${common_objpfx}elf/%s/%s%s.output \\\n" > - " ${common_objpfx}elf/%s/%s%s.exp\n" > + " ${common_objpfx}elf/%s%s%s.exp\n" > " if [ $? -ne 0 ]; then\n" > " echo '%sFAIL: %s%s expected output comparison'\n" > " something_failed=true\n" > @@ -753,14 +772,14 @@ def process_testcase(t): > "fi\n" > % (("X" if xfail else ""), test_name, tunable_descr, > test_subdir, test_name, tunable_sfx, > - test_subdir, base_test_name, exp_tunable_sfx, > + test_srcdir, base_test_name, exp_tunable_sfx, > ("X" if xfail else ""), test_name, tunable_descr)) > > # Generate C files according to dependency and calling relations from > # description string. > for obj in test_descr.objs: > src_name = test_name + "-" + obj + ".c" > - f = open(testpfx + src_name, "w") > + f = open(testpfx_src + src_name, "w") > if obj in test_descr.callrefs: > called_objs = test_descr.callrefs[obj] > for callee in called_objs: > @@ -804,7 +823,7 @@ def process_testcase(t): > f.close() > > # Open C file for writing main program > - f = open(testpfx + test_name + ".c", "w") > + f = open(testpfx_src + test_name + ".c", "w") > > # if there are some operations in main(), it means we need -ldl > f.write("#include \n") > @@ -885,7 +904,7 @@ def process_testcase(t): > for obj in test_descr.objs: > src_name = test_name + "-" + obj + ".c" > obj_name = test_name + "-" + obj + ".os" > - run_cmd([build_gcc, "-c", "-fPIC", testpfx + src_name, > + run_cmd([build_gcc, "-c", "-fPIC", testpfx_src + src_name, > "-o", testpfx + obj_name]) > > obj_processed = {} > @@ -903,10 +922,12 @@ def process_testcase(t): > deps.append(dep + ".FAKE") > if not dep in fake_created: > base_name = testpfx + test_name + "-" + dep > + src_base_name = (testpfx_src + test_name > + + "-" + dep) > cmd = [build_gcc, "-Wl,--no-as-needed", > ("-Wl,-soname=" + base_name + ".so"), > "-shared", base_name + ".FAKE.c", > - "-o", base_name + ".FAKE.so"] > + "-o", src_base_name + ".FAKE.so"] > run_cmd(cmd) > fake_created[dep] = True > dso_deps = map(lambda d: testpfx + test_name + "-" + d + ".so", > @@ -932,7 +953,7 @@ def process_testcase(t): > main_deps = map(lambda d: testpfx + test_name + "-" + d + ".so", > deps) > cmd = [build_gcc, "-Wl,--no-as-needed", "-o", testpfx + test_name, > - testpfx + test_name + ".c", "-L%s" % (os.getcwd()), > + testpfx_src + test_name + ".c", "-L%s" % (os.getcwd()), > "-Wl,-rpath-link=%s" % (os.getcwd())] > if '#' in test_descr.soname_map: > soname = ("-Wl,-soname=" + testpfx + test_name + "-" > @@ -987,14 +1008,14 @@ def process_testcase(t): > sfx = "" > if r[0] != "": > sfx = "-" + r[0].replace("=","_") > - f = open(testpfx + t.test_name + sfx + ".exp", "w") > + f = open(testpfx_src + t.test_name + sfx + ".exp", "w") > (output, xfail) = r[1] > f.write('%s' % output) > f.close() > > # Create header part of top-level testcase shell script, to wrap execution > # and output comparison together. > - t.sh = open(testpfx + t.test_name + ".sh", "w") > + t.sh = open(testpfx_src + t.test_name + ".sh", "w") > t.sh.write("#!/bin/sh\n") > t.sh.write("# Test driver for %s, generated by " > "dso-ordering-test.py\n" % (t.test_name)) > @@ -1022,12 +1043,12 @@ def process_testcase(t): > sfx = "" > if r[0] != "": > sfx = "-" + r[0].replace("=","_") > - expected_output_files += " $(objpfx)%s/%s%s.exp" % (test_subdir, > + expected_output_files += " $(objpfx)%s%s%s.exp" % (test_srcdir, > t.test_name, sfx) > makefile.write \ > - ("$(objpfx)%s.out: $(objpfx)%s/%s.sh%s " > + ("$(objpfx)%s.out: $(objpfx)%s%s.sh%s " > "$(common-objpfx)support/test-run-command\n" > - % (t.test_name, test_subdir, t.test_name, > + % (t.test_name, test_srcdir, t.test_name, > expected_output_files)) > makefile.write("\t$(SHELL) $< $(common-objpfx) '$(test-wrapper-env)' " > "'$(run-program-env)' > $@; $(evaluate-test)\n") >