Initial commit: Geminux 0.1.0 (helio) for Planet Computers Gemini PDA (MT6797X)
This commit is contained in:
commit
034c1f61b1
816 files changed
+223435
No files matched your search
@@ -0,0 +1,43 @@
|
||||
# Driver ABI check tools
|
||||
|
||||
Scripts that let any Xorg module check itself against staged XLibre
|
||||
servers. They are installed with the server SDK; find them with:
|
||||
|
||||
pkg-config --variable=abi_tools_dir xorg-server
|
||||
|
||||
Each server is built with debug info and staged under `ABI_WORK` with
|
||||
`DESTDIR`, so nothing is installed into the system.
|
||||
|
||||
| Script | What it checks |
|
||||
| --- | --- |
|
||||
| `run-matrix.sh` | Builds the module against every server in `ABI_SERVERS` and checks that every server symbol it needs is exported by each of them (built for one release, loaded into another). |
|
||||
| `gate-driver.sh` | Builds the committed tree (`BEFORE_REF`, default `HEAD`) and the working tree against each server, and fails if libabigail reports a changed layout of a server type the module uses. |
|
||||
| `check-symbols.sh` | One module against one staged server, or with `--prefix <dir>` one installed in `<dir>`; also fails a module linked with BIND_NOW that needs symbols only other modules define. |
|
||||
| `abigail-compare.sh` | One libabigail comparison; added types pass, removed symbols and changed layouts fail; `--allow TYPE` accepts a known change. |
|
||||
| `check-private-includes.py` | For meson modules: every server-internal header a source file includes must be needed by it. |
|
||||
|
||||
`build-server.sh`, `build-driver.sh`, `staged-pc.sh` and `common.sh` are
|
||||
the helpers the scripts above use.
|
||||
|
||||
## Environment
|
||||
|
||||
- `ABI_WORK`: work directory (required); put it on disk, the servers
|
||||
take a few hundred MB each.
|
||||
- `ABI_MODULE`: the module inside a build directory, for
|
||||
`run-matrix.sh` and `gate-driver.sh`: `src/<name>_drv.so` for meson,
|
||||
`src/.libs/<name>_drv.so` for autotools.
|
||||
- `ABI_DRIVER_SRC`: the module's source tree (default: the git top level
|
||||
of the current directory).
|
||||
- `ABI_SERVERS`: server branches or tags (default: `release/25.0
|
||||
release/25.1 release/25.2 master`).
|
||||
- `XSERVER_SRC`: a local xserver clone to take sources from instead of
|
||||
cloning from GitHub; `XSERVER_REMOTE` names its upstream remote.
|
||||
|
||||
Example, from a meson driver's source tree:
|
||||
|
||||
tools=$(pkg-config --variable=abi_tools_dir xorg-server)
|
||||
ABI_WORK=$HOME/abi-work ABI_MODULE=src/amdgpu_drv.so "$tools/run-matrix.sh"
|
||||
ABI_WORK=$HOME/abi-work ABI_MODULE=src/amdgpu_drv.so "$tools/gate-driver.sh"
|
||||
|
||||
Needs meson, ninja, git, pkg-config, binutils (`nm`) and libabigail
|
||||
(`abidiff`); autotools modules also need autoconf, automake and libtool.
|
||||
@@ -0,0 +1,141 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
# Compare two builds of the same binary with libabigail, looking at every
|
||||
# type declared in the server SDK headers (including types not reachable
|
||||
# from exported symbols, which is all of them for a driver built with
|
||||
# -fvisibility=hidden).
|
||||
#
|
||||
# abigail-compare.sh <old-binary> <old-incdir> <new-binary> <new-incdir> \
|
||||
# [--allow TYPE]...
|
||||
#
|
||||
# Exit 0: no ABI change, or only changes to --allow'ed types with nothing
|
||||
# removed. Exit 1: ABI change that is not allowed. Exit 2: tool error.
|
||||
|
||||
set -u
|
||||
|
||||
usage() {
|
||||
echo "usage: $0 <old> <old-incdir> <new> <new-incdir> [--allow TYPE]..." >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
[ $# -ge 4 ] || usage
|
||||
old=$1 oldinc=$2 new=$3 newinc=$4
|
||||
shift 4
|
||||
# Type lists hold one name per line: names of anonymous types contain spaces.
|
||||
nl='
|
||||
'
|
||||
allow=
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--allow)
|
||||
[ $# -ge 2 ] || usage
|
||||
allow="$allow$2$nl"
|
||||
shift 2
|
||||
;;
|
||||
*) usage ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if ! command -v abidiff >/dev/null 2>&1; then
|
||||
echo "abigail-compare: abidiff not found (Gentoo: dev-util/libabigail," \
|
||||
"Ubuntu: abigail-tools)" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
report=${ABI_REPORT:-$(dirname "$new")/abidiff-$(basename "$new").txt}
|
||||
timeout 1800 abidiff --no-show-locs --no-added-syms --non-reachable-types \
|
||||
--leaf-changes-only --hd1 "$oldinc" --hd2 "$newinc" \
|
||||
"$old" "$new" >"$report" 2>&1
|
||||
rc=$?
|
||||
cat "$report"
|
||||
|
||||
if [ $rc -ge 128 ] || [ $((rc & 3)) -ne 0 ]; then
|
||||
echo "abigail-compare: abidiff failed (exit $rc)" >&2
|
||||
exit 2
|
||||
fi
|
||||
if [ $rc -eq 0 ]; then
|
||||
echo "abigail-compare: PASS (no ABI change)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Added types (e.g. a newly used server struct) set the change bit too, as do
|
||||
# types that only left the binary's debug info because it no longer uses
|
||||
# them; with no function, variable or type changed or removed from the
|
||||
# interface, that is not an ABI break.
|
||||
if grep -q "^Leaf changes summary: 0 artifact" "$report" &&
|
||||
grep -q "functions summary: 0 Removed, 0 Changed" "$report" &&
|
||||
grep -q "variables summary: 0 Removed, 0 Changed" "$report" &&
|
||||
! grep "^Unreachable types summary:" "$report" |
|
||||
grep -Eqv "summary: [0-9]+ removed( \([0-9]+ filtered out\))?, 0 changed"; then
|
||||
if grep -Eq "^Unreachable types summary: [1-9]" "$report"; then
|
||||
echo "abigail-compare: PASS (only additions, and types this binary" \
|
||||
"no longer uses)"
|
||||
else
|
||||
echo "abigail-compare: PASS (only additions)"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
fail=0
|
||||
if ! grep -q "functions summary: 0 Removed" "$report" ||
|
||||
! grep -q "variables summary: 0 Removed" "$report"; then
|
||||
echo "abigail-compare: FAIL: functions or variables were removed"
|
||||
fail=1
|
||||
fi
|
||||
|
||||
# Leaf entries look like "'struct _damage' changed:" (types reachable from
|
||||
# exported symbols) or " [C] 'struct _damage' changed:" (unreachable
|
||||
# types), followed by indented detail lines. A type counts as changed only
|
||||
# when its own entry reports a layout change; entries that just repeat a
|
||||
# change through a pointer ("underlying type ... changed") do not.
|
||||
changed=
|
||||
current=
|
||||
while IFS= read -r line; do
|
||||
case $line in
|
||||
"'"*"' changed:" | " [C] '"*"' changed:")
|
||||
current=${line# \[C\] }
|
||||
current=${current#\'}
|
||||
current=${current%\' changed:}
|
||||
for prefix in "const " "struct " "union " "enum " "class " "typedef "; do
|
||||
current=${current#"$prefix"}
|
||||
done
|
||||
;;
|
||||
" ["?"] "* | [!\ ]*)
|
||||
# another tagged entry, or a top-level line that is not a header
|
||||
current=
|
||||
;;
|
||||
*"type size changed"* | *"data member insertion"* | \
|
||||
*"data member deletion"* | *"offset changed"* | \
|
||||
*"was removed"* | *"enumerator"* | *"type name changed"*)
|
||||
if [ -n "$current" ]; then
|
||||
case "$nl$changed" in
|
||||
*"$nl$current$nl"*) ;;
|
||||
*) changed="$changed$current$nl" ;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done <"$report"
|
||||
|
||||
if [ -z "$changed" ] && [ $fail -eq 0 ]; then
|
||||
echo "abigail-compare: FAIL: abidiff reported a change (exit $rc)" \
|
||||
"that this script cannot attribute to a type; read the report"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while IFS= read -r t; do
|
||||
[ -n "$t" ] || continue
|
||||
case "$nl$allow" in
|
||||
*"$nl$t$nl"*) echo "abigail-compare: allowed change to $t" ;;
|
||||
*)
|
||||
echo "abigail-compare: FAIL: layout of $t changed"
|
||||
fail=1
|
||||
;;
|
||||
esac
|
||||
done <<EOF
|
||||
$changed
|
||||
EOF
|
||||
|
||||
[ $fail -eq 0 ] && echo "abigail-compare: PASS (only allowed changes)"
|
||||
exit $fail
|
||||
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
# Build a driver with debug info against a server staged by
|
||||
# build-server.sh.
|
||||
#
|
||||
# build-driver.sh <server-workdir> <driver-builddir> <driver-srcdir>
|
||||
#
|
||||
# Only the xorg-server package is redirected to the staged root (through
|
||||
# the xorg-server.pc copy staged-pc.sh writes); every other dependency keeps
|
||||
# coming from the system. meson drivers build out of tree; autotools drivers
|
||||
# are copied into <driver-builddir> first, since their autogen.sh may run
|
||||
# configure in the source tree.
|
||||
|
||||
set -eu
|
||||
|
||||
[ $# -eq 3 ] || {
|
||||
echo "usage: $0 <server-workdir> <driver-builddir> <driver-srcdir>" >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
root=$(cd "$1/root" && pwd)
|
||||
builddir=$2
|
||||
srcdir=$(cd "$3" && pwd)
|
||||
|
||||
pcdir=$("$here/staged-pc.sh" "$1")
|
||||
PKG_CONFIG_PATH=$pcdir${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}
|
||||
export PKG_CONFIG_PATH
|
||||
|
||||
sdkdir=$(pkg-config --variable=sdkdir xorg-server)
|
||||
echo "build-driver: xorg-server $(pkg-config --modversion xorg-server)" \
|
||||
"sdkdir $sdkdir"
|
||||
case $sdkdir in
|
||||
"$root"/*) ;;
|
||||
*) echo "build-driver: sdkdir $sdkdir is outside $root" >&2; exit 1 ;;
|
||||
esac
|
||||
|
||||
rm -rf "$builddir"
|
||||
if [ -f "$srcdir/meson.build" ]; then
|
||||
meson setup "$builddir" "$srcdir" -Dbuildtype=debug
|
||||
ninja -C "$builddir"
|
||||
else
|
||||
mkdir -p "$builddir"
|
||||
(cd "$srcdir" && tar --exclude=.git -cf - .) | tar -xf - -C "$builddir"
|
||||
cd "$builddir"
|
||||
NOCONFIGURE=1 ./autogen.sh
|
||||
CFLAGS="-g -O0" ./configure
|
||||
make -j"$(nproc 2>/dev/null || echo 2)"
|
||||
fi
|
||||
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
# Build an XLibre xserver with debug info and stage it under <workdir>/root
|
||||
# (prefix /usr, installed with DESTDIR) for the driver ABI checks.
|
||||
#
|
||||
# build-server.sh <ref> <workdir>
|
||||
#
|
||||
# <ref> is a tag, branch or commit. With XSERVER_SRC set to a local xserver
|
||||
# clone the sources come from `git archive <ref>` there; otherwise <ref> is
|
||||
# cloned from GitHub (tags and branch names only).
|
||||
|
||||
set -eu
|
||||
|
||||
[ $# -eq 2 ] || { echo "usage: $0 <ref> <workdir>" >&2; exit 2; }
|
||||
ref=$1
|
||||
mkdir -p "$2"
|
||||
workdir=$(cd "$2" && pwd)
|
||||
srcdir=$workdir/src
|
||||
|
||||
if [ -f "$workdir/root/.abi-staged" ]; then
|
||||
echo "build-server: reusing $workdir/root"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -f "$srcdir/meson.build" ]; then
|
||||
rm -rf "$srcdir"
|
||||
if [ -n "${XSERVER_SRC:-}" ]; then
|
||||
mkdir -p "$srcdir"
|
||||
git -C "$XSERVER_SRC" archive "$ref" | tar -x -C "$srcdir"
|
||||
else
|
||||
git clone --quiet --depth 1 --branch "$ref" \
|
||||
https://github.com/X11Libre/xserver "$srcdir"
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -rf "$workdir/build" "$workdir/root"
|
||||
meson setup "$workdir/build" "$srcdir" \
|
||||
-Dprefix=/usr -Dbuildtype=debug -Dc_args=-fno-common \
|
||||
-Dnamespace=false -Dxselinux=false -Dxephyr=false -Dwerror=false \
|
||||
-Dxcsecurity=false -Dxorg=true -Dxvfb=false -Dxnest=false \
|
||||
-Ddocs=false -Dsuid_wrapper=false
|
||||
ninja -C "$workdir/build"
|
||||
DESTDIR="$workdir/root" meson install -C "$workdir/build" --no-rebuild --quiet
|
||||
touch "$workdir/root/.abi-staged"
|
||||
echo "build-server: staged $workdir/root"
|
||||
@@ -0,0 +1,102 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
# Every server-internal header (*str.h, *Priv.h, *priv.h, *rst.h) that a
|
||||
# driver's src/*.c file includes directly must be needed by that file:
|
||||
# compiling the file without the include has to fail. Headers in src/*.h
|
||||
# are not checked, because their server includes are also reached through
|
||||
# other headers.
|
||||
#
|
||||
# check-private-includes.py <meson-builddir> [<source-subdir>]
|
||||
#
|
||||
# <source-subdir> is the name of the directory holding the driver's .c
|
||||
# files (default: src).
|
||||
#
|
||||
# Exit 0 pass, 1 an include is not needed, 77 skip (no compile database).
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
INCLUDE = re.compile(
|
||||
r'^\s*#\s*include\s*[<"]([A-Za-z0-9_]+(?:str|Priv|priv|rst)\.h)[>"]')
|
||||
|
||||
|
||||
def compile_args(entry, source, copy):
|
||||
args = shlex.split(entry['command'])
|
||||
out = []
|
||||
skip = False
|
||||
for i, arg in enumerate(args):
|
||||
if skip:
|
||||
skip = False
|
||||
continue
|
||||
if arg in ('-o', '-MQ', '-MF'):
|
||||
skip = True
|
||||
continue
|
||||
if arg in ('-MD', '-c'):
|
||||
continue
|
||||
if arg == entry['file']:
|
||||
continue
|
||||
out.append(arg)
|
||||
src_dir = os.path.dirname(source)
|
||||
return [out[0], '-I' + src_dir] + out[1:] + ['-fsyntax-only', copy]
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) not in (2, 3):
|
||||
print('usage: check-private-includes.py <meson-builddir> '
|
||||
'[<source-subdir>]')
|
||||
return 2
|
||||
subdir = sys.argv[2] if len(sys.argv) == 3 else 'src'
|
||||
db_path = os.path.join(sys.argv[1], 'compile_commands.json')
|
||||
if not os.path.exists(db_path):
|
||||
print('skip: no ' + db_path)
|
||||
return 77
|
||||
|
||||
with open(db_path) as f:
|
||||
entries = json.load(f)
|
||||
|
||||
failures = 0
|
||||
checked = 0
|
||||
for entry in entries:
|
||||
source = os.path.normpath(
|
||||
os.path.join(entry['directory'], entry['file']))
|
||||
src_dir = os.path.dirname(source)
|
||||
if not source.endswith('.c') or os.path.basename(src_dir) != subdir:
|
||||
continue
|
||||
local_headers = set(os.listdir(src_dir))
|
||||
with open(source) as f:
|
||||
lines = f.readlines()
|
||||
|
||||
for n, line in enumerate(lines):
|
||||
m = INCLUDE.match(line)
|
||||
if not m or m.group(1) in local_headers:
|
||||
continue
|
||||
header = m.group(1)
|
||||
checked += 1
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
copy = os.path.join(tmp, os.path.basename(source))
|
||||
with open(copy, 'w') as f:
|
||||
f.writelines(lines[:n] + lines[n + 1:])
|
||||
result = subprocess.run(
|
||||
compile_args(entry, source, copy),
|
||||
cwd=entry['directory'],
|
||||
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
name = os.path.basename(source)
|
||||
if result.returncode == 0:
|
||||
print('FAIL %s: %s is not needed (line %d)' %
|
||||
(name, header, n + 1))
|
||||
failures += 1
|
||||
else:
|
||||
print('ok %s: %s is needed' % (name, header))
|
||||
|
||||
print('%d includes checked, %d not needed' % (checked, failures))
|
||||
return 1 if failures else 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
# Check that every server symbol a module needs is exported by a server.
|
||||
#
|
||||
# check-symbols.sh <module.so> <server-workdir>
|
||||
# check-symbols.sh --prefix <dir> <module.so>
|
||||
#
|
||||
# The module's strong undefined symbols, minus those its own libraries and
|
||||
# the server's libraries provide, must each be defined by the server's Xorg
|
||||
# or a module under its module directory. Exit 1 lists the rest.
|
||||
# Libraries are looked up with the server's libdir first; exit 2 if one
|
||||
# is not found.
|
||||
# A module linked with BIND_NOW (-z now) must not need symbols that only
|
||||
# other modules define: those are not loaded yet when it is dlopen()ed.
|
||||
#
|
||||
# The server is one staged by build-server.sh, or with --prefix one
|
||||
# installed in <dir> (<dir>/bin/Xorg, module directory from the
|
||||
# xorg-server.pc that pkg-config finds, which must be under <dir>).
|
||||
|
||||
set -eu
|
||||
|
||||
usage() {
|
||||
echo "usage: $0 <module.so> <server-workdir>" >&2
|
||||
echo " $0 --prefix <dir> <module.so>" >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
if [ "${1:-}" = --prefix ]; then
|
||||
[ $# -eq 3 ] || usage
|
||||
root=$(cd "$2" && pwd)
|
||||
drv=$3
|
||||
xorg=$root/bin/Xorg
|
||||
moduledir=$(pkg-config --variable=moduledir xorg-server)
|
||||
libdir=$(pkg-config --variable=libdir xorg-server)
|
||||
else
|
||||
[ $# -eq 2 ] || usage
|
||||
drv=$1
|
||||
root=$(cd "$2/root" && pwd)
|
||||
xorg=$root/usr/bin/Xorg
|
||||
pcdir=$("$(dirname "$0")/staged-pc.sh" "$2") || exit 2
|
||||
moduledir=$(PKG_CONFIG_PATH=$pcdir pkg-config --variable=moduledir xorg-server)
|
||||
libdir=$(PKG_CONFIG_PATH=$pcdir pkg-config --variable=libdir xorg-server)
|
||||
fi
|
||||
[ -f "$xorg" ] || { echo "check-symbols: no $xorg" >&2; exit 2; }
|
||||
case $moduledir in
|
||||
"$root"/*) ;;
|
||||
*) echo "check-symbols: moduledir '$moduledir' is outside $root" >&2
|
||||
exit 2 ;;
|
||||
esac
|
||||
[ -d "$moduledir" ] || { echo "check-symbols: no module dir $moduledir" >&2; exit 2; }
|
||||
|
||||
tmp=$(mktemp -d)
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
|
||||
defined() {
|
||||
nm -D --defined-only "$1" 2>/dev/null | tr -s ' ' | cut -d' ' -f3 | cut -d@ -f1
|
||||
}
|
||||
|
||||
# sparc64 modules have a nameless undefined entry
|
||||
nm -D --undefined-only "$drv" | grep ' U ' | tr -s ' ' | cut -d' ' -f3 |
|
||||
cut -d@ -f1 | sed '/^$/d' | sort -u >"$tmp/undef"
|
||||
|
||||
# libraries installed with the server (e.g. libdrm in the same prefix)
|
||||
(LD_LIBRARY_PATH=$libdir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
|
||||
export LD_LIBRARY_PATH; ldd "$drv"; ldd "$xorg") >"$tmp/ldd"
|
||||
if grep -q 'not found' "$tmp/ldd"; then
|
||||
echo "check-symbols: cannot find libraries of $drv or $xorg:" >&2
|
||||
grep 'not found' "$tmp/ldd" | sort -u >&2
|
||||
exit 2
|
||||
fi
|
||||
grep '=> /' "$tmp/ldd" | tr -s ' \t' ' ' | cut -d' ' -f4 |
|
||||
sort -u | while read -r lib; do defined "$lib"; done | sort -u >"$tmp/libs"
|
||||
|
||||
{
|
||||
defined "$xorg"
|
||||
find "$moduledir" -name '*.so' | while read -r mod; do defined "$mod"; done
|
||||
} | sort -u >"$tmp/server"
|
||||
|
||||
comm -23 "$tmp/undef" "$tmp/libs" | comm -23 - "$tmp/server" >"$tmp/missing"
|
||||
|
||||
if [ -s "$tmp/missing" ]; then
|
||||
echo "check-symbols: FAIL: $drv needs symbols $root does not export" \
|
||||
"(modules from $moduledir):"
|
||||
sed 's/^/ /' "$tmp/missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if readelf -d "$drv" |
|
||||
grep -Eq '\(BIND_NOW\)|\(FLAGS\).*BIND_NOW|\(FLAGS_1\).*[[:space:]]NOW([[:space:]]|$)'; then
|
||||
defined "$xorg" | sort -u >"$tmp/xorg"
|
||||
comm -23 "$tmp/undef" "$tmp/libs" | comm -23 - "$tmp/xorg" >"$tmp/late"
|
||||
if [ -s "$tmp/late" ]; then
|
||||
echo "check-symbols: FAIL: $drv is linked with BIND_NOW but needs" \
|
||||
"symbols only other modules define (link with -z lazy):"
|
||||
sed 's/^/ /' "$tmp/late"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo "check-symbols: PASS ($(comm -12 "$tmp/undef" "$tmp/server" | wc -l)" \
|
||||
"server symbols resolved)"
|
||||
@@ -0,0 +1,68 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
# Shared helpers for the ABI scripts (sourced, not run).
|
||||
#
|
||||
# Environment:
|
||||
# ABI_WORK work directory for staged servers and builds (required)
|
||||
# ABI_SERVERS servers to check against (default: the release branch
|
||||
# tips and master)
|
||||
# ABI_DRIVER_SRC driver source tree (default: the git top level of the
|
||||
# current directory)
|
||||
# ABI_MODULE the module inside a driver build dir, e.g.
|
||||
# src/amdgpu_drv.so (meson) or src/.libs/xgi_drv.so
|
||||
# (autotools); needed by gate-driver.sh and run-matrix.sh
|
||||
# XSERVER_SRC local xserver clone to take sources from (optional)
|
||||
# XSERVER_REMOTE remote name in XSERVER_SRC for branches (default upstream)
|
||||
|
||||
# The scripts that source this live next to it, so $0 locates the
|
||||
# directory; ABI_DIR overrides it for callers elsewhere.
|
||||
abi_dir=${ABI_DIR:-$(cd "$(dirname "$0")" && pwd)}
|
||||
: "${ABI_WORK:?set ABI_WORK to a work directory}"
|
||||
: "${ABI_SERVERS:=release/25.0 release/25.1 release/25.2 master}"
|
||||
: "${XSERVER_REMOTE:=upstream}"
|
||||
mkdir -p "$ABI_WORK"
|
||||
ABI_WORK=$(cd "$ABI_WORK" && pwd)
|
||||
ABI_DRIVER_SRC=$(cd "${ABI_DRIVER_SRC:-$(git rev-parse --show-toplevel)}" && pwd)
|
||||
|
||||
# Print the commit a tag or branch name currently points to.
|
||||
abi_resolve() {
|
||||
if [ -n "${XSERVER_SRC:-}" ]; then
|
||||
git -C "$XSERVER_SRC" rev-parse --verify --quiet "refs/tags/$1^{commit}" ||
|
||||
git -C "$XSERVER_SRC" rev-parse --verify "$XSERVER_REMOTE/$1^{commit}"
|
||||
else
|
||||
git ls-remote https://github.com/X11Libre/xserver \
|
||||
"refs/tags/$1^{}" "refs/tags/$1" "refs/heads/$1" |
|
||||
head -n 1 | cut -f1
|
||||
fi
|
||||
}
|
||||
|
||||
# Print the work directory for a tag or branch at its current commit.
|
||||
abi_workdir() {
|
||||
commit=$(abi_resolve "$1")
|
||||
[ -n "$commit" ] || { echo "abi: cannot resolve $1" >&2; return 1; }
|
||||
echo "$ABI_WORK/$(echo "$1" | tr '/' '-')-$(echo "$commit" | cut -c1-12)"
|
||||
}
|
||||
|
||||
# Build the driver into <builddir> (build-driver.sh arguments), logging to
|
||||
# <builddir>.log. On failure print the log's tail and return 1, so a failed
|
||||
# build is reported instead of silently ending the calling script.
|
||||
abi_build_driver() {
|
||||
log=$2.log
|
||||
if "$abi_dir/build-driver.sh" "$@" >"$log" 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
echo "abi: driver build failed ($2), last lines of $log:"
|
||||
tail -n 20 "$log" | sed 's/^/ /'
|
||||
return 1
|
||||
}
|
||||
|
||||
# Build (or reuse) the staged server for a tag or branch; print its workdir.
|
||||
abi_server() {
|
||||
wd=$(abi_workdir "$1") || return 1
|
||||
if [ -n "${XSERVER_SRC:-}" ]; then
|
||||
"$abi_dir/build-server.sh" "$(abi_resolve "$1")" "$wd" >&2 || return 1
|
||||
else
|
||||
"$abi_dir/build-server.sh" "$1" "$wd" >&2 || return 1
|
||||
fi
|
||||
echo "$wd"
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
# ABI gate for a driver change: build the committed tree (BEFORE_REF,
|
||||
# default HEAD) and the working tree against each ABI server and require
|
||||
# that the server types the driver uses are unchanged between the two.
|
||||
#
|
||||
# ABI_WORK=<dir> ABI_MODULE=<path> [ABI_DRIVER_SRC=<dir>] [ABI_SERVERS=...]
|
||||
# [BEFORE_REF=<ref>] gate-driver.sh
|
||||
|
||||
set -eu
|
||||
. "$(dirname "$0")/common.sh"
|
||||
: "${ABI_MODULE:?set ABI_MODULE to the module in a driver build, e.g. src/amdgpu_drv.so}"
|
||||
|
||||
before_src=$ABI_WORK/driver-before
|
||||
rm -rf "$before_src"
|
||||
mkdir -p "$before_src"
|
||||
git -C "$ABI_DRIVER_SRC" archive "${BEFORE_REF:-HEAD}" | tar -x -C "$before_src"
|
||||
|
||||
fail=0
|
||||
for s in $ABI_SERVERS; do
|
||||
wd=$(abi_server "$s")
|
||||
inc=$wd/root/usr/include/xorg
|
||||
if ! abi_build_driver "$wd" "$wd/gate-before" "$before_src" ||
|
||||
! abi_build_driver "$wd" "$wd/gate-after" "$ABI_DRIVER_SRC"; then
|
||||
echo "gate-driver: FAIL $s (driver build failed)"
|
||||
fail=1
|
||||
continue
|
||||
fi
|
||||
if ABI_REPORT=$wd/gate-abidiff.txt "$abi_dir/abigail-compare.sh" \
|
||||
"$wd/gate-before/$ABI_MODULE" "$inc" \
|
||||
"$wd/gate-after/$ABI_MODULE" "$inc" >/dev/null; then
|
||||
echo "gate-driver: PASS $s"
|
||||
else
|
||||
echo "gate-driver: FAIL $s (report: $wd/gate-abidiff.txt)"
|
||||
fail=1
|
||||
fi
|
||||
done
|
||||
exit $fail
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
# Driver ABI check across server releases: build the driver against each
|
||||
# server in ABI_SERVERS and check that every server symbol the driver needs
|
||||
# exists in every one of them (a driver built against one release must load
|
||||
# into the others).
|
||||
#
|
||||
# ABI_WORK=<dir> ABI_MODULE=<path> [ABI_DRIVER_SRC=<dir>] [ABI_SERVERS=...]
|
||||
# run-matrix.sh
|
||||
#
|
||||
# Layout changes are checked per change by gate-driver.sh.
|
||||
|
||||
set -eu
|
||||
. "$(dirname "$0")/common.sh"
|
||||
: "${ABI_MODULE:?set ABI_MODULE to the module in a driver build, e.g. src/amdgpu_drv.so}"
|
||||
|
||||
fail=0
|
||||
|
||||
for s in $ABI_SERVERS; do
|
||||
wd=$(abi_server "$s")
|
||||
echo "run-matrix: $s -> $wd"
|
||||
if ! abi_build_driver "$wd" "$wd/driver" "$ABI_DRIVER_SRC"; then
|
||||
echo "run-matrix: FAIL $s (driver build failed)"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
for built in $ABI_SERVERS; do
|
||||
for target in $ABI_SERVERS; do
|
||||
bwd=$(abi_workdir "$built")
|
||||
twd=$(abi_workdir "$target")
|
||||
out=$bwd/symbols-$(echo "$target" | tr '/' '-').txt
|
||||
if "$abi_dir/check-symbols.sh" "$bwd/driver/$ABI_MODULE" "$twd" >"$out"; then
|
||||
echo "run-matrix: symbols PASS built for $built, loaded into $target"
|
||||
else
|
||||
echo "run-matrix: symbols FAIL built for $built, loaded into $target"
|
||||
sed 's/^/ /' "$out"
|
||||
fail=1
|
||||
fi
|
||||
done
|
||||
done
|
||||
exit $fail
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
# Print a pkg-config directory whose xorg-server.pc points at a server
|
||||
# staged by build-server.sh.
|
||||
#
|
||||
# staged-pc.sh <server-workdir>
|
||||
#
|
||||
# The staged xorg-server.pc keeps prefix=/usr. Write a copy to
|
||||
# <server-workdir>/pkgconfig with prefix set to the staged root; its other
|
||||
# paths are relative to ${prefix}. Every other package keeps coming from the
|
||||
# system. (The PKG_CONFIG_XORG_SERVER_PREFIX override is not honoured by
|
||||
# every pkg-config: Ubuntu's pkgconf 2.5.1 ignores it.)
|
||||
|
||||
set -eu
|
||||
|
||||
[ $# -eq 1 ] || { echo "usage: $0 <server-workdir>" >&2; exit 2; }
|
||||
|
||||
wd=$(cd "$1" && pwd)
|
||||
root=$wd/root
|
||||
|
||||
pc=
|
||||
for f in "$root"/usr/lib*/pkgconfig/xorg-server.pc \
|
||||
"$root"/usr/lib/*/pkgconfig/xorg-server.pc; do
|
||||
[ -f "$f" ] || continue
|
||||
[ -z "$pc" ] || { echo "staged-pc: more than one xorg-server.pc under $root" >&2; exit 1; }
|
||||
pc=$f
|
||||
done
|
||||
[ -n "$pc" ] || { echo "staged-pc: no xorg-server.pc under $root" >&2; exit 1; }
|
||||
|
||||
grep -q '^prefix=/usr$' "$pc" || {
|
||||
echo "staged-pc: $pc does not have prefix=/usr" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
mkdir -p "$wd/pkgconfig"
|
||||
{
|
||||
echo "prefix=$root/usr"
|
||||
grep -v '^prefix=' "$pc"
|
||||
} >"$wd/pkgconfig/xorg-server.pc"
|
||||
echo "$wd/pkgconfig"
|
||||
Reference in new issue
Block a user