From fd94b858738f05cc1b6ee3a0ed2bea9803e9bba7 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 3 May 2017 22:27:55 +0200 Subject: [PATCH] Dockerfile for SCTP conformance test suite --- sctp-test/0001-Fix-compilation-on-Linux.patch | 33 +++++++++++++++++ ...of-scheduler-priorities-and-mlockall.patch | 37 +++++++++++++++++++ sctp-test/Dockerfile | 27 ++++++++++++++ sctp-test/run | 4 ++ 4 files changed, 101 insertions(+) create mode 100644 sctp-test/0001-Fix-compilation-on-Linux.patch create mode 100644 sctp-test/0001-disable-the-use-of-scheduler-priorities-and-mlockall.patch create mode 100644 sctp-test/Dockerfile create mode 100755 sctp-test/run diff --git a/sctp-test/0001-Fix-compilation-on-Linux.patch b/sctp-test/0001-Fix-compilation-on-Linux.patch new file mode 100644 index 00000000..7ccf3e0a --- /dev/null +++ b/sctp-test/0001-Fix-compilation-on-Linux.patch @@ -0,0 +1,33 @@ +From 3ed7dcf137c7ec53077faf31aae40b3c04cbedad Mon Sep 17 00:00:00 2001 +From: Harald Welte +Date: Wed, 3 May 2017 22:13:54 +0200 +Subject: [PATCH] Fix compilation on Linux + +DEBUG_LOGGING is a #define, we have to use the preprocessor to check for +it. +--- + gtests/net/packetdrill/packet_socket_linux.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gtests/net/packetdrill/packet_socket_linux.c b/gtests/net/packetdrill/packet_socket_linux.c +index 8abf106..572b5b8 100644 +--- a/gtests/net/packetdrill/packet_socket_linux.c ++++ b/gtests/net/packetdrill/packet_socket_linux.c +@@ -175,12 +175,12 @@ void packet_socket_set_filter(struct packet_socket *psock, + bpfcode.filter[3].k = ((client_ether[0] << 8) | + (client_ether[1])); + +- if (DEBUG_LOGGING) { ++#ifdef DEBUG_LOGGING + int i; + DEBUGP("filter constants:\n"); + for (i = 0; i < bpfcode.len; ++i) + DEBUGP("0x%x\n", bpfcode.filter[i].k); +- } ++#endif + + /* Attach the filter. */ + if (setsockopt(psock->packet_fd, SOL_SOCKET, SO_ATTACH_FILTER, +-- +2.11.0 + diff --git a/sctp-test/0001-disable-the-use-of-scheduler-priorities-and-mlockall.patch b/sctp-test/0001-disable-the-use-of-scheduler-priorities-and-mlockall.patch new file mode 100644 index 00000000..9a121167 --- /dev/null +++ b/sctp-test/0001-disable-the-use-of-scheduler-priorities-and-mlockall.patch @@ -0,0 +1,37 @@ +From f3635ca581643f489836f6c603c9888ab7595c36 Mon Sep 17 00:00:00 2001 +From: Harald Welte +Date: Wed, 3 May 2017 22:31:53 +0200 +Subject: [PATCH] disable the use of scheduler priorities and mlockall + +This doesn't work inside of docker, so let's disable it +--- + gtests/net/packetdrill/run.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/gtests/net/packetdrill/run.c b/gtests/net/packetdrill/run.c +index 54f4ebb..66a4c07 100644 +--- a/gtests/net/packetdrill/run.c ++++ b/gtests/net/packetdrill/run.c +@@ -439,7 +439,7 @@ void set_scheduling_priority(void) + if (num_cpus <= 1) + return; + +-#if !defined(__OpenBSD__) ++#if 0 + /* Chose a real-time policy, but use SCHED_RR instead of + * SCHED_FIFO, so that we round-robin among real-time threads + * of the same priority. In practice this shouldn't matter, +@@ -466,8 +466,10 @@ void set_scheduling_priority(void) + */ + void lock_memory(void) + { ++#if 0 + if (mlockall(MCL_CURRENT | MCL_FUTURE)) + die_perror("lockall(MCL_CURRENT | MCL_FUTURE)"); ++#endif + } + + /* Wait for and return the wall time at which we should start the +-- +2.11.0 + diff --git a/sctp-test/Dockerfile b/sctp-test/Dockerfile new file mode 100644 index 00000000..56fcefc3 --- /dev/null +++ b/sctp-test/Dockerfile @@ -0,0 +1,27 @@ +FROM debian-jessie-build + +MAINTAINER Harald Welte + +RUN apt-get update && apt-get install -y \ + bison flex + +COPY *.patch /tmp/ + +RUN git config --global user.email "nobody@localhost" && \ + git config --global user.name "Docker Container" + +WORKDIR /tmp + +RUN git clone https://github.com/nplab/packetdrill && \ + cd packetdrill && \ + git am /tmp/*.patch && \ + cd gtests/net/packetdrill && \ + ./configure && \ + make && \ + cp packetdrill /usr/bin/ + +RUN git clone https://github.com/nplab/ETSI-SCTP-Conformance-Testsuite.git + +COPY run /tmp/run + +CMD /tmp/run diff --git a/sctp-test/run b/sctp-test/run new file mode 100755 index 00000000..a3012348 --- /dev/null +++ b/sctp-test/run @@ -0,0 +1,4 @@ +#!/bin/sh +[ -d /dev/net ] || mkdir -p /dev/net +[ -c /dev/net/tun ] || mknod /dev/net/tun c 10 200 +cd /tmp/ETSI-SCTP-Conformance-Testsuite && ./run-all-tests