diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2019-05-12 23:39:01 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2019-05-13 21:01:57 -0400 |
commit | da6a94efbba3b131ed253ae820d173749df1c60b (patch) | |
tree | ba22bacf6aa1595231ea104c9cf81d310e489022 /tests/LightyTest.pm | |
parent | 64b0f7229e3fae1c8f1c19e08b45685fc6a87d42 (diff) | |
download | lighttpd-git-da6a94efbba3b131ed253ae820d173749df1c60b.tar.gz |
[tests] has_feature() helper func
has_feature() helper func so that tests
can be skipped if support is not present
Diffstat (limited to 'tests/LightyTest.pm')
-rw-r--r-- | tests/LightyTest.pm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/LightyTest.pm b/tests/LightyTest.pm index 74caea1e..baad6d99 100644 --- a/tests/LightyTest.pm +++ b/tests/LightyTest.pm @@ -444,4 +444,17 @@ sub endspawnfcgi { return 0; } +sub has_feature { + # quick-n-dirty crude parse of "lighttpd -V" + # (XXX: should be run on demand and only once per instance, then cached) + my ($self, $feature) = @_; + my $FH; + open($FH, "-|",$self->{LIGHTTPD_PATH}, "-V") || return 0; + while (<$FH>) { + return ($1 eq '+') if (/([-+]) \Q$feature\E/); + } + close $FH; + return 0; +} + 1; |