Skip to content

Commit 495b1b2

Browse files
committed
Refactor distro tests
1 parent 2da8145 commit 495b1b2

File tree

6 files changed

+44
-20
lines changed

6 files changed

+44
-20
lines changed

release-process/distro-configs/ubuntu18-lts.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
"ami_name_pattern": "ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-*",
55
"user": "ubuntu",
66
"setup_commands": [
7+
"cloud-init status --wait",
78
"sudo apt-get update -y",
89
"sudo apt-get dist-upgrade -f -y"
910
],
1011
"install_build_deps": "sudo apt-get install -y rpm ccache cmake g++-multilib pkg-config zlib1g-dev git python-dev libacl1-dev ninja-build manpages-dev capnproto libcapnp-dev gdb python3-pexpect",
11-
"install_test_deps": "sudo apt-get install -y tightvncserver xtightvncviewer curl libdbus-glib-1-2 libreoffice",
12+
"install_test_deps": "sudo apt-get install -y tightvncserver xtightvncviewer curl tar bzip2 libdbus-glib-1-2 libreoffice",
1213
"exclude_tests": ["x86/pkeys.*"]
1314
}

release-process/distro-configs/ubuntu20-lts.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
"ami_name_pattern": "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-*",
55
"user": "ubuntu",
66
"setup_commands": [
7+
"cloud-init status --wait",
78
"sudo apt-get update -y",
89
"sudo apt-get dist-upgrade -f -y"
910
],
1011
"install_build_deps": "sudo apt-get install -y rpm ccache cmake g++-multilib pkg-config zlib1g-dev git python-dev libacl1-dev ninja-build manpages-dev capnproto libcapnp-dev gdb python3-pexpect",
11-
"install_test_deps": "sudo apt-get install -y tightvncserver xtightvncviewer curl libdbus-glib-1-2 libreoffice",
12+
"install_test_deps": "sudo apt-get install -y tightvncserver xtightvncviewer curl tar bzip2 libdbus-glib-1-2 libreoffice",
1213
"exclude_tests": ["x86/pkeys.*"]
1314
}

release-process/distro-configs/ubuntu22-lts.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
"ami_name_pattern": "ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-*",
55
"user": "ubuntu",
66
"setup_commands": [
7+
"cloud-init status --wait",
78
"sudo apt-get update -y",
89
"sudo apt-get dist-upgrade -f -y"
910
],
1011
"install_build_deps": "sudo apt-get install -y rpm ccache cmake g++-multilib pkg-config zlib1g-dev git python-dev-is-python3 libacl1-dev ninja-build manpages-dev capnproto libcapnp-dev gdb python3-pexpect",
11-
"install_test_deps": "sudo apt-get install -y tightvncserver xtightvncviewer curl libdbus-glib-1-2 libreoffice"
12+
"install_test_deps": "sudo apt-get install -y tightvncserver xtightvncviewer curl tar bzip2 libdbus-glib-1-2 libreoffice"
1213
}

release-process/distro-configs/ubuntu23.04.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
"ami_name_pattern": "ubuntu/images/hvm-ssd/ubuntu-lunar-23.04-*",
55
"user": "ubuntu",
66
"setup_commands": [
7+
"cloud-init status --wait",
78
"sudo apt-get update -y",
89
"sudo apt-get dist-upgrade -f -y"
910
],
1011
"install_build_deps": "sudo apt-get install -y rpm ccache cmake g++-multilib pkg-config zlib1g-dev git python-dev-is-python3 libacl1-dev ninja-build manpages-dev capnproto libcapnp-dev gdb python3-pexpect",
11-
"install_test_deps": "sudo apt-get install -y tightvncserver xtightvncviewer curl libdbus-glib-1-2 libreoffice"
12+
"install_test_deps": "sudo apt-get install -y tightvncserver xtightvncviewer curl tar bzip2 libdbus-glib-1-2 libreoffice"
1213
}

