[PATCH 1/3] testbot/build: Move GitPull() and call it a bit later in Reconfig.pl.
The functions are now declared in the order in which they are called. Reconfig.pl now builds the TestBot tools and only then grabs the latest Wine and recompiles it. Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com> --- testbot/bin/build/Reconfig.pl | 64 +++++++++++++++++------------------ 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/testbot/bin/build/Reconfig.pl b/testbot/bin/build/Reconfig.pl index 977df6e12..bc179951d 100755 --- a/testbot/bin/build/Reconfig.pl +++ b/testbot/bin/build/Reconfig.pl @@ -6,6 +6,7 @@ # 32 and 64 bit winetest binaries. # # Copyright 2009 Ge van Geldorp +# Copyright 2012-2014, 2017-2018 Francois Gouget # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -70,35 +71,6 @@ sub FatalError(@) exit 1; } -sub GitPull() -{ - InfoMsg "Updating the Wine source\n"; - system("cd $DataDir/wine && git pull >> $LogDir/Reconfig.log 2>&1"); - if ($? != 0) - { - LogMsg "Git pull failed\n"; - return !1; - } - - if (open(my $fh, ">", "$DataDir/testlist.txt")) - { - foreach my $TestFile (glob("$DataDir/wine/*/*/tests/*.c"), - glob("$DataDir/wine/*/*/tests/*.spec")) - { - next if ($TestFile =~ m=/testlist\.c$=); - $TestFile =~ s=^$DataDir/wine/==; - print $fh "$TestFile\n"; - } - close($fh); - } - else - { - LogMsg "Could not open 'testlist.txt' for writing: $!\n"; - } - - return 1; -} - my $ncpus; sub CountCPUs() { @@ -156,6 +128,35 @@ sub BuildTestLauncher() return 1; } +sub GitPull() +{ + InfoMsg "Updating the Wine source\n"; + system("cd $DataDir/wine && git pull >> $LogDir/Reconfig.log 2>&1"); + if ($? != 0) + { + LogMsg "Git pull failed\n"; + return !1; + } + + if (open(my $fh, ">", "$DataDir/testlist.txt")) + { + foreach my $TestFile (glob("$DataDir/wine/*/*/tests/*.c"), + glob("$DataDir/wine/*/*/tests/*.spec")) + { + next if ($TestFile =~ m=/testlist\.c$=); + $TestFile =~ s=^$DataDir/wine/==; + print $fh "$TestFile\n"; + } + close($fh); + } + else + { + LogMsg "Could not open 'testlist.txt' for writing: $!\n"; + } + + return 1; +} + sub BuildNative() { mkdir "$DataDir/build-native" if (! -d "$DataDir/build-native"); @@ -211,15 +212,12 @@ if (! -d "$DataDir/staging" and ! mkdir "$DataDir/staging") LogMsg "Unable to create '$DataDir/staging': $!\n"; exit(1); } -if (! GitPull()) -{ - exit(1); -} CountCPUs(); if (!BuildTestAgentd() || !BuildTestLauncher() || + !GitPull() || !BuildNative() || !BuildCross(32) || !BuildCross(64)) -- 2.17.1
This way it matches Reconfig.pl. Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com> --- testbot/bin/build/Build.pl | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/testbot/bin/build/Build.pl b/testbot/bin/build/Build.pl index 8b1859016..001f5eb18 100755 --- a/testbot/bin/build/Build.pl +++ b/testbot/bin/build/Build.pl @@ -72,6 +72,18 @@ sub FatalError(@) exit 1; } +my $ncpus; +sub CountCPUs() +{ + if (open(my $fh, "<", "/proc/cpuinfo")) + { + # Linux + map { $ncpus++ if (/^processor/); } <$fh>; + close($fh); + } + $ncpus ||= 1; +} + sub ApplyPatch($) { my ($PatchFile) = @_; @@ -117,18 +129,6 @@ sub ApplyPatch($) return $Impacts; } -my $ncpus; -sub CountCPUs() -{ - if (open(my $fh, "<", "/proc/cpuinfo")) - { - # Linux - map { $ncpus++ if (/^processor/); } <$fh>; - close($fh); - } - $ncpus ||= 1; -} - sub BuildNative() { mkdir "$DataDir/build-native" if (! -d "$DataDir/build-native"); -- 2.17.1
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com> --- testbot/bin/build/Build.pl | 29 ++++++++++++----------------- testbot/bin/build/Reconfig.pl | 33 ++++++++++++++------------------- 2 files changed, 26 insertions(+), 36 deletions(-) diff --git a/testbot/bin/build/Build.pl b/testbot/bin/build/Build.pl index 001f5eb18..3fe0e14ea 100755 --- a/testbot/bin/build/Build.pl +++ b/testbot/bin/build/Build.pl @@ -43,32 +43,27 @@ sub BEGIN use WineTestBot::Config; use WineTestBot::PatchUtils; +my $LogFileName = "$LogDir/Build.log"; + sub InfoMsg(@) { my $OldUMask = umask(002); - if (open LOGFILE, ">>$LogDir/Build.log") + if (open(my $Log, ">>", $LogFileName)) { - print LOGFILE @_; - close LOGFILE; + print $Log @_; + close($Log); } umask($OldUMask); } sub LogMsg(@) { - my $OldUMask = umask(002); - if (open LOGFILE, ">>$LogDir/Build.log") - { - print LOGFILE "Build: ", @_; - close LOGFILE; - } - umask($OldUMask); + InfoMsg "Build: ", @_; } sub FatalError(@) { LogMsg @_; - exit 1; } @@ -92,7 +87,7 @@ sub ApplyPatch($) system("( cd $DataDir/wine && set -x && " . " git apply --verbose $PatchFile && " . " git add -A " . - ") >> $LogDir/Build.log 2>&1"); + ") >>$LogFileName 2>&1"); if ($? != 0) { LogMsg "Patch failed to apply\n"; @@ -105,7 +100,7 @@ sub ApplyPatch($) InfoMsg "\nRunning make_makefiles\n"; system("( cd $DataDir/wine && set -x && " . " ./tools/make_makefiles " . - ") >> $LogDir/Build.log 2>&1"); + ") >>$LogFileName 2>&1"); if ($? != 0) { LogMsg "make_makefiles failed\n"; @@ -118,7 +113,7 @@ sub ApplyPatch($) InfoMsg "\nRunning autoconf\n"; system("( cd $DataDir/wine && set -x && " . " autoconf " . - ") >>$LogDir/Build.log 2>&1"); + ") >>$LogFileName 2>&1"); if ($? != 0) { LogMsg "Autoconf failed\n"; @@ -136,7 +131,7 @@ sub BuildNative() InfoMsg "\nRebuilding native tools\n"; system("( cd $DataDir/build-native && set -x && " . " time make -j$ncpus __tooldeps__ " . - ") >>$LogDir/Build.log 2>&1"); + ") >>$LogFileName 2>&1"); if ($? != 0) { LogMsg "Rebuild of native tools failed\n"; @@ -162,7 +157,7 @@ sub BuildTestExecutables($$) InfoMsg "\nBuilding the $Bits-bit test executable(s)\n"; system("( cd $DataDir/build-mingw$Bits && set -x && " . " time make -j$ncpus ". join(" ", sort @BuildDirs) . - ") >>$LogDir/Build.log 2>&1"); + ") >>$LogFileName 2>&1"); if ($? != 0) { LogMsg "Rebuild of $Bits-bit crossbuild failed\n"; @@ -186,7 +181,7 @@ $ENV{PATH} = "/usr/lib/ccache:/usr/bin:/bin"; delete $ENV{ENV}; # Start with a clean logfile -unlink("$LogDir/Build.log"); +unlink($LogFileName); my ($PatchFile, $BitIndicators); if (@ARGV == 2) diff --git a/testbot/bin/build/Reconfig.pl b/testbot/bin/build/Reconfig.pl index bc179951d..babc4a04b 100755 --- a/testbot/bin/build/Reconfig.pl +++ b/testbot/bin/build/Reconfig.pl @@ -42,32 +42,27 @@ sub BEGIN use WineTestBot::Config; +my $LogFileName = "$LogDir/Reconfig.log"; + sub InfoMsg(@) { my $OldUMask = umask(002); - if (open LOGFILE, ">>$LogDir/Reconfig.log") + if (open(my $Log, ">>", $LogFileName)) { - print LOGFILE @_; - close LOGFILE; + print $Log @_; + close($Log); } umask($OldUMask); } sub LogMsg(@) { - my $OldUMask = umask(002); - if (open LOGFILE, ">>$LogDir/Reconfig.log") - { - print LOGFILE "Reconfig: ", @_; - close LOGFILE; - } - umask($OldUMask); + InfoMsg "Reconfig: ", @_; } sub FatalError(@) { LogMsg @_; - exit 1; } @@ -92,7 +87,7 @@ sub BuildTestAgentd() InfoMsg "\nBuilding the native testagentd\n"; system("( cd $::RootDir/src/testagentd && set -x && " . " time make -j$ncpus build " . - ") >>$LogDir/Reconfig.log 2>&1"); + ") >>$LogFileName 2>&1"); if ($? != 0) { LogMsg "Build testagentd failed\n"; @@ -103,7 +98,7 @@ sub BuildTestAgentd() InfoMsg "\nRebuilding the Windows TestAgentd\n"; system("( cd $::RootDir/src/testagentd && set -x && " . " time make -j$ncpus iso " . - ") >>$LogDir/Reconfig.log 2>&1"); + ") >>$LogFileName 2>&1"); if ($? != 0) { LogMsg "Build winetestbot.iso failed\n"; @@ -118,7 +113,7 @@ sub BuildTestLauncher() InfoMsg "\nRebuilding TestLauncher\n"; system("( cd $::RootDir/src/TestLauncher && set -x && " . " time make -j$ncpus" . - ") >>$LogDir/Reconfig.log 2>&1"); + ") >>$LogFileName 2>&1"); if ($? != 0) { LogMsg "Build TestLauncher failed\n"; @@ -131,7 +126,7 @@ sub BuildTestLauncher() sub GitPull() { InfoMsg "Updating the Wine source\n"; - system("cd $DataDir/wine && git pull >> $LogDir/Reconfig.log 2>&1"); + system("cd $DataDir/wine && git pull >>$LogFileName 2>&1"); if ($? != 0) { LogMsg "Git pull failed\n"; @@ -167,7 +162,7 @@ sub BuildNative() " rm -rf * && " . " time ../wine/configure --enable-win64 --without-x --without-freetype --disable-winetest && " . " time make -j$ncpus __tooldeps__ " . - ") >>$LogDir/Reconfig.log 2>&1"); + ") >>$LogFileName 2>&1"); if ($? != 0) { @@ -191,7 +186,7 @@ sub BuildCross($) " rm -rf * && " . " time ../wine/configure --host=$Host --with-wine-tools=../build-native --without-x --without-freetype --disable-winetest && " . " time make -j$ncpus buildtests" . - ") >>$LogDir/Reconfig.log 2>&1"); + ") >>$LogFileName 2>&1"); if ($? != 0) { LogMsg "Build cross ($Bits bits) failed\n"; @@ -204,8 +199,8 @@ sub BuildCross($) $ENV{PATH} = "/usr/lib/ccache:/usr/bin:/bin"; delete $ENV{ENV}; -# Start with clean logfile -unlink("$LogDir/Reconfig.log"); +# Start with a clean logfile +unlink($LogFileName); if (! -d "$DataDir/staging" and ! mkdir "$DataDir/staging") { -- 2.17.1
participants (1)
-
Francois Gouget