1
0
mirror of https://github.com/peterbourgon/runsvinit.git synced 2026-03-05 22:07:22 +01:00

Working test

This commit is contained in:
Peter Bourgon
2015-09-28 22:30:44 +02:00
parent 05fe1d1fa6
commit 819c47186c
10 changed files with 142 additions and 48 deletions

View File

@@ -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/

View File

@@ -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 $@

View File

@@ -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;
}