about summary refs log tree commit homepage
path: root/t/mwrap.t
diff options
context:
space:
mode:
Diffstat (limited to 't/mwrap.t')
-rw-r--r--t/mwrap.t15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/mwrap.t b/t/mwrap.t
index ccd739b..783f6e7 100644
--- a/t/mwrap.t
+++ b/t/mwrap.t
@@ -42,6 +42,21 @@ my $dump = "$mwrap_tmp/dump";
         $nr_comma = ($s =~ tr/,/,/);
         $nr_cr = ($s =~ tr/\n/\n/);
         ok($nr_comma > ($nr_cr * 4), 'CSV has more commas than CR');
+
+        $env->{MWRAP} = "dump_path:$dump.%p";
+        mwrap_run('dump_path PID expansion', $env, '-e', $script);
+        my @d = grep(/\.\d+\z/, glob("$dump.*"));
+        is(scalar(@d), 1, 'got PID file') or diag explain([glob("$dump*")]);
+        unlink(@d) or BAIL_OUT "unlink: $!";
+
+        # don't allow injecting random formats
+        for my $fmt ('%p.%m', '%m.%p') {
+                my $fn = $dump.$fmt;
+                $env->{MWRAP} = "dump_path:$fn";
+                mwrap_run("PID expansion fails on $fmt", $env, '-e', $script);
+                ok($fn, "$fmt used as-is");
+                unlink($fn) or BAIL_OUT "unlink: $!";
+        }
 }
 
 SKIP: { # C++ program which uses malloc via "new"