/
ltp_setup_networking.pm
110 lines (90 loc) · 2.49 KB
/
ltp_setup_networking.pm
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
# SUSE's openQA tests
#
# Copyright © 2016-2018 SUSE LLC
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
#
# Summary: This module installs and setup services and other things needed for
# networking part of the LTP (Linux Test Project).
# Maintainer: Petr Vorel <pvorel@suse.cz>
use 5.018;
use warnings;
use base 'opensusebasetest';
use testapi;
use utils;
use serial_terminal 'select_virtio_console';
sub install {
my @deps;
# utils
@deps = qw(
ethtool
iptables
psmisc
tcpdump
);
zypper_call('-t in ' . join(' ', @deps), dumb_term => 1);
# clients
@deps = qw(
dhcp-client
telnet
);
zypper_call('-t in ' . join(' ', @deps), dumb_term => 1);
# services
@deps = qw(
dhcp-server
dnsmasq
nfs-kernel-server
rpcbind
rsync
vsftpd
);
zypper_call('-t in ' . join(' ', @deps), dumb_term => 1);
}
sub setup {
my $content;
$content = <<EOF;
# ltp specific setup
pts/1
pts/2
pts/3
pts/4
pts/5
pts/6
pts/7
pts/8
pts/9
EOF
assert_script_run("echo \"$content\" >> '/etc/securetty'");
# ftp
assert_script_run('sed -i \'s/^\s*\(root\)\s*$/# \1/\' /etc/ftpusers');
# getaddrinfo_01: missing hostname in /etc/hosts
assert_script_run('h=`hostname`; grep -q $h /etc/hosts || printf "# ltp\n127.0.0.1\t$h\n::1\t$h\n" >> /etc/hosts');
# boo#1017616: missing link to ping6 in iputils >= s20150815
assert_script_run('which ping6 >/dev/null 2>&1 || ln -s `which ping` /usr/local/bin/ping6');
# dhcpd
assert_script_run('touch /var/lib/dhcp/db/dhcpd.leases /var/lib/dhcp6/db/dhcpd6.leases');
# echo/echoes, getaddrinfo_01
assert_script_run('sed -i \'s/^\(hosts:\s+files\s\+dns$\)/\1 myhostname/\' /etc/nsswitch.conf');
# SLE12GA uses too many old style services
my $action = check_var('VERSION', '12') ? "enable" : "reenable";
foreach my $service (qw(dnsmasq nfsserver rpcbind vsftpd)) {
systemctl($action . " " . $service);
assert_script_run("systemctl start $service || { systemctl status --no-pager $service; journalctl -xe --no-pager; false; }");
}
}
# poo#14402
sub run {
select_virtio_console();
install();
setup();
}
sub test_flags {
return {fatal => 1};
}
1;
=head1 Discussion
See poo#16648 for disabled LTP networking related tests.
=cut