]>
git.proxmox.com Git - pve-container.git/blob - src/test/run_setup_tests.pl
5 use PVE
::Tools
qw(run_command);
13 my ($exp_fn, $real_fn) = @_;
15 return if system("diff -u '$exp_fn' '$real_fn'") == 0;
17 die "files do not match\n";
23 print "prepare $testdir\n";
25 my $rootfs = "./tmprootfs";
27 run_command
("rm -rf $rootfs");
28 run_command
("cp -a $testdir $rootfs");
30 my $config_fn = "$testdir/config";
32 my $raw = PVE
::Tools
::file_get_contents
($config_fn);
34 my $conf = PVE
::LXC
::Config
::parse_pct_config
("/lxc/100.conf", $raw);
36 $conf->{'testmode'} = 1;
38 my $lxc_setup = PVE
::LXC
::Setup-
>new($conf, $rootfs);
40 for (my $i = 0; $i < 2; $i++) {
41 # run tests twice, to make sure scripts are idempotent
44 $lxc_setup->post_create_hook('$TEST$ABCDEF','ssh-rsa ABCDEFG ABC@DEF');
46 my @testfiles = qw(/etc/hostname
49 /etc/network/interfaces
53 /etc/sysconfig/network
54 /etc/sysconfig/network-scripts/ifcfg-eth0
55 /etc/sysconfig/network-scripts/route-eth0
56 /etc/sysconfig/network-scripts/route6-eth0
57 /etc/sysconfig/network-scripts/ifcfg-eth1
58 /etc/sysconfig/network-scripts/route-eth1
59 /etc/sysconfig/network-scripts/route6-eth1
60 /etc/sysconfig/network-scripts/ifcfg-eth2
61 /etc/sysconfig/network-scripts/route-eth2
62 /etc/sysconfig/network-scripts/route6-eth2
63 /etc/sysconfig/network-scripts/ifcfg-eth3
64 /etc/sysconfig/network-scripts/route-eth3
65 /etc/sysconfig/network-scripts/route6-eth3
66 /etc/sysconfig/network/ifcfg-eth0
67 /etc/sysconfig/network/ifroute-eth0
68 /etc/sysconfig/network/ifcfg-eth1
69 /etc/sysconfig/network/ifroute-eth1
70 /etc/sysconfig/network/ifcfg-eth2
71 /etc/sysconfig/network/ifroute-eth2
72 /etc/sysconfig/network/ifcfg-eth3
73 /etc/sysconfig/network/ifroute-eth3
74 /etc/init/start-ttys.conf
76 /etc/init/power-status-changed.conf
81 /root/.ssh/authorized_keys
84 /roothome/.ssh/authorized_keys);
85 foreach my $fn (@testfiles) {
86 next if !-f
"$testdir/$fn.exp";
87 test_file
("$testdir/$fn.exp", "$rootfs/$fn");
91 print "TEST $testdir => OK\n";
96 foreach my $testdir (@ARGV) {
102 foreach my $testdir (<test-
*>) {#
103 next if ! -d
$testdir;