summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2017-01-03 12:23:17 +0000
committerColin Watson <cjwatson@debian.org>2017-01-03 12:24:02 +0000
commitba96642edeb90c3a6ded02d367741b26ccd21afc (patch)
treec6e82b5059fb9f091db9af05e25bca642e08670f
parent211eea7b947be4e9644f8f0f9169357f1f7b2296 (diff)
parentcc50ca70e3b438577c33a85147e2a68666deaad9 (diff)
Create mux socket for regression tests in a temporary directory.
-rw-r--r--Makefile.in5
-rw-r--r--debian/.git-dpm4
-rw-r--r--debian/changelog6
-rw-r--r--debian/patches/regress-mktemp.patch167
-rw-r--r--debian/patches/series1
-rw-r--r--regress/forwarding.sh3
-rw-r--r--regress/mkdtemp.c59
-rw-r--r--regress/multiplex.sh3
-rw-r--r--regress/test-exec.sh11
9 files changed, 255 insertions, 4 deletions
diff --git a/Makefile.in b/Makefile.in
index a6eb81ec2..a00347e24 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -459,6 +459,10 @@ regress/check-perm$(EXEEXT): $(srcdir)/regress/check-perm.c $(REGRESSLIBS)
459 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(srcdir)/regress/check-perm.c \ 459 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(srcdir)/regress/check-perm.c \
460 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) 460 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
461 461
462regress/mkdtemp$(EXEEXT): $(srcdir)/regress/mkdtemp.c $(REGRESSLIBS)
463 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(srcdir)/regress/mkdtemp.c \
464 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
465
462UNITTESTS_TEST_HELPER_OBJS=\ 466UNITTESTS_TEST_HELPER_OBJS=\
463 regress/unittests/test_helper/test_helper.o \ 467 regress/unittests/test_helper/test_helper.o \
464 regress/unittests/test_helper/fuzz.o 468 regress/unittests/test_helper/fuzz.o
@@ -557,6 +561,7 @@ regress-binaries: regress/modpipe$(EXEEXT) \
557 regress/setuid-allowed$(EXEEXT) \ 561 regress/setuid-allowed$(EXEEXT) \
558 regress/netcat$(EXEEXT) \ 562 regress/netcat$(EXEEXT) \
559 regress/check-perm$(EXEEXT) \ 563 regress/check-perm$(EXEEXT) \
564 regress/mkdtemp$(EXEEXT) \
560 regress/unittests/sshbuf/test_sshbuf$(EXEEXT) \ 565 regress/unittests/sshbuf/test_sshbuf$(EXEEXT) \
561 regress/unittests/sshkey/test_sshkey$(EXEEXT) \ 566 regress/unittests/sshkey/test_sshkey$(EXEEXT) \
562 regress/unittests/bitmap/test_bitmap$(EXEEXT) \ 567 regress/unittests/bitmap/test_bitmap$(EXEEXT) \
diff --git a/debian/.git-dpm b/debian/.git-dpm
index 1f8d45838..d413019d4 100644
--- a/debian/.git-dpm
+++ b/debian/.git-dpm
@@ -1,6 +1,6 @@
1# see git-dpm(1) from git-dpm package 1# see git-dpm(1) from git-dpm package
2d225c4fe44ad94a30a5033e58594f2bebaa674f2 2cc50ca70e3b438577c33a85147e2a68666deaad9
3d225c4fe44ad94a30a5033e58594f2bebaa674f2 3cc50ca70e3b438577c33a85147e2a68666deaad9
4971a7653746a6972b907dfe0ce139c06e4a6f482 4971a7653746a6972b907dfe0ce139c06e4a6f482
5971a7653746a6972b907dfe0ce139c06e4a6f482 5971a7653746a6972b907dfe0ce139c06e4a6f482
6openssh_7.4p1.orig.tar.gz 6openssh_7.4p1.orig.tar.gz
diff --git a/debian/changelog b/debian/changelog
index 424aae990..872eeb404 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
1openssh (1:7.4p1-5) UNRELEASED; urgency=medium
2
3 * Create mux socket for regression tests in a temporary directory.
4
5 -- Colin Watson <cjwatson@debian.org> Tue, 03 Jan 2017 12:23:34 +0000
6
1openssh (1:7.4p1-4) unstable; urgency=medium 7openssh (1:7.4p1-4) unstable; urgency=medium
2 8
3 * Run regression tests inside annotate-output to try to diagnose timeout 9 * Run regression tests inside annotate-output to try to diagnose timeout
diff --git a/debian/patches/regress-mktemp.patch b/debian/patches/regress-mktemp.patch
new file mode 100644
index 000000000..2d9b436f5
--- /dev/null
+++ b/debian/patches/regress-mktemp.patch
@@ -0,0 +1,167 @@
1From cc50ca70e3b438577c33a85147e2a68666deaad9 Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@debian.org>
3Date: Tue, 3 Jan 2017 12:09:42 +0000
4Subject: Create mux socket for regress in temp directory
5
6In some setups, creating the socket under OBJ may result in a path that
7is too long for a Unix domain socket. Add a helper to let us portably
8create a temporary directory instead.
9
10Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=2660
11Last-Update: 2017-01-03
12
13Patch-Name: regress-mktemp.patch
14---
15 Makefile.in | 5 +++++
16 regress/forwarding.sh | 3 ++-
17 regress/mkdtemp.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++
18 regress/multiplex.sh | 3 ++-
19 regress/test-exec.sh | 11 ++++++++++
20 5 files changed, 79 insertions(+), 2 deletions(-)
21 create mode 100644 regress/mkdtemp.c
22
23diff --git a/Makefile.in b/Makefile.in
24index a6eb81ec..a00347e2 100644
25--- a/Makefile.in
26+++ b/Makefile.in
27@@ -459,6 +459,10 @@ regress/check-perm$(EXEEXT): $(srcdir)/regress/check-perm.c $(REGRESSLIBS)
28 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(srcdir)/regress/check-perm.c \
29 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
30
31+regress/mkdtemp$(EXEEXT): $(srcdir)/regress/mkdtemp.c $(REGRESSLIBS)
32+ $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(srcdir)/regress/mkdtemp.c \
33+ $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
34+
35 UNITTESTS_TEST_HELPER_OBJS=\
36 regress/unittests/test_helper/test_helper.o \
37 regress/unittests/test_helper/fuzz.o
38@@ -557,6 +561,7 @@ regress-binaries: regress/modpipe$(EXEEXT) \
39 regress/setuid-allowed$(EXEEXT) \
40 regress/netcat$(EXEEXT) \
41 regress/check-perm$(EXEEXT) \
42+ regress/mkdtemp$(EXEEXT) \
43 regress/unittests/sshbuf/test_sshbuf$(EXEEXT) \
44 regress/unittests/sshkey/test_sshkey$(EXEEXT) \
45 regress/unittests/bitmap/test_bitmap$(EXEEXT) \
46diff --git a/regress/forwarding.sh b/regress/forwarding.sh
47index a1a4b13f..592de7bc 100644
48--- a/regress/forwarding.sh
49+++ b/regress/forwarding.sh
50@@ -10,7 +10,8 @@ start_sshd
51 base=33
52 last=$PORT
53 fwd=""
54-CTL=$OBJ/ctl-sock
55+make_tmpdir
56+CTL=$TMP/ctl-sock
57
58 for j in 0 1 2; do
59 for i in 0 1 2; do
60diff --git a/regress/mkdtemp.c b/regress/mkdtemp.c
61new file mode 100644
62index 00000000..8c7d2e21
63--- /dev/null
64+++ b/regress/mkdtemp.c
65@@ -0,0 +1,59 @@
66+/*
67+ * Copyright (c) 2017 Colin Watson <cjwatson@debian.org>
68+ *
69+ * Permission to use, copy, modify, and distribute this software for any
70+ * purpose with or without fee is hereby granted, provided that the above
71+ * copyright notice and this permission notice appear in all copies.
72+ *
73+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
74+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
75+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
76+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
77+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
78+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
79+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
80+ */
81+
82+/* Roughly equivalent to "mktemp -d -t TEMPLATE", but portable. */
83+
84+#include "includes.h"
85+
86+#include <limits.h>
87+#include <stdio.h>
88+#include <stdlib.h>
89+
90+#include "log.h"
91+
92+static void
93+usage(void)
94+{
95+ fprintf(stderr, "mkdtemp template\n");
96+ exit(1);
97+}
98+
99+int
100+main(int argc, char **argv)
101+{
102+ const char *base;
103+ const char *tmpdir;
104+ char template[PATH_MAX];
105+ int r;
106+ char *dir;
107+
108+ if (argc != 2)
109+ usage();
110+ base = argv[1];
111+
112+ if ((tmpdir = getenv("TMPDIR")) == NULL)
113+ tmpdir = "/tmp";
114+ r = snprintf(template, sizeof(template), "%s/%s", tmpdir, base);
115+ if (r < 0 || (size_t)r >= sizeof(template))
116+ fatal("template string too long");
117+ dir = mkdtemp(template);
118+ if (dir == NULL) {
119+ perror("mkdtemp");
120+ exit(1);
121+ }
122+ puts(dir);
123+ return 0;
124+}
125diff --git a/regress/multiplex.sh b/regress/multiplex.sh
126index acb9234d..0ac4065e 100644
127--- a/regress/multiplex.sh
128+++ b/regress/multiplex.sh
129@@ -1,7 +1,8 @@
130 # $OpenBSD: multiplex.sh,v 1.27 2014/12/22 06:14:29 djm Exp $
131 # Placed in the Public Domain.
132
133-CTL=/tmp/openssh.regress.ctl-sock.$$
134+make_tmpdir
135+CTL=$TMP/ctl-sock
136
137 tid="connection multiplexing"
138
139diff --git a/regress/test-exec.sh b/regress/test-exec.sh
140index bfa48803..13a8e18f 100644
141--- a/regress/test-exec.sh
142+++ b/regress/test-exec.sh
143@@ -317,6 +317,14 @@ stop_sshd ()
144 fi
145 }
146
147+TMP=
148+
149+make_tmpdir ()
150+{
151+ TMP="$($OBJ/mkdtemp openssh-regress-XXXXXXXXXXXX)" || \
152+ fatal "failed to create temporary directory"
153+}
154+
155 # helper
156 cleanup ()
157 {
158@@ -327,6 +335,9 @@ cleanup ()
159 kill $SSH_PID
160 fi
161 fi
162+ if [ "x$TMP" != "x" ]; then
163+ rm -rf "$TMP"
164+ fi
165 stop_sshd
166 }
167
diff --git a/debian/patches/series b/debian/patches/series
index 61090cc88..a743bec00 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -26,3 +26,4 @@ systemd-readiness.patch
26debian-config.patch 26debian-config.patch
27regress-integrity-robust.patch 27regress-integrity-robust.patch
28regress-forwarding-race.patch 28regress-forwarding-race.patch
29regress-mktemp.patch
diff --git a/regress/forwarding.sh b/regress/forwarding.sh
index a1a4b13f2..592de7bc3 100644
--- a/regress/forwarding.sh
+++ b/regress/forwarding.sh
@@ -10,7 +10,8 @@ start_sshd
10base=33 10base=33
11last=$PORT 11last=$PORT
12fwd="" 12fwd=""
13CTL=$OBJ/ctl-sock 13make_tmpdir
14CTL=$TMP/ctl-sock
14 15
15for j in 0 1 2; do 16for j in 0 1 2; do
16 for i in 0 1 2; do 17 for i in 0 1 2; do
diff --git a/regress/mkdtemp.c b/regress/mkdtemp.c
new file mode 100644
index 000000000..8c7d2e219
--- /dev/null
+++ b/regress/mkdtemp.c
@@ -0,0 +1,59 @@
1/*
2 * Copyright (c) 2017 Colin Watson <cjwatson@debian.org>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17/* Roughly equivalent to "mktemp -d -t TEMPLATE", but portable. */
18
19#include "includes.h"
20
21#include <limits.h>
22#include <stdio.h>
23#include <stdlib.h>
24
25#include "log.h"
26
27static void
28usage(void)
29{
30 fprintf(stderr, "mkdtemp template\n");
31 exit(1);
32}
33
34int
35main(int argc, char **argv)
36{
37 const char *base;
38 const char *tmpdir;
39 char template[PATH_MAX];
40 int r;
41 char *dir;
42
43 if (argc != 2)
44 usage();
45 base = argv[1];
46
47 if ((tmpdir = getenv("TMPDIR")) == NULL)
48 tmpdir = "/tmp";
49 r = snprintf(template, sizeof(template), "%s/%s", tmpdir, base);
50 if (r < 0 || (size_t)r >= sizeof(template))
51 fatal("template string too long");
52 dir = mkdtemp(template);
53 if (dir == NULL) {
54 perror("mkdtemp");
55 exit(1);
56 }
57 puts(dir);
58 return 0;
59}
diff --git a/regress/multiplex.sh b/regress/multiplex.sh
index acb9234d9..0ac4065e7 100644
--- a/regress/multiplex.sh
+++ b/regress/multiplex.sh
@@ -1,7 +1,8 @@
1# $OpenBSD: multiplex.sh,v 1.27 2014/12/22 06:14:29 djm Exp $ 1# $OpenBSD: multiplex.sh,v 1.27 2014/12/22 06:14:29 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4CTL=/tmp/openssh.regress.ctl-sock.$$ 4make_tmpdir
5CTL=$TMP/ctl-sock
5 6
6tid="connection multiplexing" 7tid="connection multiplexing"
7 8
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index bfa48803b..13a8e18f3 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -317,6 +317,14 @@ stop_sshd ()
317 fi 317 fi
318} 318}
319 319
320TMP=
321
322make_tmpdir ()
323{
324 TMP="$($OBJ/mkdtemp openssh-regress-XXXXXXXXXXXX)" || \
325 fatal "failed to create temporary directory"
326}
327
320# helper 328# helper
321cleanup () 329cleanup ()
322{ 330{
@@ -327,6 +335,9 @@ cleanup ()
327 kill $SSH_PID 335 kill $SSH_PID
328 fi 336 fi
329 fi 337 fi
338 if [ "x$TMP" != "x" ]; then
339 rm -rf "$TMP"
340 fi
330 stop_sshd 341 stop_sshd
331} 342}
332 343