public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob efec95571463d89504e83e2ba380ac3b2a22591f 3341 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
 
#!/bin/sh -e
#
# 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/run - Entry point to run test cases and demo
#
# Copyright (c) 2021 Red Hat GmbH
# Author: Stefano Brivio <sbrivio@redhat.com>

# Start an X terminal and capture a video of the test run (also set for ./ci)
CI=${CI:-0}

# Start an X terminal and show the demo (also set for ./demo)
DEMO=${DEMO:-0}

# Base path for output files
BASEPATH=${BASEPATH:-"$(pwd)"}

# Location of log files for test run
LOGDIR=${LOGDIR:-"${BASEPATH}/test_logs"}
LOGFILE=${LOGFILE:-"${LOGDIR}/test.log"}

# If set, skip typing delays while issuing commands in panes
FAST=${FAST:-1}

# If set, run passt and pasta with debug options
DEBUG=${DEBUG:-0}

# If set, tell passt and pasta to take packet captures
PCAP=${PCAP:-0}

COMMIT="$(git log --oneline --no-decorate -1)"

. lib/util
. lib/setup
. lib/term
. lib/perf_report
. lib/layout
. lib/test
. lib/video

# cleanup() - Remove temporary files
cleanup() {
	rm -f /tmp/.passt_test_log_pipe
}

# run() - Call setup functions, run tests, handle exit from test session
run() {
	rm -f /tmp/.passt_test_log_pipe
	mkfifo /tmp/.passt_test_log_pipe

	term
	perf_init
	[ ${CI} -eq 1 ]   && video_start ci

	setup build
	test build/all
	test build/cppcheck
	test build/clang_tidy
	teardown build

	setup distro
	test distro/debian
	test distro/fedora
	test distro/opensuse
	test distro/ubuntu
	teardown distro

	setup pasta
	test ndp/pasta
	test dhcp/pasta
	test tcp/pasta
	test udp/pasta
	teardown pasta

	setup passt
	test ndp/passt
	test dhcp/passt
	test tcp/passt
	test udp/passt
	test valgrind/passt
	teardown passt

	VALGRIND=1
	setup passt_in_ns
	test ndp/passt
	test dhcp/passt
	test icmp/passt_in_ns
	test tcp/passt_in_ns
	test udp/passt_in_ns
	test valgrind/passt_in_ns
	teardown passt_in_ns

	VALGRIND=0
	setup passt_in_ns
	test ndp/passt
	test dhcp/passt
	test perf/passt_tcp
	test perf/passt_udp
	test perf/pasta_tcp
	test perf/pasta_udp
	teardown passt_in_ns

	setup two_guests
	test two_guests/basic
	teardown two_guests

	perf_finish
	[ ${CI} -eq 1 ] && video_stop

	log "PASS: ${STATUS_PASS}, FAIL: ${STATUS_FAIL}"

	pause_continue \
		"Press any key to keep test session open"	\
		"Closing in "					\
		"Interrupted, press any key to quit"		\
		9

	return 0
}

# demo() - Simpler path for demo purposes
demo() {
	rm -f /tmp/.passt_test_log_pipe
	mkfifo /tmp/.passt_test_log_pipe

	FAST=0

	term_demo

	layout_demo_passt
	video_start demo_passt
	test demo/passt
	video_stop
	teardown demo_passt

	layout_demo_pasta
	video_start demo_pasta
	test demo/pasta
	video_stop
	teardown demo_pasta

	layout_demo_podman
	video_start demo_podman
	test demo/podman
	video_stop
	teardown_demo_podman

	return 0
}

[ "$(basename "${0}")" = "ci" ]       && CI=1
[ "$(basename "${0}")" = "run_demo" ] && DEMO=1

if [ "${1}" = "from_term" ]; then
	cd ..
	if [ ${DEMO} -eq 1 ]; then
		demo
	else
		run
	fi
	tmux kill-session -t passt_test
	exit
else
	rm -rf "${LOGDIR}"
	mkdir -p "${LOGDIR}"
	:> "${LOGFILE}"
	trap "cleanup" EXIT
	run_term
	trap "" EXIT
fi

[ ${DEMO} -eq 1 ] && exit 0

tail -n1 ${LOGFILE}
echo "Log at ${LOGFILE}"
exit $(tail -n1 ${LOGFILE} | sed -n 's/.*FAIL: \(.*\)$/\1/p')

debug log:

solving efec955 ...
found efec955 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).