summaryrefslogtreecommitdiff
path: root/debian/tests/embed
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2019-11-26 14:11:14 +0300
committerIgor Pashev <pashev.igor@gmail.com>2019-11-26 14:11:14 +0300
commitcf9383412494964d6188fcf08a362c0c0f313afc (patch)
treebd9e6a5b3a63cbb155b81112c855c19cb5f2b314 /debian/tests/embed
downloadperl-cf9383412494964d6188fcf08a362c0c0f313afc.tar.gz
Import perl (5.30.0-9)debian/5.30.0-9debian
Diffstat (limited to 'debian/tests/embed')
-rwxr-xr-xdebian/tests/embed31
1 files changed, 31 insertions, 0 deletions
diff --git a/debian/tests/embed b/debian/tests/embed
new file mode 100755
index 0000000..c58621e
--- /dev/null
+++ b/debian/tests/embed
@@ -0,0 +1,31 @@
+#!/bin/sh
+set -e
+set -x
+
+# from perlembed(1)
+cat > perlembed.c <<EOF
+#include <EXTERN.h> /* from the Perl distribution */
+#include <perl.h> /* from the Perl distribution */
+
+static PerlInterpreter *my_perl; /*** The Perl interpreter ***/
+
+int main(int argc, char **argv, char **env)
+{
+ PERL_SYS_INIT3(&argc,&argv,&env);
+ my_perl = perl_alloc();
+ perl_construct(my_perl);
+ PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
+ perl_parse(my_perl, NULL, argc, argv, (char **)NULL);
+ perl_run(my_perl);
+ perl_destruct(my_perl);
+ perl_free(my_perl);
+ PERL_SYS_TERM();
+}
+EOF
+CC=$(perl -MConfig -E 'say $Config{cc}')
+CCOPTS=$(perl -MExtUtils::Embed -e ccopts)
+LDOPTS=$(perl -MExtUtils::Embed -e ldopts)
+
+$CC $CCOPTS perlembed.c -o perlembed.bin $LDOPTS -lperl
+./perlembed.bin -E 'say "OK"' | grep -q -x OK
+