From b7bc3f324fcec55a4002e09e6c98738f12a5d01b Mon Sep 17 00:00:00 2001 From: Mattia Meleleo Date: Mon, 27 May 2024 22:16:07 +0200 Subject: [PATCH] ci: install newer clang --- .github/workflows/ci.yml | 5 +++++ testdata/Makefile | 2 +- usdt_test.go | 16 ++++++++-------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8517d76..4c426fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,11 @@ jobs: uses: actions/setup-go@v2.1.3 with: go-version: 1.22.3 + - name: Install newer Clang + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x ./llvm.sh + sudo ./llvm.sh 14 - name: Install dependencies run: | sudo apt-get update diff --git a/testdata/Makefile b/testdata/Makefile index 84acb61..c322da0 100644 --- a/testdata/Makefile +++ b/testdata/Makefile @@ -1,4 +1,4 @@ -CLANG ?= clang-17 +CLANG ?= clang-14 CFLAGS := -O2 -Wall -Werror all: clean simple semaphore lint diff --git a/usdt_test.go b/usdt_test.go index 010aef4..438bbd3 100644 --- a/usdt_test.go +++ b/usdt_test.go @@ -12,6 +12,11 @@ import ( "github.com/mmat11/usdt" ) +const ( + probeInitTime = 100 * time.Millisecond + probeFireTime = 10 * time.Millisecond +) + func TestUSDT(t *testing.T) { if err := rlimit.RemoveMemlock(); err != nil { t.Fatal(err) @@ -22,7 +27,6 @@ func TestUSDT(t *testing.T) { cmd *exec.Cmd provider string probe string - sleep time.Duration }{ { "Python (builtin notes)", @@ -33,28 +37,24 @@ func TestUSDT(t *testing.T) { ), "python", "function__entry", - 100 * time.Millisecond, }, { "Python (libstapsdt)", exec.Command("python", "testdata/libstapsdt.py"), "X", "Y", - 100 * time.Millisecond, }, { "C (simple)", exec.Command("testdata/simple.o"), "X", "Y", - 0, }, { "C (semaphore)", exec.Command("testdata/semaphore.o"), "X", "Y", - 0, }, } @@ -75,7 +75,7 @@ func TestUSDT(t *testing.T) { }() // Give some time for the process to start/setup the probes. - time.Sleep(tt.sleep) + time.Sleep(probeInitTime) // Open and attach the USDT probe. u, err := usdt.New(p, tt.provider, tt.probe, tt.cmd.Process.Pid) @@ -84,7 +84,7 @@ func TestUSDT(t *testing.T) { } // Wait for the probe to fire. - time.Sleep(5 * time.Millisecond) + time.Sleep(probeFireTime) // Assert that the value at index 0 has been updated to 1. assertMapValue(t, m, 0, 1) @@ -99,7 +99,7 @@ func TestUSDT(t *testing.T) { } // Wait for the probe to eventually fire. - time.Sleep(5 * time.Millisecond) + time.Sleep(probeFireTime) // Assert that this time the value has not been updated. assertMapValue(t, m, 0, 0)