]>
git.proxmox.com Git - pve-container.git/blob - src/test/run_setup_tests.pl
fc92dbb10e1ef80d5ec6fee88a3bf2a3dcd2d717
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/ifcfg-eth1
57 /etc/sysconfig/network-scripts/route-eth1
58 /etc/sysconfig/network-scripts/ifcfg-eth2
59 /etc/sysconfig/network-scripts/route-eth2
60 /etc/sysconfig/network-scripts/ifcfg-eth3
61 /etc/sysconfig/network-scripts/route-eth3
62 /etc/sysconfig/network/ifcfg-eth0
63 /etc/sysconfig/network/ifroute-eth0
64 /etc/sysconfig/network/ifcfg-eth1
65 /etc/sysconfig/network/ifroute-eth1
66 /etc/sysconfig/network/ifcfg-eth2
67 /etc/sysconfig/network/ifroute-eth2
68 /etc/sysconfig/network/ifcfg-eth3
69 /etc/sysconfig/network/ifroute-eth3
70 /etc/init/start-ttys.conf
72 /etc/init/power-status-changed.conf
77 /root/.ssh/authorized_keys
80 /roothome/.ssh/authorized_keys);
81 foreach my $fn (@testfiles) {
82 next if !-f
"$testdir/$fn.exp";
83 test_file
("$testdir/$fn.exp", "$rootfs/$fn");
87 print "TEST $testdir => OK\n";
92 foreach my $testdir (@ARGV) {
98 foreach my $testdir (<test-
*>) {#
99 next if ! -d
$testdir;