5 require "#{Dir.pwd}/features/support/helpers/misc_helpers.rb"
7 TRUE_VALUES = ['1', 'y', 'yes', 'true'].freeze
15 if value.is_a?(TrueClass) || value.is_a?(FalseClass)
19 # It's not a boolean so we assume it's a string
20 TRUE_VALUES.include?(value.downcase)
23 # These files deal with options like some of the settings passed
24 # to the `run_test_suite` script, and "secrets" like credentials
25 # (passwords, SSH keys) to be used in tests.
26 CONFIG_DIR = "#{Dir.pwd}/features/config".freeze
27 DEFAULTS_CONFIG_FILE = "#{CONFIG_DIR}/defaults.yml".freeze
28 LOCAL_CONFIG_FILE = "#{CONFIG_DIR}/local.yml".freeze
29 LOCAL_CONFIG_DIRS_FILES_GLOB = "#{CONFIG_DIR}/*.d/*.yml".freeze
31 assert File.exist?(DEFAULTS_CONFIG_FILE)
32 $config = YAML.safe_load(File.read(DEFAULTS_CONFIG_FILE))
33 config_files = Dir.glob(LOCAL_CONFIG_DIRS_FILES_GLOB).sort
34 config_files << LOCAL_CONFIG_FILE if File.exist?(LOCAL_CONFIG_FILE)
35 config_files.each do |config_file|
36 yaml_struct = YAML.safe_load(File.read(config_file)) || {}
37 unless yaml_struct.instance_of?(Hash)
38 raise "Local configuration file '#{config_file}' is malformed"
41 $config.merge!(yaml_struct)
43 # Options passed to the `run_test_suite` script will always take
44 # precedence. The way we import these keys is only safe for values
45 # with types boolean or string. If we need more, we'll have to invoke
46 # YAML's type autodetection on ENV some how.
49 # Export TMPDIR back to the environment for subprocesses that we start
50 # (e.g. guestfs). Note that this export will only make a difference if
51 # TMPDIR wasn't already set and --tmpdir wasn't passed, i.e. only when
53 ENV['TMPDIR'] = $config['TMPDIR']
55 # Dynamic constants initialized through the environment or similar,
56 # e.g. options we do not want to be configurable through the YAML
57 # configuration files.
58 DEBUG_LOG_PSEUDO_FIFO = "#{$config['TMPDIR']}/debug_log_pseudo_fifo".freeze
59 DISPLAY = ENV['DISPLAY']
61 KEEP_CHUTNEY = !ENV['KEEP_CHUTNEY'].nil?
62 KEEP_SNAPSHOTS = !ENV['KEEP_SNAPSHOTS'].nil?
63 DISABLE_CHUTNEY = !ENV['DISABLE_CHUTNEY'].nil?
64 LATE_PATCH = ENV['LATE_PATCH']
65 EARLY_PATCH = !ENV['EARLY_PATCH'].nil?
66 EXTRA_BOOT_OPTIONS = ENV['EXTRA_BOOT_OPTIONS']
67 LIVE_USER = cmd_helper(
68 '. config/chroot_local-includes/etc/live/config.d/username.conf; ' \
69 'echo ${LIVE_USERNAME}'
71 TAILS_ISO = ENV['TAILS_ISO']
72 TAILS_IMG = TAILS_ISO.sub(/\.iso/, '.img')
73 TAILS_BUILD_MANIFEST = TAILS_ISO.sub(/\.iso/, '.build-manifest')
74 OLD_TAILS_ISO = ENV['OLD_TAILS_ISO'] || TAILS_ISO
75 OLD_TAILS_IMG = OLD_TAILS_ISO.sub(/\.iso/, '.img')
76 TIME_AT_START = Time.now
77 # rubocop:disable Lint/ConstantDefinitionInBlock
78 # rubocop:disable Style/StringConcatenation
80 ARTIFACTS_DIR = $config['TMPDIR'] + '/run-' +
81 sanitize_filename(TIME_AT_START.to_s) + '-' +
84 sanitize_filename(describe_git_head,
87 ].reject(&:empty?).join('_') + '-' +
88 random_alnum_string(6)
89 unless File.exist?(ARTIFACTS_DIR)
90 FileUtils.mkdir_p(ARTIFACTS_DIR)
94 # rubocop:enable Lint/ConstantDefinitionInBlock
95 # rubocop:enable Style/StringConcatenation
96 OPENCV_IMAGE_PATH = "#{Dir.pwd}/features/images/".freeze
97 OPENCV_MIN_SIMILARITY = 0.9
99 # Constants that are statically initialized.
100 LIBVIRT_DOMAIN_NAME = 'TailsToaster'.freeze
101 LIBVIRT_DOMAIN_UUID = '203552d5-819c-41f3-800e-2c8ef2545404'.freeze
102 LIBVIRT_NETWORK_NAME = 'TailsToasterNet'.freeze
103 LIBVIRT_NETWORK_UUID = 'f2305af3-2a64-4f16-afe6-b9dbf02a597e'.freeze
104 VIRTIO_JOURNAL_DUMPER = 'org.tails.journal_dumper.0'.freeze
105 VIRTIO_REMOTE_SHELL = 'org.tails.remote_shell.0'.freeze
106 MISC_FILES_DIR = "#{Dir.pwd}/features/misc_files".freeze
107 SERVICES_EXPECTED_ON_ALL_IFACES =
109 ['cups-browsed', IPAddr.new('0.0.0.0'), 631],
110 ['onion-grater', IPAddr.new('0.0.0.0'), 951],
111 ['tor', IPAddr.new('10.200.1.1'), 9050],
113 SERVICES_ALLOWED_FOR_LIVE_USER =
115 [IPAddr.new('0.0.0.0'), 631],
116 [IPAddr.new('0.0.0.0'), 951],
117 [IPAddr.new('10.200.1.1'), 9050],
118 [IPAddr.new('127.0.0.1'), 5353],
119 [IPAddr.new('127.0.0.1'), 631],
120 [IPAddr.new('127.0.0.1'), 9062],
121 [IPAddr.new('127.0.0.1'), 9040],
122 [IPAddr.new('127.0.0.1'), 9050],
125 SOME_DNS_SERVER = '208.67.222.222'.freeze
126 RTL_LANGUAGES = ['Arabic', 'Persian'].freeze
127 VM_XML_PATH = "#{Dir.pwd}/features/domains".freeze
128 LAN_WEB_SERVER_HELLO_MSG = 'Welcome to the LAN web server!'.freeze
130 TAILS_SIGNING_KEY = cmd_helper(
131 ". #{Dir.pwd}/config/variables; echo ${TAILS_SIGNING_KEY_FP}"
133 WEBM_VIDEO_URL = 'https://tails.net/lib/test_suite/test.webm'.freeze
135 # EFI System Partition
136 ESP_GUID = 'c12a7328-f81f-11d2-ba4b-00a0c93ec93b'.freeze
138 # Fedora connectivity check server, used by tails-get-network-time
139 CONNECTIVITY_CHECK_HOSTNAME = 'fedoraproject.org'.freeze
140 CONNECTIVITY_CHECK_HOSTS = Resolv.getaddresses(CONNECTIVITY_CHECK_HOSTNAME)
141 CONNECTIVITY_CHECK_ALLOWED_NODES = (CONNECTIVITY_CHECK_HOSTS.map do |ip|
142 { address: ip, port: 80 }
145 LAN_WEB_SERVER_DATA_DIR = "#{$config['TMPDIR']}/lan-web-server".freeze
147 # Journal entries of priority "err" or higher that we expect to see
148 # in the system journal.
149 # rubocop:disable Layout/LineLength
150 EXPECTED_JOURNAL_ENTRIES = [
151 # libpam-gnome-keyring is not installed in Tails
153 'SYSLOG_IDENTIFIER' => 'gdm-password]',
154 'MESSAGE' => /PAM unable to dlopen\(pam_gnome_keyring.so\):.*No such file or directory/,
157 'SYSLOG_IDENTIFIER' => 'gdm-password]',
158 'MESSAGE' => 'PAM adding faulty module: pam_gnome_keyring.so',
160 # gdm-session-worker <= 44.0 tries to unref a NULL object
161 # https://gitlab.gnome.org/GNOME/gdm/-/issues/730
163 'SYSLOG_IDENTIFIER' => 'gdm-launch-environment]',
164 'MESSAGE' => "GLib-GObject: g_object_unref: assertion 'G_IS_OBJECT (object)' failed",
166 # gnome-session tries to put autostart apps into a systemd scope after
167 # it started them, which fails if the process already exited.
168 # https://gitlab.gnome.org/GNOME/gnome-session/-/issues/120
170 'SYSLOG_IDENTIFIER' => 'systemd',
171 'MESSAGE' => /Failed to start app-gnome-.*.scope - Application launched by gnome-session-binary/,
173 # The tails-autotest-remote-shell sometimes fails with an I/O error.
174 # It's automatically restarted by systemd, so this is not a big deal.
176 'SYSLOG_IDENTIFIER' => 'systemd',
177 'MESSAGE' => /Failed to start tails-autotest-remote-shell.service.*/,
179 # USBGuard prints this message when it receives an ENOBUFS error when
180 # trying to read a pending uevent. This happens sometimes during boot
181 # and is not a problem, USBGuard continues to function normally.
182 # https://github.com/USBGuard/usbguard/issues/349
184 'SYSLOG_IDENTIFIER' => 'usbguard-daemon',
185 'MESSAGE' => /ueventProcessRead: failed to read pending uevent.*/,
187 # https://github.com/alsa-project/alsa-lib/issues/90
189 'SYSLOG_IDENTIFIER' => 'pulseaudio',
190 'MESSAGE' => /ALSA woke us up to (?:read|write) new data (?:to|from) the device, but there was actually nothing to (?:read|write)\./,
193 'SYSLOG_IDENTIFIER' => 'pulseaudio',
194 'MESSAGE' => /Most likely this is a bug in the ALSA driver.*./,
197 'SYSLOG_IDENTIFIER' => 'pulseaudio',
198 'MESSAGE' => /We were woken up with (?:POLLIN|POLLOUT) set -- however a subsequent snd_pcm_avail\(\) returned 0 or another value < min_avail\./,
200 # The spice client connection is sometimes lost, not clear why.
202 'SYSLOG_IDENTIFIER' => 'spice-vdagentd',
203 'MESSAGE' => 'AIIEEE lost spice client connection, reconnecting (err: )',
206 # rubocop:enable Layout/LineLength