mirror of
https://github.com/peterbourgon/runsvinit.git
synced 2026-03-05 22:07:22 +01:00
Working test
This commit is contained in:
@@ -1,9 +1,3 @@
|
||||
FROM golang:1.5.1
|
||||
|
||||
COPY ../../*.go /go/src/github.com/peterbourgon/runsvinit
|
||||
RUN go install -v github.com/peterbourgon/runsvinit
|
||||
RUN mv /go/bin/runsvinit /mount/
|
||||
|
||||
FROM alpine:latest
|
||||
RUN apk add --update gcc musl-dev && rm -rf /var/cache/apk/*
|
||||
COPY zombie.c /
|
||||
RUN cc -Wall -Werror -o /zombie /zombie.c
|
||||
RUN mv /zombie /mount/
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
.PHONY: all
|
||||
all: zombie runsvinit
|
||||
|
||||
zombie runsvinit: .uptodate
|
||||
docker run -ti --rm -v $(shell pwd):/mount zombie-build
|
||||
|
||||
.uptodate: Dockerfile ../../*.go
|
||||
docker build -t zombie-build .
|
||||
touch $@
|
||||
@@ -1,18 +1,18 @@
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
pid_t child_pid;
|
||||
|
||||
child_pid = fork ();
|
||||
if (child_pid > 0) {
|
||||
sleep (60);
|
||||
}
|
||||
else {
|
||||
exit (0);
|
||||
}
|
||||
return 0;
|
||||
int main() {
|
||||
pid_t pid;
|
||||
int i;
|
||||
for (i = 0; i<5; i++) {
|
||||
pid = fork();
|
||||
if (pid > 0) {
|
||||
printf("Zombie #%d born\n", i + 1);
|
||||
} else {
|
||||
printf("Brains...\n");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user