From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x933.google.com (mail-ua1-x933.google.com [IPv6:2607:f8b0:4864:20::933]) by sourceware.org (Postfix) with ESMTPS id 5A33E3857C5E for ; Mon, 15 Nov 2021 18:50:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5A33E3857C5E Received: by mail-ua1-x933.google.com with SMTP id r15so9777325uao.3 for ; Mon, 15 Nov 2021 10:50:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=8U9U8Kde+ACI47yl0+ih84h/ddRqhCnvZvQ0OT9sQIs=; b=n6OGH58eQrIjTHiGa5npu6Uy/KH0fY/6xxODK2/jgx9zHi7aRlD6/bB8TTT1oOzt/T utuzDPZGd4vX8zOIHtLeyx7F+fHfZIAq75WfOdT7136amMki7XY4BV+jpkhz7riWyYPX r3c62JrPDS3SLVjpj84qFSgLTdRxPyB5rUo4Hn3sm4/PVgBovIq8THYOnlf13TKb6PIL NqKhBjnE2hny5SxoFIqOeU9xiOnT2KHCr/4jmqgpx367bE5uia4U46gU601WUDBpo9wL AnHR5UDCG5ecrTVmSc6UPmAfEx5p5FxP/kNi4ZzBALinmqPyOItE7RH/W55yxUAHBPbw Sq1g== X-Gm-Message-State: AOAM532pXANL7ZRZNFo1sVWcE3kET/KdYxHa076Nvkwe2bNSwVsmjVLt l7/S7Tqo7er1QdSsHswQ+U0h5cKt2oBGZA== X-Google-Smtp-Source: ABdhPJyTpTtKA4Y3WggIJ6drvRxSbIGBHvOQcong07BG4qaAw9N524GqvTyL4VeZ67NWkqEcEQY2CA== X-Received: by 2002:a67:c402:: with SMTP id c2mr45606949vsk.53.1637002235712; Mon, 15 Nov 2021 10:50:35 -0800 (PST) Received: from ?IPV6:2804:431:c7ca:66dc:13f5:e2fb:5a0d:90? ([2804:431:c7ca:66dc:13f5:e2fb:5a0d:90]) by smtp.gmail.com with ESMTPSA id v3sm9019210vkv.19.2021.11.15.10.50.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Nov 2021 10:50:35 -0800 (PST) Message-ID: Date: Mon, 15 Nov 2021 15:50:33 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; 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: libc-alpha@sourceware.org, "H.J. Lu" References: <20211108154211.167829-1-hjl.tools@gmail.com> <20211108154211.167829-2-hjl.tools@gmail.com> From: Adhemerval Zanella In-Reply-To: <20211108154211.167829-2-hjl.tools@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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: Mon, 15 Nov 2021 18:50:38 -0000 On 08/11/2021 12:42, 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) > > for 3 "make -j 28" parallel builds on a machine with 112 cores at the > same time. > > This partially fixes BZ #28550. LGTM, thanks. Reviewed-by: Adhemerval Zanella > --- > 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") > Ok.