+# prepare
+system("rm -rf $udev_root");
+mkdir($udev_root) || die "unable to create udev_root: $udev_root\n";
+
+# create initial config file
+open CONF, ">$main_conf" || die "unable to create config file: $main_conf";
+print CONF "udev_root=\"$udev_root\"\n";
+print CONF "udev_db=\"$udev_db\"\n";
+print CONF "udev_rules=\"$conf_tmp\"\n";
+print CONF "udev_permissions=\"$perm\"\n";
+close CONF;
+
+my $test_num = 1;
+
+if ($ARGV[0]) {
+ # only run one test
+ $test_num = $ARGV[0];
+ print "udev-test will run test number $test_num only\n";
+
+ run_test($tests[$test_num], $test_num);
+} else {
+ # test all
+ print "\nudev-test will run ".($#tests + 1)." tests:\n\n";
+
+ foreach my $config (@tests) {
+ run_test($config, $test_num);
+ $test_num++;
+
+ }
+}
+