mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 22:35:33 +00:00
test: Add test-counter test
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
@@ -1 +1,19 @@
|
|||||||
|
SRCS += test-counter.c
|
||||||
|
|
||||||
|
OBJS := $(patsubst %.c,%.o,$(SRCS))
|
||||||
|
PROGS := $(patsubst %.c,%,$(SRCS))
|
||||||
|
|
||||||
|
all: $(PROGS)
|
||||||
|
|
||||||
|
$(PROGS): $(OBJS)
|
||||||
|
$(E) " LINK " $@
|
||||||
|
$(Q) $(CC) $< -o $@
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
$(E) " CC " $@
|
||||||
|
$(Q) $(CC) -c $(CFLAGS) $< -o $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(Q) $(RM) -f ./*.o
|
||||||
|
$(Q) $(RM) -f ./$(PROGS)
|
||||||
|
.PHONY: clean
|
||||||
|
19
test/test-counter.c
Normal file
19
test/test-counter.c
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int counter = 0;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
printf("Pid: %10d Counter: %10d\n",
|
||||||
|
getpid(), counter++);
|
||||||
|
sleep(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Reference in New Issue
Block a user