3 # Copyright (C) 2021 Michael Jeanson <mjeanson@efficios.com>
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 # Assume we are in the configured build directory
22 echo "#################### BEGIN config.log ####################"
24 echo "#################### END config.log ####################"
45 tool
=$
(grep "tests ===" "$infile" |
tr -s ' ' | cut
-d ' ' -f 2)
47 # Get the counts for tests that didn't work properly
48 skipped
=$
(grep -E -c '^UNRESOLVED|^UNTESTED|^UNSUPPORTED' "$infile" || true
)
49 if test x
"${skipped}" = x
; then
53 # The total of successful results are PASS and XFAIL
54 passes
=$
(grep -E -c '^PASS|XFAIL' "$infile" || true
)
55 if test x
"${passes}" = x
; then
59 # The total of failed results are FAIL and XPASS
60 failures
=$
(grep -E -c '^FAIL|XPASS' "$infile" || true
)
61 if test x
"${failures}" = x
; then
65 # Calculate the total number of test cases
66 total
=$
((passes
+ failures
))
67 total
=$
((total
+ skipped
))
69 cat <<EOF > "$outfile"
73 <testsuite name="DejaGnu" tests="${total}" failures="${failures}" skipped="${skipped}">
77 s2jtmpfile
="$(mktemp)"
78 grep -E 'PASS|XPASS|FAIL|UNTESTED|UNSUPPORTED|UNRESOLVED' "$infile" > "$s2jtmpfile" || true
83 result
=$
(echo "$line" | cut
-d ' ' -f 1 |
tr -d ':')
84 name
=$
(echo "$line" | cut
-d ' ' -f 2 |
tr -d '\"><;:\[\]^\\&?@')
85 message
=$
(echo "$line" | cut
-d ' ' -f 3-50 |
tr -d '\"><;:\[\]^\\&?@')
87 echo " <testcase name=\"${name}\" classname=\"${tool}-${result}\">" >> "$outfile"
90 # No message for successful tests in junit
93 if test x
"${message}" != x
; then
94 echo -n " <skipped message=\"${message}\"/>" >> "$outfile"
96 echo -n " <skipped type=\"$result\"/>" >> "$outfile"
99 XPASS|UNRESOLVED|DUPLICATE
)
100 echo -n " <failure message=\"$message\"/>" >> "$outfile"
103 echo -n " <failure message=\"$message\"/>" >> "$outfile"
106 echo " </testcase>" >> "$outfile"
111 # Write the closing tag for the test results
112 echo "</testsuite>" >> "$outfile"
113 echo "</testsuites>" >> "$outfile"
119 WORKSPACE
=${WORKSPACE:-}
127 SRCDIR
="$WORKSPACE/src/binutils-gdb"
128 TMPDIR
="$WORKSPACE/tmp"
131 # Create tmp directory
136 export CFLAGS
="-O2 -fsanitize=address"
137 export CXXFLAGS
="-O2 -fsanitize=address -D_GLIBCXX_DEBUG=1"
138 export LDFLAGS
="-fsanitize=address"
140 # Set platform variables
149 # Print build env details
151 print_tooling || true
153 # Enter the source directory
156 # Run bootstrap in the source directory prior to configure
159 # Get source version from configure script
160 #eval "$(grep '^PACKAGE_VERSION=' ./configure)"
161 #PACKAGE_VERSION=${PACKAGE_VERSION//\-pre*/}
163 # Set configure options and environment variables for each build
165 CONF_OPTS
=("--prefix=$PREFIX")
169 echo "Standard configuration"
172 CONF_OPTS
+=("--disable-binutils" "--disable-ld" "--disable-gold" "--disable-gas" "--disable-sim" "--disable-gprof")
175 CONF_OPTS
+=("--with-system-readline" "--with-system-zlib")
177 # Enable optional features
178 CONF_OPTS
+=("--enable-targets=all" "--with-expat=yes" "--with-python=python3" "--with-guile=guile-2.2" "--enable-libctf")
180 CONF_OPTS
+=("--enable-build-warnings" "--enable-gdb-build-warnings" "--enable-unit-tests")
186 # oot : out-of-tree build
187 # dist : build via make dist
188 # oot-dist: build via make dist out-of-tree
189 # * : normal tree build
191 # Make sure to move to the build directory and run configure
195 echo "Out of tree build"
197 # Create and enter a temporary build directory
198 builddir
=$
(mktemp
-d)
201 "$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure
205 # We are now inside a configured build directory
208 $MAKE -j "$($NPROC)" V
=1 MAKEINFO
=/bin
/true
210 # Install in the workspace
211 $MAKE install DESTDIR
="$WORKSPACE"
213 # Run tests, don't fail now, we want to run the archiving steps
215 $MAKE -C gdb
--keep-going check
-j "$($NPROC)" || failed_tests
=1
217 # Copy the dejagnu test results for archiving before cleaning the build dir
218 mkdir
"${WORKSPACE}/results"
219 cp gdb
/testsuite
/gdb.log
"${WORKSPACE}/results/"
220 cp gdb
/testsuite
/gdb.
sum "${WORKSPACE}/results/"
221 sum2junit gdb
/testsuite
/gdb.
sum "${WORKSPACE}/results/gdb.xml"
223 # Clean the build directory
226 # Cleanup rpath in executables and shared libraries
227 #find "$WORKSPACE/$PREFIX/bin" -type f -perm -0500 -exec chrpath --delete {} \;
228 #find "$WORKSPACE/$PREFIX/lib" -name "*.so" -exec chrpath --delete {} \;
230 # Remove libtool .la files
231 find "$WORKSPACE/$PREFIX/lib" -name "*.la" -exec rm -f {} \
;
233 # Exit with failure if any of the tests failed