]>
git.proxmox.com Git - pve-container.git/blob - src/test/run_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 does 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
::parse_lxc_config
("/lxc/100/config", $raw);
36 $conf->{'pve.test_mode'} = 1;
38 my $lxc_setup = PVE
::LXCSetup-
>new($conf, $rootfs);
40 for (my $i = 0; $i < 2; $i++) {
41 # run tests twice, to make sure scripts are idempotent
43 $lxc_setup->post_create_hook('$TEST$ABCDEF');
45 my @testfiles = qw(/etc/hostname /etc/hosts /etc/inittab /etc/network/interfaces /etc/resolv.conf /etc/passwd /etc/shadow);
46 foreach my $fn (@testfiles) {
47 next if !-f
"$testdir/$fn.exp";
48 test_file
("$testdir/$fn.exp", "$rootfs/$fn");
52 print "TEST $testdir => OK\n";
57 foreach my $testdir (@ARGV) {
63 foreach my $testdir (<test-
*>) {#
64 next if ! -d
$testdir;