Skip to content

Commit

Permalink
ci: minimal CI testing setup
Browse files Browse the repository at this point in the history
Add static and shared build and runtime testing.
  • Loading branch information
anakryiko committed Nov 19, 2024
1 parent 6b242f8 commit 10dfcdb
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: USDT CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install prerequisites
run: sudo apt-get install -y bpftrace

- name: Build (static)
run: make SHARED=0 -C tests -j$(nproc) build

- name: Build (shared)
run: make SHARED=1 -C tests -j$(nproc) build

- name: Test (static)
run: make V=1 SHARED=0 -C tests test

- name: Test (shared)
run: make SHARED=1 -C tests test
7 changes: 4 additions & 3 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ endif
NONTESTS = tester common

TESTS := $(filter-out $(NONTESTS), \
$(shell ls *.{c,cpp} 2>/dev/null | grep -v '^lib' | \
${AWK} '{split($$0, p, /[^A-Za-z_]+/); print p[1]}' | \
$(shell ls *.c *.cpp 2>/dev/null | grep -v '^lib' | \
${AWK} '{split($$0, p, /[^A-Za-z_]+/); print p[1]}' | \
sort | uniq \
) \
)
LIBS := $(filter-out $(NONTESTS), \
$(shell ls lib*.{c,cpp} 2>/dev/null | \
$(shell ls lib*.c lib*.cpp 2>/dev/null | \
${AWK} '{split($$0, p, /[^A-Za-z_]+/); print substr(p[1], 4)}' | \
sort | uniq \
) \
Expand All @@ -59,6 +59,7 @@ clean:

.PHONY: list
list:
$(call msg,TESTS,$@)
$(Q)$(foreach test,$(TESTS), $(info $(test)))

.PHONY: build
Expand Down
2 changes: 1 addition & 1 deletion tests/prepare-bt-script.awk
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

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

0 comments on commit 10dfcdb

Please sign in to comment.