Skip to content

Commit 329baff

Browse files
committed
ci: minimal CI testing setup
Add static and shared build and runtime testing.
1 parent 6b242f8 commit 329baff

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

.github/workflows/test.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: USDT CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install prerequisites
18+
run: |
19+
curl -L -o bpftrace https://github.com/bpftrace/bpftrace/releases/download/v0.21.2/bpftrace
20+
chmod +x bpftrace
21+
./bpftrace --version
22+
23+
- name: Build (static)
24+
run: make SHARED=0 -C tests -j$(nproc) build
25+
26+
- name: Build (shared)
27+
run: make SHARED=1 -C tests -j$(nproc) build
28+
29+
- name: Test (static)
30+
run: make V=1 BPF_TRACE=$(realpath bpftrace) SHARED=0 -C tests test
31+
32+
- name: Test (shared)
33+
run: make V=1 BPF_TRACE=$(realpath bpftrace) SHARED=1 -C tests test

tests/Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ endif
3434
NONTESTS = tester common
3535

3636
TESTS := $(filter-out $(NONTESTS), \
37-
$(shell ls *.{c,cpp} 2>/dev/null | grep -v '^lib' | \
38-
${AWK} '{split($$0, p, /[^A-Za-z_]+/); print p[1]}' | \
37+
$(shell ls *.c *.cpp 2>/dev/null | grep -v '^lib' | \
38+
${AWK} '{split($$0, p, /[^A-Za-z_]+/); print p[1]}' | \
3939
sort | uniq \
4040
) \
4141
)
4242
LIBS := $(filter-out $(NONTESTS), \
43-
$(shell ls lib*.{c,cpp} 2>/dev/null | \
43+
$(shell ls lib*.c lib*.cpp 2>/dev/null | \
4444
${AWK} '{split($$0, p, /[^A-Za-z_]+/); print substr(p[1], 4)}' | \
4545
sort | uniq \
4646
) \
@@ -59,6 +59,7 @@ clean:
5959

6060
.PHONY: list
6161
list:
62+
$(call msg,TESTS,$@)
6263
$(Q)$(foreach test,$(TESTS), $(info $(test)))
6364

6465
.PHONY: build

tests/prepare-bt-script.awk

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
# Emit corresponding bpftrace probe spec:
4141
# U:./test:group:name { printf("%s: some %s fmt %d spec %d\n", probe, str(arg0), (int)arg1, arg2 - 10); }
42-
printf("U:%s:%s:%s { printf(\"%s%s:%s: %s\\n\"%s); }\n",
42+
printf("usdt:%s:%s:%s { printf(\"%s%s:%s: %s\\n\"%s); }\n",
4343
path, group, name,
4444
probe[1] == "lib" ? "lib:" : "", group, name,
4545
fmt, args == "" ? "" : ", " args);

0 commit comments

Comments
 (0)