Add valgrind memory check for examples

This commit is contained in:
Hui Yu
2022-08-12 14:29:19 +08:00
parent 8f8874e9f5
commit 3fe8c8b11c
10 changed files with 85 additions and 22 deletions

View File

@@ -15,7 +15,7 @@ jobs:
- name: Prepare
run: |
sudo apt-get update
sudo apt-get install -y libssl-dev libcurl4-openssl-dev uncrustify
sudo apt-get install -y libssl-dev libcurl4-openssl-dev uncrustify valgrind
- name: Prepare libwebsockets
run: |
git clone https://libwebsockets.org/repo/libwebsockets --depth 1 --branch v4.2-stable
@@ -65,3 +65,9 @@ jobs:
kubectl describe node
cd examples/
LD_LIBRARY_PATH=$GITHUB_WORKSPACE/kubernetes/build/:/usr/local/lib make test
- name: Valgrind memory check for examples
run: |
kubectl cluster-info --context kind-chart-testing
kubectl describe node
cd examples/
LD_LIBRARY_PATH=$GITHUB_WORKSPACE/kubernetes/build/:/usr/local/lib make memcheck

View File

@@ -36,3 +36,14 @@ test:
cd multi_thread; make test; sleep 10
kubectl describe po test-pod-8
cd exec_pod; make test
memcheck:
cd create_pod; make memcheck; sleep 10
cd list_pod; make memcheck
cd delete_pod; make memcheck
cd list_secret; make memcheck
cd configmap; make memcheck
cd generic; make memcheck
cd multi_thread; make memcheck; sleep 10
kubectl describe po test-pod-8
cd exec_pod; make memcheck

View File

@@ -3,9 +3,15 @@ LIBS:=-L../../kubernetes/build -lkubernetes -lyaml -lwebsockets -L/usr/local/lib
CFLAGS:=-g
BIN:=configmap_bin
.PHONY : all clean test memcheck
all:
gcc main.c $(CFLAGS) $(INCLUDE) $(LIBS) -o $(BIN)
clean:
rm ./$(BIN)
test:
./$(BIN)
memcheck:
valgrind --tool=memcheck --leak-check=full ./$(BIN)
clean:
rm ./$(BIN)

View File

@@ -3,9 +3,15 @@ LIBS:=-L../../kubernetes/build -lkubernetes -lyaml -lwebsockets -L/usr/local/lib
CFLAGS:=-g
BIN:=create_pod_bin
.PHONY : all clean test memcheck
all:
gcc main.c $(CFLAGS) $(INCLUDE) $(LIBS) -o $(BIN)
clean:
rm ./$(BIN)
test:
./$(BIN)
memcheck:
valgrind --tool=memcheck --leak-check=full ./$(BIN)
clean:
rm ./$(BIN)

View File

@@ -3,9 +3,15 @@ LIBS:=-L../../kubernetes/build -lkubernetes -lyaml -lwebsockets -L/usr/local/lib
CFLAGS:=-g
BIN:=delete_pod_bin
.PHONY : all clean test memcheck
all:
gcc main.c $(CFLAGS) $(INCLUDE) $(LIBS) -o $(BIN)
clean:
rm ./$(BIN)
test:
./$(BIN)
memcheck:
valgrind --tool=memcheck --leak-check=full ./$(BIN)
clean:
rm ./$(BIN)

View File

@@ -3,9 +3,15 @@ LIBS:=-L../../kubernetes/build -lkubernetes -lyaml -lwebsockets -L/usr/local/lib
CFLAGS:=-g
BIN:=exec_pod_bin
.PHONY : all clean test memcheck
all:
gcc main.c $(CFLAGS) $(INCLUDE) $(LIBS) -o $(BIN)
clean:
rm ./$(BIN)
test:
./$(BIN) only-run-case-1
memcheck:
valgrind --tool=memcheck --leak-check=full ./$(BIN) only-run-case-1
clean:
rm ./$(BIN)

View File

@@ -3,9 +3,15 @@ LIBS:=-L../../kubernetes/build -lkubernetes -lyaml -lwebsockets -L/usr/local/lib
CFLAGS:=-g
BIN:=generic_bin
.PHONY : all clean test memcheck
all:
gcc main.c $(CFLAGS) $(INCLUDE) $(LIBS) -o $(BIN)
clean:
rm ./$(BIN)
test:
./$(BIN)
memcheck:
valgrind --tool=memcheck --leak-check=full ./$(BIN)
clean:
rm ./$(BIN)

View File

@@ -3,9 +3,15 @@ LIBS:=-L../../kubernetes/build -lyaml -lwebsockets -lkubernetes -L/usr/local/lib
CFLAGS:=-g
BIN:=list_pod_bin
.PHONY : all clean test memcheck
all:
gcc main.c $(CFLAGS) $(INCLUDE) $(LIBS) -o $(BIN)
clean:
rm ./$(BIN)
test:
./$(BIN)
memcheck:
valgrind --tool=memcheck --leak-check=full ./$(BIN)
clean:
rm ./$(BIN)

View File

@@ -3,9 +3,15 @@ LIBS:=-L../../kubernetes/build -lkubernetes -lyaml -lwebsockets -L/usr/local/lib
CFLAGS:=-g
BIN:=list_secret_bin
.PHONY : all clean test memcheck
all:
gcc main.c $(CFLAGS) $(INCLUDE) $(LIBS) -o $(BIN)
clean:
rm ./$(BIN)
memcheck:
valgrind --tool=memcheck --leak-check=full ./$(BIN)
test:
./$(BIN)
clean:
rm ./$(BIN)

View File

@@ -5,14 +5,18 @@ CFLAGS:=-g
BIN:= multi_thread_bin
OBJECTS:=main.o watch_pod.o create_pod.o
.PHONY : all clean test memcheck
all: $(OBJECTS)
$(CC) -o $(BIN) $(OBJECTS) $(LIBS)
$(OBJECTS): %.o: %.c
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
.PHONY : clean test
clean:
rm $(BIN) $(OBJECTS)
test:
./$(BIN)
memcheck:
valgrind --tool=memcheck --leak-check=full ./$(BIN)
clean:
rm $(BIN) $(OBJECTS)