diff options
-rw-r--r-- | README.md | 63 | ||||
-rwxr-xr-x | deqp-results-to-markdown | 41 | ||||
-rwxr-xr-x | deqp-run | 118 | ||||
-rwxr-xr-x | mesa-debug | 2 | ||||
-rwxr-xr-x | mesa-debug-asan | 4 | ||||
-rwxr-xr-x | mesa-debug-optimized | 2 | ||||
-rwxr-xr-x | mesa-gdb | 2 | ||||
-rwxr-xr-x | mesa-release | 2 | ||||
-rwxr-xr-x | mesa-run | 42 | ||||
-rwxr-xr-x | nj | 7 |
10 files changed, 260 insertions, 23 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..b400975 --- /dev/null +++ b/README.md @@ -0,0 +1,63 @@ +# mesa-run + +A collection of scripts to build and test [Mesa](https://www.mesa3d.org/) without installing it. + +## Scripts + +- [nj](nj) - Run [ninja](https://github.com/ninja-build/ninja) from anywhere in the project git repository. (upstream: [nj repo](gitlab.freedesktop.org/kwg/nj)) +- [mesa-run](mesa-run) - helper script. Not used directly. Requires [jq](https://github.com/jqlang/jq) +- [mesa-debug](mesa-debug) - Debug build +- [mesa-debug-asan](mesa-debug-asan) - Debug build with [AddressSanitizer](https://github.com/google/sanitizers/wiki/AddressSanitizer) +- [mesa-debug-optimized](mesa-debug-optimized) - Debug build with optimization +- [mesa-release](mesa-release) - Release build +- [mesa-gdb](mesa-gdb) - Wrapper around `mesa-debug` that invokes `gdb` +- [deqp-run](deqp-run) - Run dEQP test suites +- [deqp-results-to-markdown](deqp-results-to-markdown) - Generate Markdown table of dEQP test suite results + +## Examples + +### Configure and build debug build + +```console +$ mesa-debug configure +$ nj debug install +``` + +### Run program with local Mesa build + +```console +$ mesa-debug glxinfo +``` + +### Run dEQP + +On ChromeOS, `deqp-run` uses the system-provided `media-gfx/deqp` package. The script should be run from a directory that has space to store the output such as `/mnt/stateful_partition/home/root/`. + +On desktop Linux, `deqp-run` should be run from a git checkout of [VK-GL-CTS](https://github.com/KhronosGroup/VK-GL-CTS/) with a build configured with `-DDEQP_TARGET=surfaceless` in `build/`. + +#### Single test + +```console +$ deqp-run dEQP-VK.graphicsfuzz.spv-stable-pillars-volatile-nontemporal-store +``` + +#### Test suite + +```console +$ deqp-run vk +``` + +### Make Markdown table of dEQP test results + +```console +$ deqp-results-to-markdown +``` + +#### Example output + +| | Pass | Fail | Skip | Warn | Timeout | Flake | +| ---------------- | ---: | ---: | ---: | ---: | ------: | ----: | +| **dEQP-GLES2** |14243| |26| | | | +| **dEQP-GLES3** |42687| |113|2| | | +| **dEQP-GLES31** |37576| |55| | | | +| **dEQP-VK** |486602|2|590787|6|2|1| diff --git a/deqp-results-to-markdown b/deqp-results-to-markdown new file mode 100755 index 0000000..6ef3106 --- /dev/null +++ b/deqp-results-to-markdown @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 + +import csv +import collections + + +def main(): + outcomes = ('Pass', 'Fail', 'Skip', 'Warn', 'Timeout', 'Flake') + header = ''.join([ + '| | ', ' | '.join(outcomes), ' |\n', + '| ---------------- | ', ' | '.join([(len(o) - 1) * '-' + ':' for o in outcomes]), ' |', + ]) + test_results = ''.join([ + '| **dEQP-{API}** |{', '}|{'.join(outcomes), '}|', + ]) + + print(header) + + for API in ('gles2', 'gles3', 'gles31', 'vk'): + histogram = collections.Counter() + for o in outcomes: + histogram[o] = 0 + + try: + with open(f'deqp-{API}/results.csv') as csvfile: + reader = csv.reader(csvfile) + for row in reader: + test_result = row[1] + histogram[test_result] += 1 + except IOError as error: + continue + + for o in outcomes: + if histogram[o] == 0: + histogram[o] = ' ' + + print(test_results.format(API=API.upper(), **histogram)) + + +if __name__ == '__main__': + main() diff --git a/deqp-run b/deqp-run new file mode 100755 index 0000000..3dd33cc --- /dev/null +++ b/deqp-run @@ -0,0 +1,118 @@ +#!/bin/bash + +die() { + echo "$1" + exit 255 +} + +readonly -A CHROMEOS_DEQP_BIN=( + [vk]=/usr/local/deqp/external/vulkancts/modules/vulkan/deqp-vk + [egl]=/usr/local/deqp/modules/egl/deqp-egl + [gles2]=/usr/local/deqp/modules/gles2/deqp-gles2 + [gles3]=/usr/local/deqp/modules/gles3/deqp-gles3 + [gles31]=/usr/local/deqp/modules/gles31/deqp-gles31 +) + +readonly -A LINUX_DEQP_BIN=( + [vk]=build/external/vulkancts/modules/vulkan/deqp-vk + [egl]=build/modules/egl/deqp-egl + [gles2]=build/modules/gles2/deqp-gles2 + [gles3]=build/modules/gles3/deqp-gles3 + [gles31]=build/modules/gles31/deqp-gles31 +) +readonly -A CHROMEOS_DEQP_CASELIST=( + [vk]=/usr/local/deqp/caselists/vk.txt + [egl]=/usr/local/deqp/caselists/egl.txt + [gles2]=/usr/local/deqp/caselists/gles2.txt + [gles3]=/usr/local/deqp/caselists/gles3.txt + [gles31]=/usr/local/deqp/caselists/gles31.txt +) + +readonly -A LINUX_DEQP_CASELIST=( + [vk]=external/vulkancts/mustpass/main/vk-default.txt + [egl]=android/cts/master/egl-master.txt + [gles2]=android/cts/main/gles2-master.txt + [gles3]=android/cts/main/gles3-master.txt + [gles31]=android/cts/main/gles31-master.txt +) + +readonly CHROMEOS_TESTLOG_TO_XML=/usr/local/deqp/executor/testlog-to-xml + +readonly LINUX_TESTLOG_TO_XML=build/executor/testlog-to-xml + +readonly -a DEQP_OPTIONS=( + --deqp-surface-width=256 + --deqp-surface-height=256 + --deqp-surface-type=pbuffer + --deqp-gl-config-name=rgba8888d24s8ms0 + --deqp-visibility=hidden +) + +if [[ $# -eq 1 ]]; then + if [[ $1 == dEQP-* ]]; then + single_test="$1" + + api="${1%%.*}" + api="${api#dEQP-}" + api="${api,,}" + else + api="$1" + fi + + case "${api}" in + vk|egl|gles2|gles3|gles31) + # shellcheck source=/etc/os-release + source <(grep '^ID=' /etc/os-release) + if [[ $ID == chromeos ]]; then + DEQP_BIN="${CHROMEOS_DEQP_BIN[$api]}" + CASELIST="${CHROMEOS_DEQP_CASELIST[$api]}" + TESTLOG_TO_XML="${CHROMEOS_TESTLOG_TO_XML}" + else + DEQP_BIN="${LINUX_DEQP_BIN[$api]}" + CASELIST="${LINUX_DEQP_CASELIST[$api]}" + TESTLOG_TO_XML="${LINUX_TESTLOG_TO_XML}" + fi + ;; + *) + die "Argument must be one of vk|egl|gles2|gles3|gles31 or a dEQP-* test name" + ;; + esac +else + DEQP_BIN="$1" + CASELIST="$2" + TESTLOG_TO_XML="$3" +fi + +if [[ ! -x $DEQP_BIN ]]; then + die "deqp binary '$DEQP_BIN' does not exist or is not executable" +fi +DEQP_BIN="$(realpath "${DEQP_BIN}")" + +if [[ -n $single_test ]]; then + cd "$(dirname "${DEQP_BIN}")" || die "can't cd" + exec "${DEQP_BIN}" "${DEQP_OPTIONS[@]}" -n "${single_test}" +fi + +if [[ ! -r $CASELIST ]]; then + die "Caselist '$CASELIST' does not exist or is not readable" +fi +CASELIST="$(realpath "${CASELIST}")" + +if [[ ! -x $TESTLOG_TO_XML ]]; then + die "testlog-to-xml binary '$TESTLOG_TO_XML' does not exist or is not executable" +fi +TESTLOG_TO_XML="$(realpath "${TESTLOG_TO_XML}")" + +if [[ -e $OUTPUT_DIR ]]; then + die "Output directory '$OUTPUT_DIR' already exists" +fi +OUTPUT_DIR=$(basename "${DEQP_BIN}") + +DEQP_RUNNER_ARGS=( + --caselist "${CASELIST}" + --deqp "${DEQP_BIN}" + --testlog-to-xml "${TESTLOG_TO_XML}" + --output "${OUTPUT_DIR}" +) + +exec deqp-runner run "${DEQP_RUNNER_ARGS[@]}" -- "${DEQP_OPTIONS[@]}" @@ -5,4 +5,4 @@ export cxxflags="${cflags}" export buildtype=debug export builddir=~/projects/mesa/build-debug -exec mesa-run $@ +exec mesa-run "$@" diff --git a/mesa-debug-asan b/mesa-debug-asan index 151140a..3ff7dce 100755 --- a/mesa-debug-asan +++ b/mesa-debug-asan @@ -4,6 +4,6 @@ export cflags="-ggdb3 -O0 -march=native -pipe" export cxxflags="${cflags}" export buildtype=debug export builddir=~/projects/mesa/build-debug-asan -export extra_args=-Db_sanitize=address,undefined +export extra_args=(-Db_sanitize="address,undefined") -exec mesa-run $@ +exec mesa-run "$@" diff --git a/mesa-debug-optimized b/mesa-debug-optimized index c0a07e6..f620f56 100755 --- a/mesa-debug-optimized +++ b/mesa-debug-optimized @@ -5,4 +5,4 @@ export cxxflags="${cflags}" export buildtype=debugoptimized export builddir=~/projects/mesa/build-debug-optimized -exec mesa-run $@ +exec mesa-run "$@" @@ -1,3 +1,3 @@ #!/bin/bash -mesa-debug gdb -q --args $@ +mesa-debug gdb -q --args "$@" diff --git a/mesa-release b/mesa-release index 9e5f347..fa16911 100755 --- a/mesa-release +++ b/mesa-release @@ -5,4 +5,4 @@ export cxxflags="${cflags}" export buildtype=release export builddir=~/projects/mesa/build-release -exec mesa-run $@ +exec mesa-run "$@" @@ -1,5 +1,11 @@ #!/bin/bash +die() { + echo "$1" + exit 255 +} + +[[ -z ${builddir} ]] && die "builddir must be set" prefix="${builddir}"/install machine=$(uname -m) @@ -8,28 +14,32 @@ x86_64) vk_icd="intel_icd.${machine}.json" vulkan_drivers=intel gallium_drivers=iris - tools=intel + tools=drm-shim,intel + extra_args+=(-Dintel-clc=enabled) ;; -aarch64) +aarch64|arm*) vk_icd="freedreno_icd.${machine}.json" vulkan_drivers=freedreno gallium_drivers=freedreno - tools=freedreno + tools=drm-shim,freedreno ;; esac case "$1" in -wipeout) +wipe|wipeout) echo "Removing ${builddir}" - exec rm -rfI "${builddir}" + exec meson setup --wipe "${builddir}" ;; configure) - #export CC=clang - #export CXX=clang++ - #export CC_LD=lld - #export CXX_LD=lld + export LLVM_MAJOR_VERSION="16" + export LLVM_CONFIG="/usr/lib/llvm/${LLVM_MAJOR_VERSION}/bin/llvm-config" + #export CC="/usr/lib/llvm/${LLVM_MAJOR_VERSION}/bin/clang" + #export CXX="/usr/lib/llvm/${LLVM_MAJOR_VERSION}/bin/clang++" + #export CC_LD="/usr/lib/llvm/${LLVM_MAJOR_VERSION}/bin/lld" + #export CXX_LD="${CC_LD}" args=( + --pkg-config-path "/usr/lib/llvm/${LLVM_MAJOR_VERSION}/lib64/pkgconfig" -Dprefix="${prefix}" -Dc_args="${cflags}" -Dcpp_args="${cxxflags}" @@ -37,14 +47,17 @@ configure) -Dbuild-tests=true -Dvulkan-drivers="${vulkan_drivers}" -Dgallium-drivers="${gallium_drivers}" + -Dgallium-rusticl=false -Dgallium-va=auto -Dgallium-xa=disabled + -Dvideo-codecs="vc1dec,h264dec,h264enc,h265dec,h265enc" + -Dvulkan-beta=true -Dbuildtype="${buildtype}" -Dbackend=ninja - "${extra_args}" + "${extra_args[@]}" "${builddir}" ) - exec meson "${args[@]}" + exec meson setup --reconfigure "${args[@]}" ;; build) exec nj "${buildtype}" install @@ -52,12 +65,11 @@ build) esac if ! command -v jq &> /dev/null; then - echo "jq needs to be installed" - exit -1 + die "jq needs to be installed" fi libdir=$(jq -r '.[] | select(.name == "libdir").value' "${builddir}"/meson-info/intro-buildoptions.json) -export LD_LIBRARY_PATH="${prefix}/${libdir}" +export LD_LIBRARY_PATH="${prefix}/${libdir}:${LD_LIBRARY_PATH}" export LIBGL_DRIVERS_PATH="${prefix}/${libdir}"/dri export VK_ICD_FILENAMES="${prefix}"/share/vulkan/icd.d/"${vk_icd}" -exec $@ +exec "$@" @@ -73,5 +73,8 @@ cd "$builddir" extratargets="$(cat extratargets 2>/dev/null)" targets="${@:-all $extratargets}" -ninja $targets -[[ "$targets" == all* ]] && [ -e install ] && ninja install > /dev/null +ninja $targets || exit $? + +if [[ "$targets" == all* ]] && [ -e install ]; then + ninja install > /dev/null +fi |