jjb: Add binutils-gdb base jobs
authorMichael Jeanson <mjeanson@efficios.com>
Fri, 8 Oct 2021 17:57:43 +0000 (13:57 -0400)
committerMichael Jeanson <mjeanson@efficios.com>
Fri, 8 Oct 2021 17:57:43 +0000 (13:57 -0400)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
12 files changed:
automation/ansible/node_amd64.yml
automation/ansible/roles/binutils-gdb/tasks/main.yml [new file with mode: 0644]
automation/ansible/roles/binutils-gdb/tasks/setup-Alpine.yml [new file with mode: 0644]
automation/ansible/roles/binutils-gdb/tasks/setup-Debian.yml [new file with mode: 0644]
automation/ansible/roles/binutils-gdb/tasks/setup-RedHat.yml [new file with mode: 0644]
automation/ansible/roles/binutils-gdb/tasks/setup-Suse.yml [new file with mode: 0644]
automation/ansible/roles/binutils-gdb/vars/Alpine.yml [new file with mode: 0644]
automation/ansible/roles/binutils-gdb/vars/Debian.yml [new file with mode: 0644]
automation/ansible/roles/binutils-gdb/vars/RedHat.yml [new file with mode: 0644]
automation/ansible/roles/binutils-gdb/vars/Suse.yml [new file with mode: 0644]
jobs/binutils-gdb.yaml [new file with mode: 0644]
scripts/binutils-gdb/build.sh [new file with mode: 0755]

index 56d3ffe63abedbdfcea2431658869e77f4ee7ce9..f7ec70b34115ffae112bc72baab06de275edba2c 100644 (file)
@@ -4,6 +4,7 @@
     - cross-compilers
     - compilers
     - babeltrace
+    - binutils-gdb
     - liburcu
     - lttng-ust
     - lttng-tools
