9

One of my CPAN modules is not available on ActivePerl through its ppm utility. Apparently my unit testing for this module is too thorough and ActiveState's build process times out when it attempts to build it.

So what I would like to do in my tests is to detect when my module is being built on ActivePerl, and if so, to provide the build process with a smaller and faster set of tests.

One way I've found to do this is:

($is_activestate) = grep /provided by ActiveState/, qx($^X -v)

but I'm wondering if there is a more lightweight option. An environment variable that is always (and only) set in ActivePerl? Something in Config? Any other suggestions?

UPDATE: Looks like $ENV{ACTIVESTATE_PPM_BUILD} is set during these builds.

4

2 回答 2

7

检查它是否在 ActivePerl 构建下运行并不是最佳选择。理想情况下,您想检查它是否在 ActiveState 的构建环境中运行。我会转储环境,t/00-use.t看看他们是否设置了一些变量来表明这一点。

info("$_=$ENV{$_}") for sort keys %ENV;

您也可以联系 ActiveState 并询问他们的建议。


或者,您可以使最慢的测试仅按需运行(例如,当存在特定环境时)。5 分钟的测试对其他人来说似乎也有点过分。


至于检查您是否正在运行 ActiveState 构建,这里有一些可能性:

  • use Config; print Config::local_patches();返回一个包含ActivePerl Build.
  • $Config{cf_email}被设定为support@ActiveState.com
  • ActivePerl::Config 模块存在。
  • ActivePerl::PPM 模块存在。

可以随时检查所有这些。

use Config qw( %Config );

my $is_activeperl = 0;
$is_activeperl ||= eval { Config::local_patches() =~ /ActivePerl/i };
$is_activeperl ||= $Config{cf_email} =~ /ActiveState/i;
$is_activeperl ||= eval { require ActivePerl::Config };
$is_activeperl ||= eval { require ActivePerl::PPM };
于 2016-05-05T17:55:08.917 回答
4

根据快速搜索,activeperl ppm build increase timeout您可以将这种情况报告给他们的邮件列表/支持,他们将手动增加模块构建的超时值。

于 2016-05-05T19:36:07.500 回答