Merge Debian 3.0.33-2 (UNRELEASED) changes.
authorRoland Rosenfeld <roland@debian.org>
Sun, 24 Apr 2022 13:39:41 +0000 (15:39 +0200)
committerRoland Rosenfeld <roland@debian.org>
Sun, 24 Apr 2022 13:39:41 +0000 (15:39 +0200)
debian/changelog
debian/maintscript
debian/rules
debian/tests/conditional-defines [new file with mode: 0644]
debian/tests/conditional-defines.pl [new file with mode: 0755]
debian/tests/control
debian/tests/privoxy-regression-test

index 022e2d0..b18610b 100644 (file)
@@ -4,6 +4,16 @@ privoxy (3.0.34~gitsnapshot-1) UNRELEASED; urgency=medium
 
  -- Roland Rosenfeld <roland@debian.org>  Thu, 09 Dec 2021 16:35:46 +0100
 
+privoxy (3.0.33-2) UNRELEASED; urgency=medium
+
+  * d/maintscript: Remove orphaned
+    templates/edit-actions-for-url-string-filter (Closes: #1001501).
+  * d/tests/conditional-defines: Check that expected #defines are enabled.
+  * d/rules: --enable-compression at build time (still disabled in config).
+  * d/tests/privoxy-regression-tests: 2 pass check with different options.
+
+ -- Roland Rosenfeld <roland@debian.org>  Sat, 11 Dec 2021 10:36:30 +0100
+
 privoxy (3.0.33-1) unstable; urgency=medium
 
   * New upstream version 3.0.33.
index 77e4ed9..d48b097 100644 (file)
@@ -1,3 +1,4 @@
 rm_conffile /etc/privoxy/global.action 3.0.11-1~ privoxy
 rm_conffile /etc/privoxy/standard.action 3.0.11-1~ privoxy
 rm_conffile /etc/privoxy/templates/show-version 3.0.28-2~ privoxy
+rm_conffile /etc/privoxy/templates/edit-actions-for-url-string-filter 3.0.33-2~ privoxy
index d6c23b3..87c8cf4 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/make -f
 #
-# (c) 2002-2021 Roland Rosenfeld <roland@debian.org>
+# (c) 2002-2022 Roland Rosenfeld <roland@debian.org>
 #
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
@@ -25,6 +25,7 @@ override_dh_auto_configure:
                --enable-external-filters \
                --enable-extended-statistics \
                --enable-pcre-host-patterns \
+               --enable-compression \
                --with-mbedtls \
                --with-brotli \
                --with-docbook=/usr/share/sgml/docbook/stylesheet/dsssl/modular
diff --git a/debian/tests/conditional-defines b/debian/tests/conditional-defines
new file mode 100644 (file)
index 0000000..0f00d33
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# Check http://config.privoxy.org/show-status for Conditional #defines enabled
+# This wrapper starts privoxy on port 8119 and runs conditional-defines.pl
+#
+# (c) 2022 Roland Rosenfeld <roland@debian.org>
+
+PORT=8119
+
+TESTSDIR=$(dirname "$0")
+
+if [ -z "$AUTOPKGTEST_TMP" ]; then
+    AUTOPKGTEST_TMP=$(mktemp -d)
+fi
+
+trap 'rm -rf "$AUTOPKGTEST_TMP"' EXIT
+
+CONFIG=$AUTOPKGTEST_TMP/config
+PIDFILE=$AUTOPKGTEST_TMP/privoxy.pid
+PRIVOXY=$AUTOPKGTEST_TMP/privoxy
+
+sed -e "s/^listen-address.*/listen-address 127.0.0.1:$PORT/" \
+    -e "s%^logdir.*%logdir $AUTOPKGTEST_TMP%" \
+    < /usr/share/privoxy/config > "$CONFIG"
+
+cp /usr/sbin/privoxy "$PRIVOXY"
+
+echo "Starting privoxy on port $PORT"
+$PRIVOXY --pidfile "$PIDFILE" "$CONFIG"
+
+http_proxy=http://127.0.0.1:$PORT/
+export http_proxy
+
+"$TESTSDIR"/conditional-defines.pl
+EXITVAL=$?
+
+echo "Stopping privoxy on port $PORT"
+# shellcheck disable=SC2046
+kill $(cat "$PIDFILE")
+
+exit $EXITVAL
diff --git a/debian/tests/conditional-defines.pl b/debian/tests/conditional-defines.pl
new file mode 100755 (executable)
index 0000000..d1554a3
--- /dev/null
@@ -0,0 +1,70 @@
+#!/usr/bin/perl
+#
+# Check http://config.privoxy.org/show-status for Conditional #defines enabled
+#
+# (c) 2022 Roland Rosenfeld <roland@debian.org>
+
+use strict;
+use warnings;
+use LWP::UserAgent ();
+use HTML::TreeBuilder 5 -weak;
+
+my $exitcode = 0;
+
+my $ua = LWP::UserAgent->new(timeout => 10);
+$ua->env_proxy;
+my $response = $ua->get('http://config.privoxy.org/show-status');
+if (!$response->is_success) {
+   die $response->status_line;
+}
+my $tree = HTML::TreeBuilder->new;
+$tree->parse($response->decoded_content);
+
+# Search for "Conditional #defines:" table:
+my $summary = 'The state of some ./configure options and what they do.';
+my $table = $tree->look_down('_tag' => 'table',
+                             'summary' => $summary);
+unless (defined $table) {
+   die "summary '$summary' not found in tables";
+}
+
+# These features are intentionaly disabled, all others should be enabled:
+my %disabled_features = ('FEATURE_ACCEPT_FILTER' => 1, # BSD only
+                         'FEATURE_STRPTIME_SANITY_CHECKS' =>1, # BSD libc only
+                         'FEATURE_GRACEFUL_TERMINATION' =>1, # devel only
+                        );
+
+my $enabled = 0;
+my $disabled_ok = 0;
+my $disabled_nok = 0;
+foreach my $tr ($table->look_down('_tag' => 'tr')) {
+   my $td2 = ($tr->look_down('_tag' => 'td')) [1];
+   next unless defined $td2;
+   my $code = $tr->look_down('_tag' => 'code');
+   my $feature = $code->detach_content;
+   my $value = $td2->detach_content;
+   if ($value !~ /Yes/) {
+      # feature disabled, check whitelist
+      if (! defined $disabled_features{$feature}) {
+         printf STDERR "%s is disabled, but should be enabled\n", $feature;
+         $exitcode = 1;
+         $disabled_nok++;
+      } else {
+         $disabled_ok++;
+      }
+   } else {
+      $enabled++;
+   }
+}
+
+printf "%d features enabled\n", $enabled;
+printf "%d features intentionally disabled\n", $disabled_ok;
+printf "%d features unintentionally disabled\n", $disabled_nok;
+
+if ($enabled < 10) {
+   printf STDERR "Found only %d Conditional #defines, seems test ist broken\n",
+                 $enabled;
+   $exitcode = 1;
+}
+
+exit $exitcode;
index 1566c8f..6ff73cf 100644 (file)
@@ -1,2 +1,5 @@
 Tests: privoxy-regression-test
 Depends: curl, @
+
+Tests: conditional-defines
+Depends: privoxy, libwww-perl, libhtml-tree-perl
index 1c29fa0..e8fdd9d 100755 (executable)
@@ -3,7 +3,7 @@
 # Run privoxy-regression-test.pl on a configuration extended by
 # regression-tests.action.
 #
-# (c) 2018-2021 Roland Rosenfeld <roland@debian.org>
+# (c) 2018-2022 Roland Rosenfeld <roland@debian.org>
 
 PORT=8119
 
@@ -11,37 +11,57 @@ if [ -z "$AUTOPKGTEST_TMP" ]; then
     AUTOPKGTEST_TMP=$(mktemp -d)
 fi
 
-trap "rm -rf $AUTOPKGTEST_TMP" EXIT
+trap 'rm -rf "$AUTOPKGTEST_TMP"' EXIT
 
 CONFIG=$AUTOPKGTEST_TMP/config
 PIDFILE=$AUTOPKGTEST_TMP/privoxy.pid
 PRIVOXY=$AUTOPKGTEST_TMP/privoxy
 
+cp /usr/sbin/privoxy "$PRIVOXY"
+
+http_proxy=http://127.0.0.1:$PORT/
+export http_proxy
+
+OUTFILE=$AUTOPKGTEST_TMP/output
+
+
+echo "#### pass 1: some optiones disabled"
+
 sed -e "s/^listen-address.*/listen-address 127.0.0.1:$PORT/" \
     -e "s%^logdir.*%logdir $AUTOPKGTEST_TMP%" \
-    -e "s/^enable-edit-actions.*/enable-edit-actions 1/" \
     -e "s/^keep-alive-timeout.*/keep-alive-timeout 21/" \
-    -e "s/^#connection-sharing.*/connection-sharing 1/" \
-    < /usr/share/privoxy/config > $CONFIG
-echo "actionsfile regression-tests.action" >> $CONFIG
-
-cp /usr/sbin/privoxy $PRIVOXY
+    -e "s/^#connection-sharing.*/connection-sharing 0/" \
+    < /usr/share/privoxy/config > "$CONFIG"
+echo "actionsfile regression-tests.action" >> "$CONFIG"
 
 echo "Starting privoxy on port $PORT"
-$PRIVOXY --pidfile $PIDFILE $CONFIG
+$PRIVOXY --pidfile "$PIDFILE" "$CONFIG"
 
-http_proxy=http://127.0.0.1:$PORT/
-export http_proxy
+/usr/bin/privoxy-regression-test --max-level 200 --show-skipped-tests \
+    | tee "$OUTFILE" 2>&1
 
-OUTFILE=$AUTOPKGTEST_TMP/output
+
+echo "#### pass 2 with some more options enabled"
+
+sed -e "s/^listen-address.*/listen-address 127.0.0.1:$PORT/" \
+    -e "s%^logdir.*%logdir $AUTOPKGTEST_TMP%" \
+    -e "s/^enable-remote-toggle.*/enable-remote-toggle 1/" \
+    -e "s/^enable-edit-actions.*/enable-edit-actions 1/" \
+    -e "s/^enable-proxy-authentication-forwarding.*/enable-proxy-authentication-forwarding 1/" \
+    -e "s/^keep-alive-timeout.*/keep-alive-timeout 21/" \
+    -e "s/^#connection-sharing.*/connection-sharing 1/" \
+    < /usr/share/privoxy/config > "$CONFIG"
+echo "actionsfile regression-tests.action" >> "$CONFIG"
 
 /usr/bin/privoxy-regression-test --max-level 200 --show-skipped-tests \
-    | tee $OUTFILE 2>&1
+    | tee -a "$OUTFILE" 2>&1
+
 
 echo "Stopping privoxy on port $PORT"
-kill $(cat $PIDFILE)
+kill "$(cat "$PIDFILE")"
 
-if grep -q 'Executed.*, 0 failures.' $OUTFILE
+# Check that 2 passes have both 0 failures:
+if [ "$(grep -c 'Executed.*, 0 failures' "$OUTFILE")" = 2 ]
 then
     exit 0
 else