diff --git a/automation/ansible/roles/binutils-gdb/tasks/main.yml b/automation/ansible/roles/binutils-gdb/tasks/main.yml
new file mode 100644 (file)
index 0000000..733840c
--- /dev/null
@@ -0,0 +1,22 @@
+---
+# Include variables and define needed variables.
+- name: Include OS-specific variables.
+  include_vars: "{{ ansible_os_family }}.yml"
+
+- name: Define binutils_gdb_packages.
+  set_fact:
+    binutils_gdb_packages: "{{ __binutils_gdb_packages | list }}"
+  when: binutils_gdb_packages is not defined
+
+# Setup/install tasks.
+- include: setup-RedHat.yml
+  when: ansible_os_family == 'RedHat'
+
+- include: setup-Debian.yml
+  when: ansible_os_family == 'Debian'
+
+- include: setup-Alpine.yml
+  when: ansible_os_family == 'Alpine'
+
+- include: setup-Suse.yml
+  when: ansible_os_family == 'Suse'
diff --git a/automation/ansible/roles/binutils-gdb/tasks/setup-Alpine.yml b/automation/ansible/roles/binutils-gdb/tasks/setup-Alpine.yml
new file mode 100644 (file)
index 0000000..76c7249
--- /dev/null
@@ -0,0 +1,6 @@
+---
+- name: Update apk cache.
+  apk: update_cache=yes
+
+- name: Ensure binutils_gdb build dependencies are installed.
+  apk: "name={{ binutils_gdb_packages }} state=present"
diff --git a/automation/ansible/roles/binutils-gdb/tasks/setup-Debian.yml b/automation/ansible/roles/binutils-gdb/tasks/setup-Debian.yml
new file mode 100644 (file)
index 0000000..d2531c1
--- /dev/null
@@ -0,0 +1,6 @@
+---
+- name: Update apt cache.
+  apt: update_cache=yes cache_valid_time=86400
+
+- name: Ensure binutils_gdb build dependencies are installed.
+  apt: "name={{ binutils_gdb_packages }} state=present"
diff --git a/automation/ansible/roles/binutils-gdb/tasks/setup-RedHat.yml b/automation/ansible/roles/binutils-gdb/tasks/setup-RedHat.yml
new file mode 100644 (file)
index 0000000..8c900db
--- /dev/null
@@ -0,0 +1,5 @@
+---
+- name: Ensure binutils_gdb build dependencies are installed.
+  dnf:
+    name: "{{ binutils_gdb_packages }}"
+    state: installed
diff --git a/automation/ansible/roles/binutils-gdb/tasks/setup-Suse.yml b/automation/ansible/roles/binutils-gdb/tasks/setup-Suse.yml
new file mode 100644 (file)
index 0000000..de6c78b
--- /dev/null
@@ -0,0 +1,3 @@
+---
+- name: Ensure binutils_gdb build dependencies are installed.
+  zypper: "name={{ binutils_gdb_packages }} state=installed update_cache=yes"
diff --git a/automation/ansible/roles/binutils-gdb/vars/Alpine.yml b/automation/ansible/roles/binutils-gdb/vars/Alpine.yml
new file mode 100644 (file)
index 0000000..ec18d42
--- /dev/null
@@ -0,0 +1,3 @@
+---
+__binutils_gdb_packages:
+  - libgmp-dev
diff --git a/automation/ansible/roles/binutils-gdb/vars/Debian.yml b/automation/ansible/roles/binutils-gdb/vars/Debian.yml
new file mode 100644 (file)
index 0000000..f98aa45
--- /dev/null
@@ -0,0 +1,6 @@
+---
+__binutils_gdb_packages:
+  - libgmp-dev
+  - guile-2.2-dev
+  - dejagnu
+  - gnat
diff --git a/automation/ansible/roles/binutils-gdb/vars/RedHat.yml b/automation/ansible/roles/binutils-gdb/vars/RedHat.yml
new file mode 100644 (file)
index 0000000..d4e53ab
--- /dev/null
@@ -0,0 +1,3 @@
+---
+__binutils_gdb_packages:
+  - gmp-devel
diff --git a/automation/ansible/roles/binutils-gdb/vars/Suse.yml b/automation/ansible/roles/binutils-gdb/vars/Suse.yml
new file mode 100644 (file)
index 0000000..d4e53ab
--- /dev/null
@@ -0,0 +1,3 @@
+---
+__binutils_gdb_packages:
+  - gmp-devel
diff --git a/jobs/binutils-gdb.yaml b/jobs/binutils-gdb.yaml
new file mode 100644 (file)
index 0000000..2b3f10d
--- /dev/null
@@ -0,0 +1,131 @@
+- defaults:
+    name: binutils-gdb
+    description: |
+      GDB TODO
+
+      <p>Job is managed by Jenkins Job Builder.</p>
+
+    project-type: freestyle
+
+    wrappers:
+      - ansicolor
+      - timeout:
+          timeout: 20
+          fail: true
+          type: no-activity
+      - timestamps
+      - workspace-cleanup:
+          clean-if:
+            - failure: false
+
+    scm:
+      - git:
+          url: git://git-mirror.internal.efficios.com/git/binutils-gdb.git
+          branches:
+            - origin/{version}
+          basedir: src/binutils-gdb
+          skip-tag: true
+
+    triggers:
+      - pollscm:
+          cron: "@hourly"
+
+    properties:
+      - inject:
+          properties-content: |
+            PROJECT_NAME=gdb
+      - build-discarder:
+          num-to-keep: 10
+
+
+## Templates ##
+- job-template:
+    name: binutils-gdb_{version}_build
+    defaults: binutils-gdb
+
+    project-type: matrix
+    node: 'master' # Applies only to matrix flyweight task
+    axes:
+      - axis:
+         type: slave
+         name: arch
+         values: '{obj:arch}'
+
+    builders:
+      - shell:
+         !include-raw-escape:
+           - scripts/common/print.sh
+           - scripts/binutils-gdb/build.sh
+
+    publishers:
+      - archive:
+          artifacts: 'build/**,results/**'
+          allow-empty: false
+      - junit:
+          results: 'results/*.xml'
+
+- job-template:
+    name: dev_gerrit_binutils-gdb_build
+    defaults: binutils-gdb
+    concurrent: true
+
+    scm:
+      - git:
+          url: https://review.lttng.org/binutils-gdb
+          refspec: 'refs/changes/*:refs/changes/*'
+          branches:
+            - '$GERRIT_REFSPEC'
+          basedir: src/binutils-gdb
+          skip-tag: true
+
+    triggers:
+      - gerrit:
+          trigger-on:
+            - comment-added-event:
+                approval-category: 'CI-Build'
+                approval-value: 1
+          projects:
+            - project-compare-type: 'PLAIN'
+              project-pattern: 'binutils-gdb'
+              branches:
+                - branch-compare-type: 'ANT'
+                  branch-pattern: '**'
+
+    node: 'amd64'
+
+    builders:
+      - shell:
+         !include-raw-escape:
+           - scripts/common/print.sh
+           - scripts/binutils-gdb/build.sh
+
+    properties:
+      - build-discarder:
+          days-to-keep: 1
+
+
+## Views ##
+- view-template:
+    name: 'GDB'
+    view-type: list
+    regex: 'binutils-gdb[-_].*'
+
+
+## Projects ##
+- project:
+    name: binutils-gdb
+    version:
+      - master
+    jobs:
+      - 'binutils-gdb_{version}_build':
+          arch: !!python/tuple [amd64]
+
+- project:
+    name: gerrit-gdb
+    jobs:
+      - 'dev_gerrit_binutils-gdb_build'
+
+- project:
+    name: gdb-views
+    views:
+      - GDB
diff --git a/scripts/binutils-gdb/build.sh b/scripts/binutils-gdb/build.sh
new file mode 100755 (executable)
index 0000000..c6a4937
--- /dev/null
@@ -0,0 +1,235 @@
+#!/bin/bash
+#
+# Copyright (C) 2021 Michael Jeanson <mjeanson@efficios.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set -exu
+
+failed_configure() {
+    # Assume we are in the configured build directory
+    echo "#################### BEGIN config.log ####################"
+    cat config.log
+    echo "#################### END config.log ####################"
+    exit 1
+}
+
+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}">
+
+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
+}
+
+# Required variables
+WORKSPACE=${WORKSPACE:-}
+
+arch=${arch:-}
+conf=${conf:-}
+build=${build:-}
+cc=${cc:-}
+
+
+SRCDIR="$WORKSPACE/src/binutils-gdb"
+TMPDIR="$WORKSPACE/tmp"
+PREFIX="/build"
+
+# Create tmp directory
+rm -rf "$TMPDIR"
+mkdir -p "$TMPDIR"
+
+export TMPDIR
+export CFLAGS="-O2 -fsanitize=address"
+export CXXFLAGS="-O2 -fsanitize=address -D_GLIBCXX_DEBUG=1"
+export LDFLAGS="-fsanitize=address"
+
+# Set platform variables
+case "$arch" in
+*)
+    export MAKE=make
+    export TAR=tar
+    export NPROC=nproc
+    ;;
+esac
+
+# Print build env details
+print_os || true
+print_tooling || true
+
+# Enter the source directory
+cd "$SRCDIR"
+
+# Run bootstrap in the source directory prior to configure
+#./bootstrap
+
+# Get source version from configure script
+#eval "$(grep '^PACKAGE_VERSION=' ./configure)"
+#PACKAGE_VERSION=${PACKAGE_VERSION//\-pre*/}
+
+# Set configure options and environment variables for each build
+# configuration.
+CONF_OPTS=("--prefix=$PREFIX")
+
+case "$conf" in
+*)
+    echo "Standard configuration"
+
+    # Use system tools
+    CONF_OPTS+=("--disable-binutils" "--disable-ld" "--disable-gold" "--disable-gas" "--disable-sim" "--disable-gprof")
+
+    # Use system libs
+    CONF_OPTS+=("--with-system-readline" "--with-system-zlib")
+
+    # Enable optional features
+    CONF_OPTS+=("--enable-targets=all" "--with-expat=yes" "--with-python=python3" "--with-guile=guile-2.2" "--enable-libctf")
+
+    CONF_OPTS+=("--enable-build-warnings" "--enable-gdb-build-warnings" "--enable-unit-tests")
+
+    ;;
+esac
+
+# Build type
+# oot     : out-of-tree build
+# dist    : build via make dist
+# oot-dist: build via make dist out-of-tree
+# *       : normal tree build
+#
+# Make sure to move to the build directory and run configure
+# before continuing.
+case "$build" in
+*)
+    echo "Out of tree build"
+
+    # Create and enter a temporary build directory
+    builddir=$(mktemp -d)
+    cd "$builddir"
+
+    "$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure
+    ;;
+esac
+
+# We are now inside a configured build directory
+
+# BUILD!
+$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
+failed_tests=0
+$MAKE -C gdb --keep-going check -j "$($NPROC)" || failed_tests=1
+
+# Copy the dejagnu test results for archiving before cleaning the build dir
+mkdir "${WORKSPACE}/results"
+cp gdb/testsuite/gdb.sum "${WORKSPACE}/results/"
+sum2junit gdb/testsuite/gdb.sum "${WORKSPACE}/results/gdb.xml"
+
+# Clean the build directory
+$MAKE clean
+
+# Cleanup rpath in executables and shared libraries
+#find "$WORKSPACE/$PREFIX/bin" -type f -perm -0500 -exec chrpath --delete {} \;
+#find "$WORKSPACE/$PREFIX/lib" -name "*.so" -exec chrpath --delete {} \;
+
+# Remove libtool .la files
+find "$WORKSPACE/$PREFIX/lib" -name "*.la" -exec rm -f {} \;
+
+# Exit with failure if any of the tests failed
+exit $failed_tests
+
+# EOF
This page took 0.029188 seconds and 4 git commands to generate.