From 0cb28dc8a8ff888181c072051f93b32341e23f17 Mon Sep 17 00:00:00 2001 From: Tommy Reilly Date: Wed, 15 Apr 2026 18:10:45 -0400 Subject: [PATCH] Fix cudaverify tests --- Makefile | 17 ++++++++++++++++- .../mock-cupti-headers/cupti_pcsampling.h | 3 ++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 02c17e260..24ab63b98 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ codespell lint ebpf-profiler format format-ebpf format-go pprof-execs \ pprof_1_23 pprof_1_24 pprof_1_24_cgo otelcol-ebpf-profiler \ rust-components rust-targets rust-tests vanity-import-check vanity-import-fix \ - otel-from-tree otel-from-lib + otel-from-tree otel-from-lib cudaverify-test SHELL := /usr/bin/env bash @@ -191,5 +191,20 @@ agent: legal: go tool $(GO_TOOLS) go-licenses save --force . --save_path=LICENSES +cudaverify-test: ebpf + @set -e; \ + tmpdir=$$(mktemp -d); \ + trap 'rm -rf "$$tmpdir"' EXIT; \ + cupti_headers=$$(go mod download -json github.com/parca-dev/parcagpu@latest 2>/dev/null | \ + sed -n 's/.*"Dir": "\(.*\)".*/\1/p')/ebpf; \ + echo "==> Downloading parcagpu libs into $$tmpdir"; \ + PARCAGPU_DIR="$$tmpdir" $(CURDIR)/test/distro-qemu/download-parcagpu.sh; \ + echo "==> Building cudaverify.test (cupti headers: $$cupti_headers)"; \ + CGO_ENABLED=1 CGO_CFLAGS="-I$$cupti_headers" \ + go test -c -o "$$tmpdir/cudaverify.test" ./test/cudaverify; \ + echo "==> Running cudaverify tests (sudo)"; \ + cd "$$tmpdir" && sudo env LD_LIBRARY_PATH="$$tmpdir" \ + ./cudaverify.test -test.v -so-path ./libparcagpucupti.so + codespell: @codespell diff --git a/test/distro-qemu/mock-cupti-headers/cupti_pcsampling.h b/test/distro-qemu/mock-cupti-headers/cupti_pcsampling.h index 0662da64f..9cb3b8ebd 100644 --- a/test/distro-qemu/mock-cupti-headers/cupti_pcsampling.h +++ b/test/distro-qemu/mock-cupti-headers/cupti_pcsampling.h @@ -21,7 +21,8 @@ typedef struct { uint32_t functionIndex; char *functionName; uint32_t stallReasonCount; - CUpti_PCSamplingStallReason stallReason[CUPTI_PC_SAMPLING_MAX_STALL_REASONS]; + CUpti_PCSamplingStallReason *stallReason; + uint32_t correlationId; } CUpti_PCSamplingPCData; typedef struct {