jjb: binutils-gdb: remove cc
[lttng-ci.git] / scripts / binutils-gdb / build.sh
index 726cc1a8f2e4feb09759d44f20a864191b4dbe57..5c737fc67d9857e7a3a3f3cd01073a4a43e5a404 100755 (executable)
@@ -29,90 +29,86 @@ sum2junit() {
     local infile="$1"
     local outfile="$2"
 
-    local tool
-    local skipped
-    local passes
-    local failures
-    local total
-    local s2jtmpfile
-
-    local result
-    local name
-    local message
-
-    set +x
-
-    tool=$(grep "tests ===" "$infile" | tr -s ' ' | cut -d ' ' -f 2)
-
-    # Get the counts for tests that didn't work properly
-    skipped=$(grep -E -c '^UNRESOLVED|^UNTESTED|^UNSUPPORTED' "$infile" || true)
-    if test x"${skipped}" = x; then
-        skipped=0
-    fi
-
-    # The total of successful results are PASS and XFAIL
-    passes=$(grep -E -c '^PASS|XFAIL' "$infile" || true)
-    if test x"${passes}" = x; then
-        passes=0
-    fi
-
-    # The total of failed results are FAIL and XPASS
-    failures=$(grep -E -c '^FAIL|XPASS' "$infile" || true)
-    if test x"${failures}" = x; then
-        failures=0
-    fi
-
-    # Calculate the total number of test cases
-    total=$((passes + failures))
-    total=$((total + skipped))
-
-    cat <<EOF > "$outfile"
-<?xml version="1.0"?>
-
-<testsuites>
-<testsuite name="DejaGnu" tests="${total}" failures="${failures}" skipped="${skipped}">
-
+cat <<EOF > sum2junit.py
+import sys
+from datetime import datetime
+import re
+from xml.etree.ElementTree import ElementTree, Element, SubElement
+
+line_re = re.compile(
+    r"^(PASS|XPASS|FAIL|XFAIL|KFAIL|DUPLICATE|UNTESTED|UNSUPPORTED|UNRESOLVED): (.*?\.exp): (.*)"
+)
+
+pass_count = 0
+fail_count = 0
+skip_count = 0
+error_count = 0
+now = datetime.now().isoformat(timespec="seconds")
+
+testsuites = Element(
+    "testsuites",
+    {
+        "xmlns": "https://raw.githubusercontent.com/windyroad/JUnit-Schema/master/JUnit.xsd"
+    },
+)
+testsuite = SubElement(
+    testsuites,
+    "testsuite",
+    {
+        "name": "GDB",
+        "package": "package",
+        "id": "0",
+        "time": "1",
+        "timestamp": now,
+        "hostname": "hostname",
+    },
+)
+SubElement(testsuite, "properties")
+
+for line in sys.stdin:
+    m = line_re.match(line)
+    if not m:
+        continue
+
+    state, exp_filename, test_name = m.groups()
+
+    testcase_name = "{} - {}".format(exp_filename, test_name)
+
+    testcase = SubElement(
+        testsuite,
+        "testcase",
+        {"name": testcase_name, "classname": "classname", "time": "0"},
+    )
+
+    if state in ("PASS", "XFAIL", "KFAIL"):
+        pass_count += 1
+    elif state in ("FAIL", "XPASS"):
+        fail_count += 1
+        SubElement(testcase, "failure", {"type": state})
+    elif state in ("UNRESOLVED", "DUPLICATE"):
+        error_count += 1
+        SubElement(testcase, "error", {"type": state})
+    elif state in ("UNTESTED", "UNSUPPORTED"):
+        skip_count += 1
+        SubElement(testcase, "skipped")
+    else:
+        assert False
+
+testsuite.attrib["tests"] = str(pass_count + fail_count + skip_count)
+testsuite.attrib["failures"] = str(fail_count)
+testsuite.attrib["skipped"] = str(skip_count)
+testsuite.attrib["errors"] = str(error_count)
+
+SubElement(testsuite, "system-out")
+SubElement(testsuite, "system-err")
+
+et = ElementTree(testsuites)
+et.write(sys.stdout, encoding="unicode")
+
+sys.exit(1 if fail_count > 0 or error_count > 0 else 0)
 EOF
 
-    s2jtmpfile="$(mktemp)"
-    grep -E 'PASS|XPASS|FAIL|UNTESTED|UNSUPPORTED|UNRESOLVED' "$infile" > "$s2jtmpfile" || true
-
-    while read -r line
-    do
-        echo -n "."
-        result=$(echo "$line" | cut -d ' ' -f 1 | tr -d ':')
-        name=$(echo "$line" | cut -d ' ' -f 2 | tr -d '\"><;:\[\]^\\&?@')
-        message=$(echo "$line" | cut -d ' ' -f 3-50 | tr -d '\"><;:\[\]^\\&?@')
-
-        echo "    <testcase name=\"${name}\" classname=\"${tool}-${result}\">" >> "$outfile"
-        case "${result}" in
-        PASS|XFAIL|KFAIL)
-            # No message for successful tests in junit
-            ;;
-        UNSUPPORTED|UNTESTED)
-           if test x"${message}" != x; then
-               echo -n "        <skipped message=\"${message}\"/>" >> "$outfile"
-           else
-               echo -n "        <skipped type=\"$result\"/>" >> "$outfile"
-           fi
-           ;;
-       XPASS|UNRESOLVED|DUPLICATE)
-           echo -n "        <failure message=\"$message\"/>" >> "$outfile"
-           ;;
-       *)
-           echo -n "        <failure message=\"$message\"/>" >> "$outfile"
-        esac
-
-        echo "    </testcase>" >> "$outfile"
-    done < "$s2jtmpfile"
-
-    rm -f "$s2jtmpfile"
-
-    # Write the closing tag for the test results
-    echo "</testsuite>" >> "$outfile"
-    echo "</testsuites>" >> "$outfile"
-
-    set -x
+    python3 sum2junit.py < "$infile" > "$outfile"
 }
 
 # Required variables
