This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

make -kj<n> check running repeat tests


I've noticed that my test program is getting run once for each test -j<n>. So

make -kj8 RUNTESTFLAGS="ms-sysv.exp" check

will result in 8 jobs each running the same tests. (Incidentally, I've moved my tests from gcc.target/i386/msabi to gcc.target/x86_64/abi/ms-sysv for taxonomic correctness.) As I was doing research, I discovered some other options that probably should be tested since they touch pro/epilogue creation (-fno-shrink-wrap-separate and -fprofile-generate), so I wanted to modify my tests to be able to run in parallel anyway.

I've been looking at dg-runtest, et. al. to try and understand how it manages parallelism, but I don't funny understand yet how manages the distribution of tests to jobs. Is it using the directory gcc/testsuite/gcc-parallel (in the case of tool=gcc) to assign a finite number of tests per iteration until the end of the test list is reached?

Either way, I need to implement some type of mechanism to distribute tests over make jobs. I have a small loop in ms-sysv.exp and I intend to increase the number of iterations of that loop, but some iterations will have lower complexity (and thus be faster) so as to not add an absurd amount of time. Can you point me in the right direction here please?

If there is a mechanism in expect/tcl to have an IPC integral value shared across jobs that I can do an atomic read & increment of then that would work. I guess that's what the $(TESTSUITEDIR)/$(check_p_tool)-parallel in Makefile.in is supposed to be for?

Thanks,
Daniel


diff --git a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp
new file mode 100644
index 00000000000..8c3a3d2fc1c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp
@@ -0,0 +1,133 @@
+# Tests for ms_abi to sysv_abi calls.
+# Copyright (C) 2016-2017 Free Software Foundation, Inc.
+# Contributed by Daniel Santos <daniel.santos@pobox.com>
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC 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 General Public License for more details.
+#
+# Under Section 7 of GPL version 3, you are granted additional
+# permissions described in the GCC Runtime Library Exception, version
+# 3.1, as published by the Free Software Foundation.
+#
+# You should have received a copy of the GNU General Public License and
+# a copy of the GCC Runtime Library Exception along with this program;
+# see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+# Exit immediately if this isn't a native x86_64 target.
+if { (![istarget x86_64-*-*] && ![istarget i?86-*-*])
+     || ![is-effective-target lp64] || ![isnative] } then {
+    unsupported "$subdir"
+    return
+}
+
+load_lib gcc-dg.exp
+
+proc runtest_ms_sysv { cflags generator_args } {
+    global GCC_UNDER_TEST HOSTCXX HOSTCXXFLAGS tmpdir srcdir subdir
+
+    set objdir "$tmpdir/ms-sysv"
+    set generator "$tmpdir/ms-sysv-generate.exe"
+    set generated_header "$objdir/ms-sysv-generated.h"
+    set do_test_o "$objdir/do-test.o"
+    set ms_sysv_o "$objdir/ms-sysv.o"
+    set ms_sysv_exe "$objdir/ms-sysv.exe"
+    set status 0
+    set warn_flags "-Wall"
+
+    file delete -force $objdir
+    file mkdir $objdir
+
+    # Build the generator (only needs to be done once).
+    set src "$srcdir/$subdir/gen.cc"
+    if { (![file exists "$generator"]) || ([file mtime "$generator"]
+					 < [file mtime "$src"]) } {
+	# Temporarily switch to the environment for the host compiler.
+	restore_ld_library_path_env_vars
+	set cxx "$HOSTCXX $HOSTCXXFLAGS $warn_flags -std=c++11"
+	set status [remote_exec host "$cxx -o $generator $src"]
+	set status [lindex $status 0]
+	set_ld_library_path_env_vars
+	if { $status != 0 } then {
+	    warning "Could not build $subdir generator"
+	}
+    }
+
+    # Generate header
+    if { $status == 0 } then {
+	set status [remote_exec host "$generator $generator_args $generated_header"]
+	set status [lindex $status 0]
+	if { $status != 0 } then {
+	    warning "Could not generate $generated_header"
+	}
+    }
+
+    set cc "$GCC_UNDER_TEST -I$objdir -I$srcdir/$subdir $cflags $warn_flags"
+
+    # Assemble do-test.S
+    set src "$srcdir/$subdir/do-test.S"
+    if { $status == 0 } then {
+	set status [remote_exec build "$cc -c -o $do_test_o $src"]
+	set status [lindex $status 0]
+	if { $status != 0 } then {
+	    warning "Could not assemble $src"
+	}
+    }
+
+    # Build ms-sysv.c
+    set src "$srcdir/$subdir/ms-sysv.c"
+    if { $status == 0 } then {
+	set status [remote_exec build "$cc -c -o $ms_sysv_o $src" "" "" "" 1200]
+	set status [lindex $status 0]
+	if { $status != 0 } then {
+	    warning "Could not build $src."
+	}
+    }
+
+    # Link
+    if { $status == 0 } then {
+	set status [remote_exec build "$cc -o $ms_sysv_exe $ms_sysv_o $do_test_o"]
+	set status [lindex $status 0]
+	if { $status != 0 } then {
+	    warning "Link failed."
+	}
+    }
+
+    # Execute
+    if { $status == 0 } then {
+	set status [remote_exec build "$ms_sysv_exe"]
+	set status [lindex $status 0]
+    }
+
+    set descr "$subdir CFLAGS=\"$cflags\" generator_args=\"$generator_args\""
+    if { $status != 0 } then {
+	fail $descr
+    } else {
+	pass $descr
+    }
+}
+
+dg-init
+
+set extra_cflags [list ""]
+
+# Skip -mcall-ms2sysv-xlogues on Windows since it doesn't support SEH.
+if { ![istarget *-*-cygwin*] && ![istarget *-*-mingw*] } {
+    lappend extra_cflags "-mcall-ms2sysv-xlogues"
+}
+
+foreach opt $extra_cflags {
+    runtest_ms_sysv "-O2 -g $opt" "-p0-5"
+    runtest_ms_sysv "-O0 -g $opt" "-p0-5 --omit-rbp-clobbers"
+}
+
+dg-finish

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]