summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2019-05-12 23:39:01 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2019-05-13 21:01:57 -0400
commitda6a94efbba3b131ed253ae820d173749df1c60b (patch)
treeba22bacf6aa1595231ea104c9cf81d310e489022
parent64b0f7229e3fae1c8f1c19e08b45685fc6a87d42 (diff)
downloadlighttpd1.4-da6a94efbba3b131ed253ae820d173749df1c60b.tar.gz
lighttpd1.4-da6a94efbba3b131ed253ae820d173749df1c60b.zip
[tests] has_feature() helper func
has_feature() helper func so that tests can be skipped if support is not present
-rw-r--r--tests/LightyTest.pm13
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;