Merge ~racb/ubuntu/+source/mosh:dep8 into ubuntu/+source/mosh:ubuntu/devel

Proposed by Robie Basak
Status: Merged
Approved by: git-ubuntu bot
Approved revision: not available
Merged at revision: 92ef56334c6f4ccd1247488c3502b4740b6b25b7
Proposed branch: ~racb/ubuntu/+source/mosh:dep8
Merge into: ubuntu/+source/mosh:ubuntu/devel
Diff against target: 137 lines (+99/-1)
5 files modified
debian/changelog (+11/-0)
debian/control (+2/-1)
debian/tests/control (+7/-0)
debian/tests/smoke (+28/-0)
debian/tests/upstream-tests (+51/-0)
Reviewer Review Type Date Requested Status
git-ubuntu bot Approve
Sergio Durigan Junior (community) Approve
Robie Basak Pending
Canonical Server Reporter Pending
Review via email: mp+439393@code.launchpad.net

This proposal supersedes a proposal from 2023-03-21.

Description of the change

This makes some suggested review changes to Sergio's MP (the one I've superseded here) and adds a further smoke test that checks mosh's expected functionality from a user's perspective - that mosh to localhost works against openssh.

autopkgtest [14:08:54]: @@@@@@@@@@@@@@@@@@@@ summary
upstream-tests PASS
smoke PASS (superficial)

To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote : Posted in a previous version of this proposal

Thank you so much Sergio, this is much more than a small first step!

Revision history for this message
Robie Basak (racb) wrote : Posted in a previous version of this proposal

This looks great, thanks!

According to the autopkgtest spec, changing the source tree is not permitted, so I'll add a commit to take a copy first.

One inline comment - I'll add a commit for that, too.

So I have a couple of changes to this to propose back to you, and a separate smoke dep8 test to add. I'll submit my own MP that builds on your commits, and then supersede this one.

Personally I think the name debian/tests/upstream-tests has a redundant "tests" in there. I'd use debian/tests/upstream instead. Admittedly upstream-tests is the name the hello package uses. But it doesn't matter :)

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

LGTM.

review: Approve
Revision history for this message
git-ubuntu bot (git-ubuntu-bot) wrote :

Approvers: racb, sergiodj
Uploaders: racb, sergiodj
MP auto-approved

review: Approve
Revision history for this message
Robie Basak (racb) wrote :

Uploaded. Thanks!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index af36f16..2f1ba64 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,14 @@
6+mosh (1.4.0-1ubuntu1) lunar; urgency=medium
7+
8+ [ Sergio Durigan Junior ]
9+ * d/t/upstream-tests: New dep8 test which runs the upstream test
10+ suite against a system mosh.
11+
12+ [ Robie Basak ]
13+ * d/t/smoke: smoke test for mosh using pexpect.
14+
15+ -- Robie Basak <robie.basak@ubuntu.com> Wed, 22 Mar 2023 13:36:00 +0000
16+
17 mosh (1.4.0-1build1) lunar; urgency=medium
18
19 * Rebuild against new libprotobuf32.
20diff --git a/debian/control b/debian/control
21index 6908e92..ea7df0e 100644
22--- a/debian/control
23+++ b/debian/control
24@@ -1,7 +1,8 @@
25 Source: mosh
26 Section: net
27 Priority: optional
28-Maintainer: Keith Winstein <keithw@mit.edu>
29+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
30+XSBC-Original-Maintainer: Keith Winstein <keithw@mit.edu>
31 Uploaders: Alex Chernyakhovsky <achernya@debian.org>, Benjamin Barenblat <bbaren@debian.org>
32 Build-Depends: debhelper-compat (= 12), protobuf-compiler, libprotobuf-dev, pkg-config, libutempter-dev, zlib1g-dev, libncurses5-dev, libssl-dev, bash-completion, locales <!nocheck>, tmux <!nocheck>, less <!nocheck>
33 Rules-Requires-Root: binary-targets
34diff --git a/debian/tests/control b/debian/tests/control
35new file mode 100644
36index 0000000..7623e07
37--- /dev/null
38+++ b/debian/tests/control
39@@ -0,0 +1,7 @@
40+Tests: upstream-tests
41+Depends: @, @builddeps@
42+Restrictions: allow-stderr
43+
44+Tests: smoke
45+Depends: mosh, openssh-server, python3-pexpect
46+Restrictions: allow-stderr, isolation-container, needs-root, superficial, breaks-testbed
47diff --git a/debian/tests/smoke b/debian/tests/smoke
48new file mode 100755
49index 0000000..7ff856d
50--- /dev/null
51+++ b/debian/tests/smoke
52@@ -0,0 +1,28 @@
53+#!/bin/sh
54+set -ex
55+
56+# HOME may not be set in an autopkgtest environment, but we want to be on the
57+# same page as ssh on where ~/.ssh is. See LP: #2012514.
58+if [ "$HOME" = "" ]; then
59+ export HOME=$(getent passwd `whoami`|cut -d: -f6)
60+fi
61+
62+echo 'mosh motd test' > /etc/motd
63+mkdir -pm700 "$HOME"/.ssh
64+if [ ! -f "$HOME"/.ssh/id_rsa ]; then
65+ ssh-keygen -N '' -C mosh-smoke -f "$HOME"/.ssh/id_rsa
66+fi
67+if [ ! -f "$HOME"/.ssh/authorized_keys ] || ! grep -q mosh-smoke\$ "$HOME"/.ssh/authorized_keys; then
68+ cat "$HOME"/.ssh/id_rsa.pub >> "$HOME"/.ssh/authorized_keys
69+fi
70+python3 <<EOT
71+import os
72+import pexpect
73+# Set TERM=dumb so the bash prompt doesn't embed escape sequences to make it
74+# easier to match
75+env = os.environ.copy()
76+env["TERM"] = "dumb"
77+child = pexpect.spawn('mosh --ssh="ssh -o StrictHostKeyChecking=no" localhost', env=env)
78+child.expect('mosh motd test')
79+child.expect(r'(\w+)@([-\w]+):~#')
80+EOT
81diff --git a/debian/tests/upstream-tests b/debian/tests/upstream-tests
82new file mode 100755
83index 0000000..63be333
84--- /dev/null
85+++ b/debian/tests/upstream-tests
86@@ -0,0 +1,51 @@
87+#!/bin/bash
88+
89+set -e
90+
91+# Build mosh. We need to do this because some of the test programs
92+# expect to link against libraries built here.
93+#
94+# We could use "Restrictions: build-needed" on d/t/control, but that'd
95+# also invoke dh_auto_test which only wastes our time.
96+
97+echo "I: Copying source tree so that we can modify it"
98+mkdir "$AUTOPKGTEST_TMP/build"
99+shopt -s nullglob
100+cp -a * "$AUTOPKGTEST_TMP/build"
101+cd "$AUTOPKGTEST_TMP/build"
102+
103+echo "I: Building mosh"
104+./debian/rules override_dh_auto_configure
105+make -j$(nproc)
106+
107+# Remove all possible local mosh binaries that could confuse the test
108+# suite.
109+echo "I: Removing all locally-built mosh binaries"
110+rm -fv \
111+ scripts/mosh \
112+ src/frontend/mosh-client \
113+ src/frontend/mosh-server \
114+ src/tests/mosh-client \
115+ src/tests/mosh-server
116+
117+# Adjust mosh's test scripts to use mosh-{client,server} from the
118+# system.
119+echo "I: Adjusting mosh's test suite to use the system-installed mosh binaries"
120+find src/tests/ -type f -print0 | xargs -0 sed -i \
121+ -e 's@ --client=.\?[^ ]*\/mosh-client.\? @ --client=/usr/bin/mosh-client @' \
122+ -e 's@ --server=.\?[^ ]*\/mosh-server.\? @ --server=/usr/bin/mosh-server @' \
123+ -e 's@\.\.\/\.\.\/scripts\/mosh@/usr/bin/mosh@' \
124+ -e 's@export MOSH_CLIENT=.*@export MOSH_CLIENT="/usr/bin/mosh-client"@' \
125+ -e 's@export MOSH_SERVER=.*@export MOSH_SERVER="/usr/bin/mosh-server"@'
126+
127+echo "I: Running tests"
128+if ! make check; then
129+ echo "E: Testsuite failed to run:"
130+ if [ -f src/tests/test-suite.log ]; then
131+ echo
132+ cat src/tests/test-suite.log
133+ fi
134+ exit 1
135+fi
136+
137+exit 0

Subscribers

People subscribed via source and target branches

to all changes: