]>
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 my $rootfs = "./tmprootfs";
25 run_command
("rm -rf $rootfs");
26 run_command
("cp -a $testdir $rootfs");
28 my $config_fn = "$testdir/config";
30 my $raw = PVE
::Tools
::file_get_contents
($config_fn);
32 my $conf = PVE
::LXC
::parse_lxc_config
("/lxc/100/config", $raw);
34 $conf->{'lxc.rootfs'} = $rootfs;
36 my $lxc_setup = PVE
::LXCSetup-
>new($conf);
38 for (my $i = 0; $i < 2; $i++) {
39 # run tests twice, to make sure scripts are idempotent
41 $lxc_setup->post_create();
43 my @testfiles = qw(/etc/hostname /etc/hosts /etc/network/interfaces);
44 foreach my $fn (@testfiles) {
45 next if !-f
"$testdir/$fn.exp";
46 test_file
("$testdir/$fn.exp", "$rootfs/$fn");
50 print "TEST $testdir => OK\n";
53 PVE
::Tools
::dir_glob_foreach
('.', 'test\d+', sub {