release-process/rr-testing.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
# Bash script to build rr and run tests.
22
#
3-
# Requires variables to be set:
3+
# Requires variables and functions to be set. See test-system.py.
44
# $git_revision : git revision to check out, build and test
55
# $build_dist : 1 if we should build dist packages, 0 otherwise
6+
# $test_firefox : 1 to run firefox tests, 0 to skip
7+
# $ctest_options : options to pass to ctest, e.g to exclude certain tests
8+
# setup_commands : function to setup environment, e.g. 'apt update'
9+
# install_build_deps : function to install dependencies required to build rr
10+
# install_test_deps : function to install dependencies required by tests
11+
12+
set -x # echo commands
13+
set -e # default to exiting on error"
614

715
uname -a
816

17+
setup_commands
18+
install_build_deps
19+
20+
install_test_deps & # job %1
21+
922
# Free up space before we (re)start
1023

1124
rm -rf ~/rr || true
@@ -21,7 +34,7 @@ ninja
2134

2235
# Test deps are installed in parallel with our build.
2336
# Make sure that install has finished before running tests
24-
wait_for_test_deps
37+
wait %1
2538

2639
# Enable perf events for rr
2740
echo 0 | sudo tee /proc/sys/kernel/perf_event_paranoid
@@ -69,7 +82,7 @@ function xvnc-runner { CMD=$1 EXPECT=$2
6982
echo PASSED: $CMD
7083
}
7184

72-
if [[ $TEST_FIREFOX == 1 ]]; then
85+
if [[ $test_firefox == 1 ]]; then
7386
rm -rf /tmp/firefox /tmp/firefox-profile || true
7487
mkdir /tmp/firefox-profile
7588
( cd /tmp; curl -L 'https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US' | tar -jxf - )

release-process/test-system.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,25 +126,32 @@ def terminate(self):
126126
with pathlib.Path(__file__).with_name('rr-testing.sh').open('rb') as f:
127127
rr_testing_script = f.read()
128128

129+
def config_script_function(config_key):
130+
lines = []
131+
entry = distro_config.get(config_key)
132+
if isinstance(entry, str):
133+
lines = [entry]
134+
elif isinstance(entry, list):
135+
lines = entry
136+
elif entry is not None:
137+
raise ValueError('Invalid config entry %s: %s' % (config_key, entry))
138+
return ('function %s {\n%s\n}' % (config_key, '\n'.join(lines)))
139+
129140
vm = Ec2Vm(args.machine_type, args.architecture, distro_config, args.keypair_pem_file)
130141
success = False
131142
try:
132143
vm.wait_for_ssh()
133144
exclude_tests = distro_config['exclude_tests'] if 'exclude_tests' in distro_config else []
134-
full_script = b'\n'.join(
135-
[b"set -x # echo commands",
136-
b"set -e # default to exiting on error"] +
137-
list(map(lambda c: c.encode('utf-8'), distro_config['setup_commands'])) +
145+
full_script = '\n'.join(
138146
[
139-
distro_config['install_build_deps'].encode('utf-8'),
140-
b'%s &'%(distro_config['install_test_deps'].encode('utf-8')),
141-
b'function wait_for_test_deps {\nwait %1\n}',
142-
b'git_revision=%s'%args.git_revision.encode('utf-8'),
143-
b'build_dist=%d'%(1 if args.dist_files_dir is not None else 0),
144-
b'TEST_FIREFOX=%d'%(1 if args.architecture == 'x86_64' else 0),
145-
b'ctest_options="%s"'%b' '.join(map(lambda r: b'-E %s'%r.encode('utf-8'), exclude_tests)),
146-
rr_testing_script
147-
])
147+
config_script_function('setup_commands'),
148+
config_script_function('install_build_deps'),
149+
config_script_function('install_test_deps'),
150+
'git_revision=%s'%args.git_revision,
151+
'build_dist=%d'%(1 if args.dist_files_dir is not None else 0),
152+
'test_firefox=%d'%(1 if args.architecture == 'x86_64' else 0),
153+
'ctest_options="%s"'%' '.join('-E %s'%r for r in exclude_tests),
154+
]).encode('utf-8') + b'\n' + rr_testing_script
148155
vm.ssh(['/bin/bash', '-s'], full_script)
149156
if args.dist_files_dir is not None:
150157
vm.scp_from(['-r'], '/tmp/dist', args.dist_files_dir)

0 commit comments

Comments
 (0)