@@ -121,7 +117,6 @@ WORKSPACE=${WORKSPACE:-}
 arch=${arch:-}
 conf=${conf:-}
 build=${build:-}
-cc=${cc:-}
 
 
 SRCDIR="$WORKSPACE/src/binutils-gdb"
@@ -210,18 +205,160 @@ $MAKE -j "$($NPROC)" V=1 MAKEINFO=/bin/true
 # Install in the workspace
 $MAKE install DESTDIR="$WORKSPACE"
 
-# Run tests, don't fail now, we want to run the archiving steps
+# Run tests, don't fail now, we know that "make check" is going to fail,
+# since some tests don't pass.
 #
 # Disable ASan leaks reporting, it might break some tests since it adds
 # unexpected output when GDB exits.
-failed_tests=0
-ASAN_OPTIONS=detect_leaks=0 $MAKE -C gdb --keep-going check -j "$($NPROC)" || failed_tests=1
+ASAN_OPTIONS=detect_leaks=0 $MAKE -C gdb --keep-going check -j "$($NPROC)" || true
 
 # Copy the dejagnu test results for archiving before cleaning the build dir
 mkdir "${WORKSPACE}/results"
 cp gdb/testsuite/gdb.log "${WORKSPACE}/results/"
 cp gdb/testsuite/gdb.sum "${WORKSPACE}/results/"
