summaryrefslogtreecommitdiff
path: root/ext/XS-APItest
diff options
context:
space:
mode:
authorLukas Mai <l.mai@web.de>2017-11-09 01:00:23 +0100
committerLukas Mai <l.mai@web.de>2017-11-11 11:16:31 +0100
commitfbc25bdd99b5d54bd9f0cea98247aee2575354d8 (patch)
tree5af54ce03c452b422728ac4b625f61c2dfabbac3 /ext/XS-APItest
parent1e5c5f69249acd964e640650e65901f390085022 (diff)
downloadperl-fbc25bdd99b5d54bd9f0cea98247aee2575354d8.tar.gz
test wrap_keyword_plugin (RT #132413)
Diffstat (limited to 'ext/XS-APItest')
-rw-r--r--ext/XS-APItest/APItest.xs4
-rw-r--r--ext/XS-APItest/t/keyword_plugin_threads.t32
2 files changed, 34 insertions, 2 deletions
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index ffdc56c38e..8bf1545b63 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -1242,6 +1242,7 @@ static int my_keyword_plugin(pTHX_
*op_ptr = parse_join_with_space();
return KEYWORD_PLUGIN_EXPR;
} else {
+ assert(next_keyword_plugin != my_keyword_plugin);
return next_keyword_plugin(aTHX_ keyword_ptr, keyword_len, op_ptr);
}
}
@@ -3893,8 +3894,7 @@ BOOT:
hintkey_DEFSV_sv = newSVpvs_share("XS::APItest/DEFSV");
hintkey_with_vars_sv = newSVpvs_share("XS::APItest/with_vars");
hintkey_join_with_space_sv = newSVpvs_share("XS::APItest/join_with_space");
- next_keyword_plugin = PL_keyword_plugin;
- PL_keyword_plugin = my_keyword_plugin;
+ wrap_keyword_plugin(my_keyword_plugin, &next_keyword_plugin);
}
void
diff --git a/ext/XS-APItest/t/keyword_plugin_threads.t b/ext/XS-APItest/t/keyword_plugin_threads.t
new file mode 100644
index 0000000000..db23ce7d58
--- /dev/null
+++ b/ext/XS-APItest/t/keyword_plugin_threads.t
@@ -0,0 +1,32 @@
+#!perl
+use strict;
+use warnings;
+
+require '../../t/test.pl';
+
+use Config;
+if (!$Config{useithreads}) {
+ skip_all("keyword_plugin thread test requires threads");
+}
+
+plan(1);
+
+fresh_perl_is( <<'----', <<'====', {}, "loading XS::APItest in threads works");
+use strict;
+use warnings;
+
+use threads;
+
+require '../../t/test.pl';
+watchdog(5);
+
+for my $t (1 .. 3) {
+ threads->create(sub {
+ require XS::APItest;
+ })->join;
+}
+
+print "all is well\n";
+----
+all is well
+====