Skip to content

Commit

Permalink
LTP: Merge ltp_setup_networking.pm into install_ltp.pm
Browse files Browse the repository at this point in the history
The reason is that we want to get rid of extra image for LTP network
tests. Network related things aren't that important to justify having
it's own image.

Implements poo#32398
  • Loading branch information
pevik committed Jun 11, 2018
1 parent 0e02e72 commit b3ee11e
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 130 deletions.
1 change: 0 additions & 1 deletion lib/main_common.pm
Expand Up @@ -216,7 +216,6 @@ sub packagekit_available {

sub is_kernel_test {
return ( get_var('INSTALL_LTP')
|| get_var('LTP_SETUP_NETWORKING')
|| get_var('LTP_COMMAND_FILE')
|| get_var('QA_TEST_KLP_REPO')
|| get_var('INSTALL_KOTD')
Expand Down
5 changes: 0 additions & 5 deletions lib/main_ltp.pm
Expand Up @@ -124,11 +124,6 @@ sub load_kernel_tests {
#loadtest 'boot_ltp';
shutdown_ltp();
}
elsif (get_var('LTP_SETUP_NETWORKING')) {
loadtest 'boot_ltp';
loadtest 'ltp_setup_networking';
shutdown_ltp();
}
elsif (get_var('LTP_COMMAND_FILE')) {
if (get_var('INSTALL_KOTD')) {
loadtest 'install_kotd';
Expand Down
12 changes: 0 additions & 12 deletions products/opensuse/templates.d/ltp
Expand Up @@ -46,18 +46,6 @@
{key => 'LTP_TIMEOUT', value => 1200},
{key => 'START_AFTER_TEST', value => 'install_ltp'}]
},
{
name => 'setup_ltp_networking',
settings =>
[{key => 'DESKTOP', value => 'textmode'},
{key => 'PUBLISH_HDD_1',
value => 'openSUSE-%VERSION%-%ARCH%-textmode_with_ltp_networking_installed.qcow2'},
{key => 'LTP_SETUP_NETWORKING', value => 1},
{key => 'BOOT_HDD_IMAGE', value => 1},
{key => 'HDD_1',
value => 'openSUSE-%VERSION%-%ARCH%-textmode_with_ltp_installed.qcow2'},
{key => 'START_AFTER_TEST', value => 'install_ltp'}]
},
{
name => 'ltp_net_ipv6',
settings =>
Expand Down
74 changes: 74 additions & 0 deletions tests/kernel/install_ltp.pm
Expand Up @@ -80,6 +80,36 @@ sub install_runtime_dependencies {
}
}

sub install_runtime_dependencies_network {
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 install_build_dependencies {
my @deps = qw(
autoconf
Expand Down Expand Up @@ -166,6 +196,47 @@ sub install_from_repo {
assert_script_run q(find ${LTPROOT:-/opt/ltp}/testcases/bin/openposix/conformance/interfaces/ -name '*.run-test' > ~/openposix-test-list-) . $tag;
}

sub setup_network {
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; }");
}
}

sub run {
my $self = shift;
my $inst_ltp = get_var 'INSTALL_LTP';
Expand All @@ -187,6 +258,7 @@ sub run {
add_we_repo_if_available;
add_custom_grub_entries;
install_runtime_dependencies;
install_runtime_dependencies_network;

if ($inst_ltp =~ /git/i) {
install_build_dependencies;
Expand All @@ -204,6 +276,8 @@ sub run {
assert_script_run("uname -v | grep '/kGraft-'");
}

setup_network();

upload_runtest_files('${LTPROOT:-/opt/ltp}/runtest', $tag);

select_console('root-console');
Expand Down
110 changes: 0 additions & 110 deletions tests/kernel/ltp_setup_networking.pm

This file was deleted.

3 changes: 2 additions & 1 deletion tests/kernel/run_ltp.pm
Expand Up @@ -262,7 +262,8 @@ sub run {
my $cmd_text = qq($test->{command}; echo "$fin_msg\$?");
my $klog_stamp = "echo 'OpenQA::run_ltp.pm: Starting $test->{name}' > /dev/$serialdev";
my $start_time = thetime();
my $set_rhost = $test->{command} =~ m/^finger01|ftp01|rcp01|rdist01|rlogin01|rpc01|rpcinfo01|rsh01|telnet01/;
# See poo#16648 for disabled LTP networking related tests.
my $set_rhost = $test->{command} =~ m/^finger01|ftp01|rcp01|rdist01|rlogin01|rpc01|rpcinfo01|rsh01|telnet01/;

if ($set_rhost) {
assert_script_run(q(export RHOST='127.0.0.1'));
Expand Down
1 change: 0 additions & 1 deletion variables
Expand Up @@ -46,7 +46,6 @@ KVM
LAPTOP
LIVECD
LIVETEST
LTP_SETUP_NETWORKING
LVM
MACHINE
MEDIACHECK
Expand Down

0 comments on commit b3ee11e

Please sign in to comment.