-
Notifications
You must be signed in to change notification settings - Fork 561
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix and test execution of non-empty .bs files
During the build of XS modules, an empty Foo.bs file is normally created for each Foo.so file. If a Foo_BS file is present, instead this triggers the auto-generatation of a .bs file which may have executable perl content. However, nothing in core currently generates a non-empty .bs file. So add a test that this mechanism works, and fix up the three dynamic lib loaders which implement the 'do $bs if -s $bs' mechanism to not rely on the process having '.' present in @inc. As it happens this already works currently, because the name of the .bs file to load will usually be something like ../../lib/auto/Foo/Foo.bs and the presence of the leading '..' causes 'do' to load the file directly rather than via @inc. But locally fix up @inc anyway, in case '../' isn't always the case.
- Loading branch information
Showing
6 changed files
with
31 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# | ||
# test that non-empty .bs files get executed | ||
|
||
$bscode = <<'EOF'; | ||
$::bs_file_got_executed = 1; | ||
EOF | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!perl -w | ||
# | ||
# check that .bs files are loaded and executed. | ||
# During build of XS::APItest, the presence of APItest_BS should | ||
# cause a non-empty APItest.bs file to auto-generated. When loading | ||
# APItest.so, the .bs should be automatically executed, which should | ||
# set $::bs_file_got_executed. | ||
|
||
use strict; | ||
|
||
use Test::More; | ||
use XS::APItest; | ||
|
||
is $::bs_file_got_executed, 1, "BS file was executed"; | ||
|
||
done_testing(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters