public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob 5e67a463db7a034a0c4c2ae68e25d81e19bad67b 7366 bytes (raw)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
 
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# PASST - Plug A Simple Socket Transport
#  for qemu/UNIX domain socket mode
#
# PASTA - Pack A Subtle Tap Abstraction
#  for network namespace/tap device mode
#
# test/distro/ubuntu - Ubuntu builds, get packages via passt, test pasta
#
# Copyright (c) 2021 Red Hat GmbH
# Author: Stefano Brivio <sbrivio@redhat.com>

temp	PIDFILE
htools	qemu-img virt-edit guestfish cat kill qemu-system-x86_64 qemu-system-ppc64 qemu-system-s390x

# Quick pasta test: send message from init to ns, and from ns to init
def	distro_quick_pasta_test
host	(socat -u TCP6-LISTEN:10000 OPEN:/tmp/init_msg,create,trunc; echo "from_init" | socat -u STDIN TCP6:[::1]:9999) &
hostb	./pasta
sleep	1
host	PS1='$ '
host	socat -u TCP6-LISTEN:9999 OPEN:/tmp/ns_msg,create,trunc &
sleep	2
host	echo "from_ns" | socat -u STDIN TCP6:[::1]:10000
sleep	2
host	echo
sleep	1
hout	NS_MSG cat /tmp/ns_msg
check	[ __NS_MSG__ = "from_init" ]
hostb	exit
host	echo
hout	INIT_MSG cat /tmp/init_msg
check	[ __INIT_MSG__ = "from_ns" ]
endef

# Quick pasta test: netcat-openbsd version for Ubuntu 16.04 ppc64
def	distro_quick_pasta_test_netcat
host	(nc -w1 -6 -l -p 10000 > /tmp/init_msg; echo "from_init" | nc -q0 ::1 9999) &
hostb	./pasta
sleep	1
host	PS1='$ '
host	nc -w1 -6 -l -p 9999 > /tmp/ns_msg &
sleep	2
host	echo "from_ns" | nc -q0 ::1 10000
sleep	2
host	echo
sleep	1
hout	NS_MSG cat /tmp/ns_msg
check	[ __NS_MSG__ = "from_init" ]
hostb	exit
host	echo
hout	INIT_MSG cat /tmp/init_msg
check	[ __INIT_MSG__ = "from_ns" ]
endef

# With systemd-resolved and TCG, DNS might take a while to work
def	dns_ready_wait
host	r=10; while [ \${r} -gt 0 ]; do host ubuntu.com && break; sleep 5; r=\$((r - 1)); done
endef

# Start passt, set common variables
hostb	./passt -P __PIDFILE__ &
sleep	1
host	echo
hout	GUEST_FILES ls -1 *.c *.h *.sh passt.1 qrap.1 Makefile README.md | tr '\n' ' '; echo


test	Ubuntu 14.04.5 LTS (Trusty Tahr), amd64

temp	IMG
host	qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/trusty-server-cloudimg-amd64-disk1.img __IMG__
host	virt-edit -a __IMG__ /etc/init/ttyS0.conf -e 's/\/getty/\/getty --autologin root/'
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-config.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-final.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-container.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-local.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-nonet.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-log-shutdown.conf
host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/

host	./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none -drive file=__IMG__,if=virtio -net socket,fd=5 -net nic,model=virtio
host	PS1='$ '
sleep	2
host	apt-get update
host	apt-get -y install make gcc socat

host	make clean
host	CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits" make

# TODO: pasta test skipped for the moment: clone() as called by NS_CALL hangs
# with wrapper provided by glibc 2.19, probably wrong argument order.

hint
sleep	1

# PIDFILE is cleaned up when the next test starts, read it now
hout	PID cat __PIDFILE__


test	Ubuntu 14.04.5 LTS (Trusty Tahr), i386

temp	IMG
host	qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/trusty-server-cloudimg-i386-disk1.img __IMG__
host	virt-edit -a __IMG__ /etc/init/ttyS0.conf -e 's/\/getty/\/getty --autologin root/'
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-config.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-final.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-container.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-local.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-nonet.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-log-shutdown.conf
host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/

host	./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none -drive file=__IMG__,if=virtio -net socket,fd=5 -net nic,model=virtio
host	PS1='$ '
sleep	2
host	apt-get update
host	apt-get -y install make gcc socat

host	make clean
host	CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits -Wno-sign-compare" make

# TODO: pasta test skipped for the moment: clone() as called by NS_CALL hangs
# with wrapper provided by glibc 2.19, probably wrong argument order.

hint
sleep	1


test	Ubuntu 14.04.5 LTS (Trusty Tahr), ppc64le

temp	IMG
host	qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/trusty-server-cloudimg-ppc64el-disk1.img __IMG__
host	virt-edit -a __IMG__ /etc/init/hvc0.conf -e 's/\/getty/\/getty --autologin root/'
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-config.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-final.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-container.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-local.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-nonet.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init.conf
host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-log-shutdown.conf
host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/

host	./qrap 5 qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
host	PS1='$ '
sleep	2
host	apt-get update
host	apt-get -y install make gcc socat

host	make clean
host	CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits -Wno-sign-compare" make

# TODO: pasta test skipped for the moment: clone() as called by NS_CALL hangs
# with wrapper provided by glibc 2.19, probably wrong argument order.

hint
sleep	1
hostb	reset
sleep	1
host	echo


test	Ubuntu 16.04 LTS (Xenial Xerus), ppc64 (be)

host	./qrap 5 qemu-system-ppc64 -m 1024 -M pseries -nographic -nodefaults -serial stdio -no-reboot -nographic -vga none -hda __BASEPATH__/prepared-xenial-server-cloudimg-powerpc-disk1.img -net socket,fd=5 -net nic,model=virtio -snapshot
host	PS1='$ '
host	dhclient -4
# Skip apt-get update here: some updates to xenial-updates around 2022-01-30
# broke dependencies for libc6 and gcc-5 -- note that powerpc is not officially
# supported on this version

# socat not available: install netcat-openbsd and run the test with it
host	apt-get -y install make gcc netcat-openbsd

host	make clean
host	CFLAGS="-Werror" make

distro_quick_pasta_test_netcat

hint
sleep	1
hostb	reset
sleep	1
host	echo


test	Ubuntu 22.04 (Jammy Jellyfish), s390x

host	./qrap 5 qemu-system-s390x -m 2048 -smp 2 -serial stdio -nodefaults -nographic __BASEPATH__/prepared-jammy-server-cloudimg-s390x.img -net socket,fd=5 -net nic,model=virtio -device virtio-rng-ccw -snapshot

host	export DEBIAN_FRONTEND=noninteractive
host	apt-get -y remove needrestart snapd
host	dhclient -4
dns_ready_wait
host	apt-get update
host	apt-get -y install make gcc socat

host	make clean
host	CFLAGS="-Werror" make

host	export SHELL="/bin/dash"
host	dash
distro_quick_pasta_test

hint
sleep	1
hostb	reset
sleep	1
host	echo


host	kill __PID__

debug log:

solving 5e67a46 ...
found 5e67a46 in https://passt.top/passt

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).