xref: /openbsd-src/gnu/llvm/llvm/utils/release/test-release.sh (revision d415bd752c734aee168c4ee86ff32e8cc249eb16)
1#!/usr/bin/env bash
2#===-- test-release.sh - Test the LLVM release candidates ------------------===#
3#
4# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5# See https://llvm.org/LICENSE.txt for license information.
6# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7#
8#===------------------------------------------------------------------------===#
9#
10# Download, build, and test the release candidate for an LLVM release.
11#
12#===------------------------------------------------------------------------===#
13
14System=`uname -s`
15Machine=`uname -m`
16if [ "$System" = "FreeBSD" ]; then
17    MAKE=gmake
18else
19    MAKE=make
20fi
21generator="Unix Makefiles"
22
23Release=""
24Release_no_dot=""
25RC=""
26Triple=""
27use_gzip="no"
28do_checkout="yes"
29do_debug="no"
30do_asserts="no"
31do_compare="yes"
32do_rt="yes"
33do_clang_tools="yes"
34do_libs="yes"
35do_libcxxabi="yes"
36do_libunwind="yes"
37do_test_suite="yes"
38do_openmp="yes"
39do_lld="yes"
40do_lldb="yes"
41do_polly="yes"
42do_mlir="yes"
43do_flang="yes"
44do_silent_log="no"
45BuildDir="`pwd`"
46ExtraConfigureFlags=""
47ExportBranch=""
48git_ref=""
49
50do_bolt="no"
51if [ "$System" = "Linux" ]; then
52    case $Machine in
53        x86_64 | arm64 | aarch64 )
54            do_bolt="yes"
55            ;;
56    esac
57fi
58
59function usage() {
60    echo "usage: `basename $0` -release X.Y.Z -rc NUM [OPTIONS]"
61    echo ""
62    echo " -release X.Y.Z       The release version to test."
63    echo " -rc NUM              The pre-release candidate number."
64    echo " -final               The final release candidate."
65    echo " -triple TRIPLE       The target triple for this machine."
66    echo " -j NUM               Number of compile jobs to run. [default: 3]"
67    echo " -build-dir DIR       Directory to perform testing in. [default: pwd]"
68    echo " -no-checkout         Don't checkout the sources from SVN."
69    echo " -test-debug          Test the debug build. [default: no]"
70    echo " -test-asserts        Test with asserts on. [default: no]"
71    echo " -no-compare-files    Don't test that phase 2 and 3 files are identical."
72    echo " -use-gzip            Use gzip instead of xz."
73    echo " -use-ninja           Use ninja instead of make/gmake."
74    echo " -configure-flags FLAGS  Extra flags to pass to the configure step."
75    echo " -git-ref sha         Use the specified git ref for testing instead of a release."
76    echo " -no-rt               Disable check-out & build Compiler-RT"
77    echo " -no-clang-tools      Disable check-out & build clang-tools-extra"
78    echo " -no-libs             Disable check-out & build libcxx/libcxxabi/libunwind"
79    echo " -no-libcxxabi        Disable check-out & build libcxxabi"
80    echo " -no-libunwind        Disable check-out & build libunwind"
81    echo " -no-test-suite       Disable check-out & build test-suite"
82    echo " -no-openmp           Disable check-out & build libomp"
83    echo " -no-lld              Disable check-out & build lld"
84    echo " -lldb                Enable check-out & build lldb"
85    echo " -no-lldb             Disable check-out & build lldb (default)"
86    echo " -no-polly            Disable check-out & build Polly"
87    echo " -no-mlir             Disable check-out & build MLIR"
88    echo " -no-flang            Disable check-out & build Flang"
89    echo " -silent-log          Don't output build logs to stdout"
90}
91
92while [ $# -gt 0 ]; do
93    case $1 in
94        -release | --release )
95            shift
96            Release="$1"
97            Release_no_dot="`echo $1 | sed -e 's,\.,,g'`"
98            ;;
99        -rc | --rc | -RC | --RC )
100            shift
101            RC="rc$1"
102            ;;
103        -final | --final )
104            RC=final
105            ;;
106        -git-ref | --git-ref )
107            shift
108            Release="test"
109            Release_no_dot="test"
110            ExportBranch="$1"
111            RC="`echo $ExportBranch | sed -e 's,/,_,g'`"
112            git_ref="$1"
113            echo "WARNING: Using the ref $git_ref instead of a release tag"
114            echo "         This is intended to aid new packagers in trialing "
115            echo "         builds without requiring a tag to be created first"
116            ;;
117        -triple | --triple )
118            shift
119            Triple="$1"
120            ;;
121        -configure-flags | --configure-flags )
122            shift
123            ExtraConfigureFlags="$1"
124            ;;
125        -j* )
126            NumJobs="`echo $1 | sed -e 's,-j\([0-9]*\),\1,g'`"
127            if [ -z "$NumJobs" ]; then
128                shift
129                NumJobs="$1"
130            fi
131            ;;
132        -use-ninja )
133            MAKE=ninja
134            generator=Ninja
135            ;;
136        -build-dir | --build-dir | -builddir | --builddir )
137            shift
138            BuildDir="$1"
139            ;;
140        -no-checkout | --no-checkout )
141            do_checkout="no"
142            ;;
143        -test-debug | --test-debug )
144            do_debug="yes"
145            ;;
146        -test-asserts | --test-asserts )
147            do_asserts="yes"
148            ;;
149        -no-compare-files | --no-compare-files )
150            do_compare="no"
151            ;;
152        -use-gzip | --use-gzip )
153            use_gzip="yes"
154            ;;
155        -no-rt )
156            do_rt="no"
157            ;;
158        -no-libs )
159            do_libs="no"
160            ;;
161        -no-clang-tools )
162            do_clang_tools="no"
163            ;;
164        -no-libcxxabi )
165            do_libcxxabi="no"
166            ;;
167        -no-libunwind )
168            do_libunwind="no"
169            ;;
170        -no-test-suite )
171            do_test_suite="no"
172            ;;
173        -no-openmp )
174            do_openmp="no"
175            ;;
176        -bolt )
177            do_bolt="yes"
178            ;;
179        -no-bolt )
180            do_bolt="no"
181            ;;
182        -no-lld )
183            do_lld="no"
184            ;;
185        -lldb )
186            do_lldb="yes"
187            ;;
188        -no-lldb )
189            do_lldb="no"
190            ;;
191        -no-polly )
192            do_polly="no"
193            ;;
194        -no-mlir )
195            do_mlir="no"
196            ;;
197        -no-flang )
198            do_flang="no"
199            ;;
200        -silent-log )
201            do_silent_log="yes"
202            ;;
203        -help | --help | -h | --h | -\? )
204            usage
205            exit 0
206            ;;
207        * )
208            echo "unknown option: $1"
209            usage
210            exit 1
211            ;;
212    esac
213    shift
214done
215
216if [ $do_mlir = "no" ] && [ $do_flang = "yes" ]; then
217  echo "error: cannot build Flang without MLIR"
218  exit 1
219fi
220
221# Check required arguments.
222if [ -z "$Release" ]; then
223    echo "error: no release number specified"
224    exit 1
225fi
226if [ -z "$RC" ]; then
227    echo "error: no release candidate number specified"
228    exit 1
229fi
230if [ -z "$ExportBranch" ]; then
231    ExportBranch="tags/RELEASE_$Release_no_dot/$RC"
232fi
233if [ -z "$Triple" ]; then
234    echo "error: no target triple specified"
235    exit 1
236fi
237
238if [ "$Release" != "test" ]; then
239  if [ -n "$git_ref" ]; then
240    echo "error: can't specify both -release and -git-ref"
241    exit 1
242  fi
243  git_ref=llvmorg-$Release
244  if [ "$RC" != "final" ]; then
245    git_ref="$git_ref-$RC"
246  fi
247fi
248
249# Figure out how many make processes to run.
250if [ -z "$NumJobs" ]; then
251    NumJobs=`sysctl -n hw.activecpu 2> /dev/null || true`
252fi
253if [ -z "$NumJobs" ]; then
254    NumJobs=`sysctl -n hw.ncpu 2> /dev/null || true`
255fi
256if [ -z "$NumJobs" ]; then
257    NumJobs=`grep -c processor /proc/cpuinfo 2> /dev/null || true`
258fi
259if [ -z "$NumJobs" ]; then
260    NumJobs=3
261fi
262
263# Projects list
264projects="llvm clang"
265if [ $do_clang_tools = "yes" ]; then
266  projects="$projects clang-tools-extra"
267fi
268runtimes=""
269if [ $do_rt = "yes" ]; then
270  runtimes="$runtimes compiler-rt"
271fi
272if [ $do_libs = "yes" ]; then
273  runtimes="$runtimes libcxx"
274  if [ $do_libcxxabi = "yes" ]; then
275    runtimes="$runtimes libcxxabi"
276  fi
277  if [ $do_libunwind = "yes" ]; then
278    runtimes="$runtimes libunwind"
279  fi
280fi
281if [ $do_openmp = "yes" ]; then
282  projects="$projects openmp"
283fi
284if [ $do_bolt = "yes" ]; then
285  projects="$projects bolt"
286fi
287if [ $do_lld = "yes" ]; then
288  projects="$projects lld"
289fi
290if [ $do_lldb = "yes" ]; then
291  projects="$projects lldb"
292fi
293if [ $do_polly = "yes" ]; then
294  projects="$projects polly"
295fi
296if [ $do_mlir = "yes" ]; then
297  projects="$projects mlir"
298fi
299if [ $do_flang = "yes" ]; then
300  projects="$projects flang"
301fi
302
303# Go to the build directory (may be different from CWD)
304BuildDir=$BuildDir/$RC
305mkdir -p $BuildDir
306cd $BuildDir
307
308# Location of log files.
309LogDir=$BuildDir/logs
310mkdir -p $LogDir
311
312# Final package name.
313Package=clang+llvm-$Release
314if [ $RC != "final" ]; then
315  Package=$Package-$RC
316fi
317Package=$Package-$Triple
318
319# Errors to be highlighted at the end are written to this file.
320echo -n > $LogDir/deferred_errors.log
321
322function deferred_error() {
323  Phase="$1"
324  Flavor="$2"
325  Msg="$3"
326  echo "[${Flavor} Phase${Phase}] ${Msg}" | tee -a $LogDir/deferred_errors.log
327}
328
329# Make sure that a required program is available
330function check_program_exists() {
331  local program="$1"
332  if ! type -P $program > /dev/null 2>&1 ; then
333    echo "program '$1' not found !"
334    exit 1
335  fi
336}
337
338if [ "$System" != "Darwin" ] && [ "$System" != "SunOS" ] && [ "$System" != "AIX" ]; then
339  check_program_exists 'chrpath'
340fi
341
342if [ "$System" != "Darwin" ]; then
343  check_program_exists 'file'
344  check_program_exists 'objdump'
345fi
346
347check_program_exists ${MAKE}
348
349# Export sources to the build directory.
350function export_sources() {
351  SrcDir=$BuildDir/llvm-project
352  mkdir -p $SrcDir
353  echo "# Using git ref: $git_ref"
354
355  # GitHub allows you to download a tarball of any commit using the URL:
356  # https://github.com/$organization/$repo/archive/$ref.tar.gz
357  curl -L https://github.com/llvm/llvm-project/archive/$git_ref.tar.gz | \
358    tar -C $SrcDir --strip-components=1 -xzf -
359
360  if [ "$do_test_suite" = "yes" ]; then
361    TestSuiteSrcDir=$BuildDir/llvm-test-suite
362    mkdir -p $TestSuiteSrcDir
363
364    # We can only use named refs, like branches and tags, that exist in
365    # both the llvm-project and test-suite repos if we want to run the
366    # test suite.
367    # If the test-suite fails to download assume we are using a ref that
368    # doesn't exist in the test suite and disable it.
369    set +e
370    curl -L https://github.com/llvm/test-suite/archive/$git_ref.tar.gz | \
371      tar -C $TestSuiteSrcDir --strip-components=1 -xzf -
372    if [ $? -ne -0 ]; then
373      echo "$git_ref not found in test-suite repo, test-suite disabled."
374      do_test_suite="no"
375    fi
376    set -e
377  fi
378
379  cd $BuildDir
380}
381
382function configure_llvmCore() {
383    Phase="$1"
384    Flavor="$2"
385    ObjDir="$3"
386
387    case $Flavor in
388        Release )
389            BuildType="Release"
390            Assertions="OFF"
391            ;;
392        Release+Asserts )
393            BuildType="Release"
394            Assertions="ON"
395            ;;
396        Debug )
397            BuildType="Debug"
398            Assertions="ON"
399            ;;
400        * )
401            echo "# Invalid flavor '$Flavor'"
402            echo ""
403            return
404            ;;
405    esac
406
407    if [ "$Phase" -eq "3" ]; then
408      project_list=${projects// /;}
409      # Leading spaces will result in ";<runtime name>". This causes a CMake
410      # error because the empty string before the first ';' is treated as an
411      # unknown runtime name.
412      runtimes=$(echo $runtimes | sed -e 's/^\s*//')
413      runtime_list=${runtimes// /;}
414    else
415      project_list="clang"
416      runtime_list=""
417    fi
418    echo "# Using C compiler: $c_compiler"
419    echo "# Using C++ compiler: $cxx_compiler"
420
421    cd $ObjDir
422    echo "# Configuring llvm $Release-$RC $Flavor"
423
424    echo "#" env CC="$c_compiler" CXX="$cxx_compiler" \
425        cmake -G "$generator" \
426        -DCMAKE_BUILD_TYPE=$BuildType -DLLVM_ENABLE_ASSERTIONS=$Assertions \
427        -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
428        -DLLVM_ENABLE_PROJECTS="$project_list" \
429        -DLLVM_LIT_ARGS="-j $NumJobs $LitVerbose" \
430        -DLLVM_ENABLE_RUNTIMES="$runtime_list" \
431        $ExtraConfigureFlags $BuildDir/llvm-project/llvm \
432        2>&1 | tee $LogDir/llvm.configure-Phase$Phase-$Flavor.log
433    env CC="$c_compiler" CXX="$cxx_compiler" \
434        cmake -G "$generator" \
435        -DCMAKE_BUILD_TYPE=$BuildType -DLLVM_ENABLE_ASSERTIONS=$Assertions \
436        -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
437        -DLLVM_ENABLE_PROJECTS="$project_list" \
438        -DLLVM_LIT_ARGS="-j $NumJobs $LitVerbose" \
439        -DLLVM_ENABLE_RUNTIMES="$runtime_list" \
440        $ExtraConfigureFlags $BuildDir/llvm-project/llvm \
441        2>&1 | tee $LogDir/llvm.configure-Phase$Phase-$Flavor.log
442
443    cd $BuildDir
444}
445
446function build_llvmCore() {
447    Phase="$1"
448    Flavor="$2"
449    ObjDir="$3"
450    DestDir="$4"
451
452    Verbose="VERBOSE=1"
453    if [ ${MAKE} = 'ninja' ]; then
454      Verbose="-v"
455    fi
456    LitVerbose="-v"
457
458    redir="/dev/stdout"
459    if [ $do_silent_log == "yes" ]; then
460      echo "# Silencing build logs because of -silent-log flag..."
461      redir="/dev/null"
462    fi
463
464    cd $ObjDir
465    echo "# Compiling llvm $Release-$RC $Flavor"
466    echo "# ${MAKE} -j $NumJobs $Verbose"
467    ${MAKE} -j $NumJobs $Verbose \
468        2>&1 | tee $LogDir/llvm.make-Phase$Phase-$Flavor.log > $redir
469
470    echo "# Installing llvm $Release-$RC $Flavor"
471    echo "# ${MAKE} install"
472    DESTDIR="${DestDir}" ${MAKE} install \
473        2>&1 | tee $LogDir/llvm.install-Phase$Phase-$Flavor.log > $redir
474    cd $BuildDir
475}
476
477function test_llvmCore() {
478    Phase="$1"
479    Flavor="$2"
480    ObjDir="$3"
481
482    KeepGoing="-k"
483    if [ ${MAKE} = 'ninja' ]; then
484      # Ninja doesn't have a documented "keep-going-forever" mode, we need to
485      # set a limit on how many jobs can fail before we give up.
486      KeepGoing="-k 100"
487    fi
488
489    cd $ObjDir
490    if ! ( ${MAKE} -j $NumJobs $KeepGoing $Verbose check-all \
491        2>&1 | tee $LogDir/llvm.check-Phase$Phase-$Flavor.log ) ; then
492      deferred_error $Phase $Flavor "check-all failed"
493    fi
494
495    if [ $do_test_suite = 'yes' ]; then
496      cd $TestSuiteBuildDir
497      env CC="$c_compiler" CXX="$cxx_compiler" \
498          cmake $TestSuiteSrcDir -G "$generator" -DTEST_SUITE_LIT=$Lit \
499                -DTEST_SUITE_HOST_CC=$build_compiler
500
501      if ! ( ${MAKE} -j $NumJobs $KeepGoing $Verbose check \
502          2>&1 | tee $LogDir/llvm.check-Phase$Phase-$Flavor.log ) ; then
503        deferred_error $Phase $Flavor "test suite failed"
504      fi
505    fi
506    cd $BuildDir
507}
508
509# Clean RPATH. Libtool adds the build directory to the search path, which is
510# not necessary --- and even harmful --- for the binary packages we release.
511function clean_RPATH() {
512  if [ "$System" = "Darwin" ] || [ "$System" = "SunOS" ] || [ "$System" = "AIX" ]; then
513    return
514  fi
515  local InstallPath="$1"
516  for Candidate in `find $InstallPath/{bin,lib} -type f`; do
517    if file $Candidate | grep ELF | egrep 'executable|shared object' > /dev/null 2>&1 ; then
518      if rpath=`objdump -x $Candidate | grep 'RPATH'` ; then
519        rpath=`echo $rpath | sed -e's/^ *RPATH *//'`
520        if [ -n "$rpath" ]; then
521          newrpath=`echo $rpath | sed -e's/.*\(\$ORIGIN[^:]*\).*/\1/'`
522          chrpath -r $newrpath $Candidate 2>&1 > /dev/null 2>&1
523        fi
524      fi
525    fi
526  done
527}
528
529# Create a package of the release binaries.
530function package_release() {
531    cwd=`pwd`
532    cd $BuildDir/Phase3/Release
533    mv llvmCore-$Release-$RC.install/usr/local $Package
534    if [ "$use_gzip" = "yes" ]; then
535      tar cf - $Package | gzip -9c > $BuildDir/$Package.tar.gz
536    else
537      tar cf - $Package | xz -9ce -T $NumJobs > $BuildDir/$Package.tar.xz
538    fi
539    mv $Package llvmCore-$Release-$RC.install/usr/local
540    cd $cwd
541}
542
543# Exit if any command fails
544# Note: pipefail is necessary for running build commands through
545# a pipe (i.e. it changes the output of ``false | tee /dev/null ; echo $?``)
546set -e
547set -o pipefail
548
549# Turn off core dumps, as some test cases can easily fill up even the largest
550# file systems.
551ulimit -c 0
552
553if [ "$do_checkout" = "yes" ]; then
554    export_sources
555fi
556
557# Setup the test-suite.  Do this early so we can catch failures before
558# we do the full 3 stage build.
559if [ $do_test_suite = "yes" ]; then
560  check_program_exists 'python3'
561  venv="python3 -m venv"
562
563  SandboxDir="$BuildDir/sandbox"
564  Lit=$SandboxDir/bin/lit
565  TestSuiteBuildDir="$BuildDir/test-suite-build"
566  TestSuiteSrcDir="$BuildDir/llvm-test-suite"
567
568  ${venv} $SandboxDir
569  $SandboxDir/bin/python $BuildDir/llvm-project/llvm/utils/lit/setup.py install
570  mkdir -p $TestSuiteBuildDir
571fi
572
573(
574Flavors="Release"
575if [ "$do_debug" = "yes" ]; then
576    Flavors="Debug $Flavors"
577fi
578if [ "$do_asserts" = "yes" ]; then
579    Flavors="$Flavors Release+Asserts"
580fi
581
582for Flavor in $Flavors ; do
583    echo ""
584    echo ""
585    echo "********************************************************************************"
586    echo "  Release:     $Release-$RC"
587    echo "  Build:       $Flavor"
588    echo "  System Info: "
589    echo "    `uname -a`"
590    echo "********************************************************************************"
591    echo ""
592
593    c_compiler="$CC"
594    cxx_compiler="$CXX"
595    build_compiler="$CC"
596    [[ -z "$build_compiler" ]] && build_compiler="cc"
597    llvmCore_phase1_objdir=$BuildDir/Phase1/$Flavor/llvmCore-$Release-$RC.obj
598    llvmCore_phase1_destdir=$BuildDir/Phase1/$Flavor/llvmCore-$Release-$RC.install
599
600    llvmCore_phase2_objdir=$BuildDir/Phase2/$Flavor/llvmCore-$Release-$RC.obj
601    llvmCore_phase2_destdir=$BuildDir/Phase2/$Flavor/llvmCore-$Release-$RC.install
602
603    llvmCore_phase3_objdir=$BuildDir/Phase3/$Flavor/llvmCore-$Release-$RC.obj
604    llvmCore_phase3_destdir=$BuildDir/Phase3/$Flavor/llvmCore-$Release-$RC.install
605
606    rm -rf $llvmCore_phase1_objdir
607    rm -rf $llvmCore_phase1_destdir
608
609    rm -rf $llvmCore_phase2_objdir
610    rm -rf $llvmCore_phase2_destdir
611
612    rm -rf $llvmCore_phase3_objdir
613    rm -rf $llvmCore_phase3_destdir
614
615    mkdir -p $llvmCore_phase1_objdir
616    mkdir -p $llvmCore_phase1_destdir
617
618    mkdir -p $llvmCore_phase2_objdir
619    mkdir -p $llvmCore_phase2_destdir
620
621    mkdir -p $llvmCore_phase3_objdir
622    mkdir -p $llvmCore_phase3_destdir
623
624    ############################################################################
625    # Phase 1: Build llvmCore and clang
626    echo "# Phase 1: Building llvmCore"
627    configure_llvmCore 1 $Flavor $llvmCore_phase1_objdir
628    build_llvmCore 1 $Flavor \
629        $llvmCore_phase1_objdir $llvmCore_phase1_destdir
630    clean_RPATH $llvmCore_phase1_destdir/usr/local
631
632    ########################################################################
633    # Phase 2: Build llvmCore with newly built clang from phase 1.
634    c_compiler=$llvmCore_phase1_destdir/usr/local/bin/clang
635    cxx_compiler=$llvmCore_phase1_destdir/usr/local/bin/clang++
636    echo "# Phase 2: Building llvmCore"
637    configure_llvmCore 2 $Flavor $llvmCore_phase2_objdir
638    build_llvmCore 2 $Flavor \
639        $llvmCore_phase2_objdir $llvmCore_phase2_destdir
640    clean_RPATH $llvmCore_phase2_destdir/usr/local
641
642    ########################################################################
643    # Phase 3: Build llvmCore with newly built clang from phase 2.
644    c_compiler=$llvmCore_phase2_destdir/usr/local/bin/clang
645    cxx_compiler=$llvmCore_phase2_destdir/usr/local/bin/clang++
646    echo "# Phase 3: Building llvmCore"
647    configure_llvmCore 3 $Flavor $llvmCore_phase3_objdir
648    build_llvmCore 3 $Flavor \
649        $llvmCore_phase3_objdir $llvmCore_phase3_destdir
650    clean_RPATH $llvmCore_phase3_destdir/usr/local
651
652    ########################################################################
653    # Testing: Test phase 3
654    c_compiler=$llvmCore_phase3_destdir/usr/local/bin/clang
655    cxx_compiler=$llvmCore_phase3_destdir/usr/local/bin/clang++
656    echo "# Testing - built with clang"
657    test_llvmCore 3 $Flavor $llvmCore_phase3_objdir
658
659    ########################################################################
660    # Compare .o files between Phase2 and Phase3 and report which ones
661    # differ.
662    if [ "$do_compare" = "yes" ]; then
663        echo
664        echo "# Comparing Phase 2 and Phase 3 files"
665        for p2 in `find $llvmCore_phase2_objdir -name '*.o'` ; do
666            p3=`echo $p2 | sed -e 's,Phase2,Phase3,'`
667            # Substitute 'Phase2' for 'Phase3' in the Phase 2 object file in
668            # case there are build paths in the debug info. Do the same sub-
669            # stitution on both files in case the string occurrs naturally.
670            if ! cmp -s \
671                <(env LC_CTYPE=C sed -e 's,Phase1,Phase2,g' -e 's,Phase2,Phase3,g' $p2) \
672                <(env LC_CTYPE=C sed -e 's,Phase1,Phase2,g' -e 's,Phase2,Phase3,g' $p3) \
673                16 16; then
674                echo "file `basename $p2` differs between phase 2 and phase 3"
675            fi
676        done
677    fi
678done
679
680) 2>&1 | tee $LogDir/testing.$Release-$RC.log
681
682if [ "$use_gzip" = "yes" ]; then
683  echo "# Packaging the release as $Package.tar.gz"
684else
685  echo "# Packaging the release as $Package.tar.xz"
686fi
687package_release
688
689set +e
690
691# Woo hoo!
692echo "### Testing Finished ###"
693echo "### Logs: $LogDir"
694
695echo "### Errors:"
696if [ -s "$LogDir/deferred_errors.log" ]; then
697  cat "$LogDir/deferred_errors.log"
698  exit 1
699else
700  echo "None."
701fi
702
703exit 0
704