Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
yunwei37 committed Nov 19, 2023
1 parent db9ec7b commit e10fb4f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ jobs:
victim: /bin/bash
syscall_trace: false
expected_str: "info"

- path: libbpf-tools/syscount
executable: ./syscount
victim: /bin/bash
syscall_trace: false
expected_str: "info"
steps:
- uses: actions/checkout@v2
with:
Expand Down
4 changes: 3 additions & 1 deletion example/libbpf-tools/syscount/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ $(call allow-override,CC,$(CROSS_COMPILE)cc)
$(call allow-override,LD,$(CROSS_COMPILE)ld)

.PHONY: all
all: $(APPS)
all: $(APPS) victim

.PHONY: clean
clean:
Expand Down Expand Up @@ -137,3 +137,5 @@ $(APPS): %: $(OUTPUT)/%.o $(LIBBPF_OBJ) errno_helpers.c syscall_helpers.c | $(OU
# keep intermediate (.skel.h, .bpf.o, etc) targets
.SECONDARY:

victim: victim.cpp
$(CXX) victim.cpp -Wall -g -o victim
22 changes: 22 additions & 0 deletions example/libbpf-tools/syscount/victim.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <cassert>
#include <cstdio>
#include <fcntl.h>
#include <iostream>
#include <ostream>
#include <unistd.h>
int main()
{
while (true) {
std::cout << "Opening test.txt" << std::endl;

int fd = open("test.txt", O_RDONLY | O_CREAT);
assert(fd != -1);

std::cout << "test.txt opened, fd=" << fd << std::endl;
usleep(1000 * 300);
std::cout << "Closing test.txt..." << std::endl;
close(fd);
std::cout << "test.txt closed" << std::endl;
}
return 0;
}

0 comments on commit e10fb4f

Please sign in to comment.