a34c2ff676ba56df7a9889e69b0d6668bb3d225a
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 ####################"
32 cat <<EOF > sum2junit.py
34 from datetime import datetime
36 from xml.etree.ElementTree import ElementTree, Element, SubElement
39 r"^(PASS|XPASS|FAIL|XFAIL|KFAIL|DUPLICATE|UNTESTED|UNSUPPORTED|UNRESOLVED): (.*?\.exp): (.*)"
46 now = datetime.now().isoformat(timespec="seconds")
51 "xmlns": "https://raw.githubusercontent.com/windyroad/JUnit-Schema/master/JUnit.xsd"
54 testsuite = SubElement(
63 "hostname": "hostname",
66 SubElement(testsuite, "properties")
68 for line in sys.stdin:
69 m = line_re.match(line)
73 state, exp_filename, test_name = m.groups()
75 testcase_name = "{} - {}".format(exp_filename, test_name)
77 testcase = SubElement(
80 {"name": testcase_name, "classname": "classname", "time": "0"},
83 if state in ("PASS", "XFAIL", "KFAIL"):
85 elif state in ("FAIL", "XPASS"):
87 SubElement(testcase, "failure", {"type": state})
88 elif state in ("UNRESOLVED", "DUPLICATE"):
90 SubElement(testcase, "error", {"type": state})
91 elif state in ("UNTESTED", "UNSUPPORTED"):
93 SubElement(testcase, "skipped")
97 testsuite.attrib["tests"] = str(pass_count + fail_count + skip_count)
98 testsuite.attrib["failures"] = str(fail_count)
99 testsuite.attrib["skipped"] = str(skip_count)
100 testsuite.attrib["errors"] = str(error_count)
102 SubElement(testsuite, "system-out")
103 SubElement(testsuite, "system-err")
105 et = ElementTree(testsuites)
106 et.write(sys.stdout, encoding="unicode")
108 sys.exit(1 if fail_count > 0 or error_count > 0 else 0)
111 python3 sum2junit.py
< "$infile" > "$outfile"
115 WORKSPACE
=${WORKSPACE:-}
123 SRCDIR
="$WORKSPACE/src/binutils-gdb"
124 TMPDIR
="$WORKSPACE/tmp"
127 # Create tmp directory
132 export CFLAGS
="-O2 -fsanitize=address"
133 export CXXFLAGS
="-O2 -fsanitize=address -D_GLIBCXX_DEBUG=1"
134 export LDFLAGS
="-fsanitize=address"
136 # Set platform variables
145 # Print build env details
147 print_tooling || true
149 # Enter the source directory
152 # Run bootstrap in the source directory prior to configure
155 # Get source version from configure script
156 #eval "$(grep '^PACKAGE_VERSION=' ./configure)"
157 #PACKAGE_VERSION=${PACKAGE_VERSION//\-pre*/}
159 # Set configure options and environment variables for each build
161 CONF_OPTS
=("--prefix=$PREFIX")
165 echo "Standard configuration"
168 CONF_OPTS
+=("--disable-binutils" "--disable-ld" "--disable-gold" "--disable-gas" "--disable-sim" "--disable-gprof")
171 CONF_OPTS
+=("--with-system-readline" "--with-system-zlib")
173 # Enable optional features
174 CONF_OPTS
+=("--enable-targets=all" "--with-expat=yes" "--with-python=python3" "--with-guile=guile-2.2" "--enable-libctf")
176 CONF_OPTS
+=("--enable-build-warnings" "--enable-gdb-build-warnings" "--enable-unit-tests")
182 # oot : out-of-tree build
183 # dist : build via make dist
184 # oot-dist: build via make dist out-of-tree
185 # * : normal tree build
187 # Make sure to move to the build directory and run configure
191 echo "Out of tree build"
193 # Create and enter a temporary build directory
194 builddir
=$
(mktemp
-d)
197 "$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure
201 # We are now inside a configured build directory
204 $MAKE -j "$($NPROC)" V
=1 MAKEINFO
=/bin
/true
206 # Install in the workspace
207 $MAKE install DESTDIR
="$WORKSPACE"
209 # Run tests, don't fail now, we know that "make check" is going to fail,
210 # since some tests don't pass.
212 # Disable ASan leaks reporting, it might break some tests since it adds
213 # unexpected output when GDB exits.
214 ASAN_OPTIONS
=detect_leaks
=0 $MAKE -C gdb
--keep-going check
-j "$($NPROC)" || true
216 # Copy the dejagnu test results for archiving before cleaning the build dir
217 mkdir
"${WORKSPACE}/results"
218 cp gdb
/testsuite
/gdb.log
"${WORKSPACE}/results/"
219 cp gdb
/testsuite
/gdb.
sum "${WORKSPACE}/results/"
221 # Convert results to JUnit format.
223 sum2junit gdb
/testsuite
/gdb.
sum "${WORKSPACE}/results/gdb.xml" || failed_tests
=1
225 # Clean the build directory
228 # Cleanup rpath in executables and shared libraries
229 #find "$WORKSPACE/$PREFIX/bin" -type f -perm -0500 -exec chrpath --delete {} \;
230 #find "$WORKSPACE/$PREFIX/lib" -name "*.so" -exec chrpath --delete {} \;
232 # Remove libtool .la files
233 find "$WORKSPACE/$PREFIX/lib" -name "*.la" -exec rm -f {} \
;
235 # Exit with failure if any of the tests failed
This page took 0.049905 seconds and 4 git commands to generate.