-sum2junit gdb/testsuite/gdb.sum "${WORKSPACE}/results/gdb.xml"
+
+# Filter out some known failures.
+cat <<'EOF' > known-failures
+DUPLICATE: gdb.base/attach-pie-misread.exp: copy ld-2.27.so to ld-linux-x86-64.so.2
+DUPLICATE: gdb.base/attach-pie-misread.exp: copy libc-2.27.so to libc.so.6
+DUPLICATE: gdb.base/attach-pie-misread.exp: ldd attach-pie-misread
+DUPLICATE: gdb.base/attach-pie-misread.exp: ldd attach-pie-misread output contains libs
+DUPLICATE: gdb.base/call-signal-resume.exp: dummy stack frame number
+DUPLICATE: gdb.base/call-signal-resume.exp: return
+DUPLICATE: gdb.base/call-signal-resume.exp: set confirm off
+DUPLICATE: gdb.base/catch-signal.exp: 1: continue
+DUPLICATE: gdb.base/catch-signal.exp: SIGHUP: continue
+DUPLICATE: gdb.base/catch-signal.exp: SIGHUP SIGUSR2: continue
+DUPLICATE: gdb.base/checkpoint.exp: restart 0 one
+DUPLICATE: gdb.base/checkpoint.exp: verify lines 5 two
+DUPLICATE: gdb.base/checkpoint-ns.exp: restart 0 one
+DUPLICATE: gdb.base/checkpoint-ns.exp: verify lines 5 two
+DUPLICATE: gdb.base/complete-empty.exp: empty-input-line: cmd complete ""
+DUPLICATE: gdb.base/corefile-buildid.exp: could not generate core file
+DUPLICATE: gdb.base/decl-before-def.exp: p a
+DUPLICATE: gdb.base/define-prefix.exp: define user command: ghi-prefix-cmd
+DUPLICATE: gdb.base/del.exp: info break after removing break on main
+DUPLICATE: gdb.base/dfp-exprs.exp: p 1.2dl < 1.3df
+DUPLICATE: gdb.base/dfp-test.exp: 1.23E45A is an invalid number
+DUPLICATE: gdb.base/dfp-test.exp: 1.23E is an invalid number
+DUPLICATE: gdb.base/exprs.exp: \$[0-9]* = red (setup)
+DUPLICATE: gdb.base/funcargs.exp: run to call2a
+DUPLICATE: gdb.base/interp.exp: interpreter-exec mi "-var-update *"
+DUPLICATE: gdb.base/miscexprs.exp: print value of !ibig.i[100]
+DUPLICATE: gdb.base/nested-subp2.exp: continue to the STOP marker
+DUPLICATE: gdb.base/nested-subp2.exp: print c
+DUPLICATE: gdb.base/nested-subp2.exp: print count
+DUPLICATE: gdb.base/pending.exp: disable other breakpoints
+DUPLICATE: gdb.base/pie-fork.exp: test_no_detach_on_fork: continue
+DUPLICATE: gdb.base/pointers.exp: pointer assignment
+DUPLICATE: gdb.base/pretty-array.exp: print nums
+DUPLICATE: gdb.base/ptype.exp: list charfoo
+DUPLICATE: gdb.base/ptype.exp: list intfoo
+DUPLICATE: gdb.base/ptype.exp: ptype the_highest
+DUPLICATE: gdb.base/readline.exp: Simple operate-and-get-next - final prompt
+DUPLICATE: gdb.base/realname-expand.exp: set basenames-may-differ on
+DUPLICATE: gdb.base/set-cwd.exp: test_cwd_reset: continue to breakpoint: break-here
+DUPLICATE: gdb.base/shlib-call.exp: continue until exit
+DUPLICATE: gdb.base/shlib-call.exp: print g
+DUPLICATE: gdb.base/shlib-call.exp: set print address off
+DUPLICATE: gdb.base/shlib-call.exp: set print sevenbit-strings
+DUPLICATE: gdb.base/shlib-call.exp: set width 0
+DUPLICATE: gdb.base/solib-display.exp: IN: break 25
+DUPLICATE: gdb.base/solib-display.exp: IN: continue
+DUPLICATE: gdb.base/solib-display.exp: NO: break 25
+DUPLICATE: gdb.base/solib-display.exp: NO: continue
+DUPLICATE: gdb.base/solib-display.exp: SEP: break 25
+DUPLICATE: gdb.base/solib-display.exp: SEP: continue
+DUPLICATE: gdb.base/stack-checking.exp: bt
+DUPLICATE: gdb.base/subst.exp: unset substitute-path from, no rule entered yet
+DUPLICATE: gdb.base/ui-redirect.exp: redirect while already logging: set logging redirect off
+DUPLICATE: gdb.base/unload.exp: continuing to unloaded libfile
+DUPLICATE: gdb.base/watchpoints.exp: watchpoint hit, first time
+DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: breakpoint at main
+DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: mi runto main
+DUPLICATE: gdb.mi/mi2-var-child.exp: get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr
+DUPLICATE: gdb.mi/mi2-var-child.exp: get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr
+DUPLICATE: gdb.mi/mi2-var-child.exp: get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr
+DUPLICATE: gdb.mi/mi2-var-child.exp: get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr
+DUPLICATE: gdb.mi/mi-catch-cpp-exceptions.exp: breakpoint at main
+DUPLICATE: gdb.mi/mi-catch-cpp-exceptions.exp: mi runto main
+DUPLICATE: gdb.mi/mi-catch-load.exp: breakpoint at main
+DUPLICATE: gdb.mi/mi-catch-load.exp: mi runto main
+DUPLICATE: gdb.mi/mi-language.exp: set lang ada
+DUPLICATE: gdb.mi/mi-nonstop-exit.exp: breakpoint at main
+DUPLICATE: gdb.mi/mi-nonstop-exit.exp: mi runto main
+DUPLICATE: gdb.mi/mi-nonstop.exp: check varobj, w1, 1
+DUPLICATE: gdb.mi/mi-nonstop.exp: stacktrace of stopped thread
+DUPLICATE: gdb.mi/mi-nsthrexec.exp: breakpoint at main
+DUPLICATE: gdb.mi/mi-syn-frame.exp: finished exec continue
+DUPLICATE: gdb.mi/mi-syn-frame.exp: list stack frames
+DUPLICATE: gdb.mi/mi-var-child.exp: get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr
+DUPLICATE: gdb.mi/mi-var-child.exp: get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr
+DUPLICATE: gdb.mi/mi-var-child.exp: get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr
+DUPLICATE: gdb.mi/mi-var-child.exp: get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr
+DUPLICATE: gdb.mi/mi-var-cp.exp: create varobj for s
+DUPLICATE: gdb.mi/mi-var-rtti.exp: list children of ptr.Base.public (with RTTI) in use_rtti_with_multiple_inheritence
+DUPLICATE: gdb.mi/mi-var-rtti.exp: list children of ptr.public (without RTTI) in skip_type_update_when_not_use_rtti
+DUPLICATE: gdb.mi/mi-var-rtti.exp: list children of ptr (without RTTI) in skip_type_update_when_not_use_rtti
+DUPLICATE: gdb.mi/mi-var-rtti.exp: list children of s.ptr.public (without RTTI) in skip_type_update_when_not_use_rtti
+DUPLICATE: gdb.mi/mi-var-rtti.exp: list children of s.ptr (without RTTI) in skip_type_update_when_not_use_rtti
+DUPLICATE: gdb.mi/mi-watch.exp: mi-mode=main: wp-type=hw: watchpoint trigger
+DUPLICATE: gdb.mi/mi-watch.exp: mi-mode=main: wp-type=sw: watchpoint trigger
+DUPLICATE: gdb.mi/mi-watch.exp: mi-mode=separate: wp-type=hw: watchpoint trigger
+DUPLICATE: gdb.mi/mi-watch.exp: mi-mode=separate: wp-type=sw: watchpoint trigger
+FAIL: gdb.ada/interface.exp: print s
+FAIL: gdb.ada/iwide.exp: print d_access.all
+FAIL: gdb.ada/iwide.exp: print dp_access.all
+FAIL: gdb.ada/iwide.exp: print My_Drawable
+FAIL: gdb.ada/iwide.exp: print s_access.all
+FAIL: gdb.ada/iwide.exp: print sp_access.all
+FAIL: gdb.ada/mi_interface.exp: create ggg1 varobj (unexpected output)
+FAIL: gdb.ada/mi_interface.exp: list ggg1's children (unexpected output)
+FAIL: gdb.ada/tagged_access.exp: ptype c.all
+FAIL: gdb.ada/tagged_access.exp: ptype c.menu_name
+FAIL: gdb.ada/tagged.exp: print obj
+FAIL: gdb.ada/tagged.exp: ptype obj
+FAIL: gdb.base/bt-on-fatal-signal.exp: BUS: $saw_bt_end
+FAIL: gdb.base/bt-on-fatal-signal.exp: BUS: $saw_bt_start
+FAIL: gdb.base/bt-on-fatal-signal.exp: BUS: $saw_fatal_msg
+FAIL: gdb.base/bt-on-fatal-signal.exp: BUS: [expr $internal_error_msg_count == 2]
+FAIL: gdb.base/bt-on-fatal-signal.exp: FPE: $saw_bt_end
+FAIL: gdb.base/bt-on-fatal-signal.exp: FPE: $saw_bt_start
+FAIL: gdb.base/bt-on-fatal-signal.exp: FPE: $saw_fatal_msg
+FAIL: gdb.base/bt-on-fatal-signal.exp: FPE: [expr $internal_error_msg_count == 2]
+FAIL: gdb.base/bt-on-fatal-signal.exp: SEGV: $saw_bt_end
+FAIL: gdb.base/bt-on-fatal-signal.exp: SEGV: $saw_bt_start
+FAIL: gdb.base/bt-on-fatal-signal.exp: SEGV: $saw_fatal_msg
+FAIL: gdb.base/bt-on-fatal-signal.exp: SEGV: [expr $internal_error_msg_count == 2]
+FAIL: gdb.base/share-env-with-gdbserver.exp: strange named var: print result of getenv for 'asd ='
+FAIL: gdb.base/step-over-syscall.exp: clone: displaced=off: single step over clone
+FAIL: gdb.cp/no-dmgl-verbose.exp: setting breakpoint at 'f(std::string)'
+FAIL: gdb.dwarf2/dw2-inline-param.exp: running to *0x608 in runto
+FAIL: gdb.gdb/python-interrupts.exp: run until breakpoint at captured_command_loop
+FAIL: gdb.mi/mi-break.exp: mi-mode=main: test_explicit_breakpoints: -break-insert -c "foo == 3" --source basics.c --function main --label label (unexpected output)
+FAIL: gdb.mi/mi-break.exp: mi-mode=main: test_explicit_breakpoints: -break-insert --source basics.c --function foobar (unexpected output)
+FAIL: gdb.mi/mi-break.exp: mi-mode=main: test_explicit_breakpoints: -break-insert --source basics.c --function main --label foobar (unexpected output)
+FAIL: gdb.mi/mi-break.exp: mi-mode=main: test_explicit_breakpoints: -break-insert --source basics.c (unexpected output)
+FAIL: gdb.mi/mi-break.exp: mi-mode=separate: test_explicit_breakpoints: -break-insert -c "foo == 3" --source basics.c --function main --label label (unexpected output)
+FAIL: gdb.mi/mi-break.exp: mi-mode=separate: test_explicit_breakpoints: -break-insert --source basics.c --function foobar (unexpected output)
+FAIL: gdb.mi/mi-break.exp: mi-mode=separate: test_explicit_breakpoints: -break-insert --source basics.c --function main --label foobar (unexpected output)
+FAIL: gdb.mi/mi-break.exp: mi-mode=separate: test_explicit_breakpoints: -break-insert --source basics.c (unexpected output)
+FAIL: gdb.mi/mi-breakpoint-changed.exp: test_auto_disable: -break-enable count 1 2 (unexpected output)
+FAIL: gdb.mi/mi-breakpoint-changed.exp: test_auto_disable: -break-insert -f pendfunc1 (unexpected output)
+FAIL: gdb.threads/detach-step-over.exp: breakpoint-condition-evaluation=host: target-non-stop=on: non-stop=on: displaced=off: iter 3: attach (GDB internal error)
+UNRESOLVED: gdb.base/libsegfault.exp: gdb emits custom handler warning
+UNRESOLVED: gdb.base/readline-ask.exp: bell for more message
+UNRESOLVED: gdb.base/symbol-without-target_section.exp: list -q main
+UNRESOLVED: gdb.dwarf2/dw2-icc-opaque.exp: ptype p_struct
+UNRESOLVED: gdb.opencl/vec_comps.exp: OpenCL support not detected
+UNRESOLVED: gdb.threads/attach-many-short-lived-threads.exp: iter 8: detach
+EOF
+
+grep --invert-match --fixed-strings --file=known-failures  "${WORKSPACE}/results/gdb.sum" > "${WORKSPACE}/results/gdb.filtered.sum"
+
+# Convert results to JUnit format.
+failed_tests=0
+sum2junit "${WORKSPACE}/results/gdb.filtered.sum" "${WORKSPACE}/results/gdb.xml" || failed_tests=1
 
 # Clean the build directory
 $MAKE clean
This page took 0.026091 seconds and 4 git commands to generate.