blob: 9d0696e50a040e22339f7211558ae2b857fa60d4 [file] [log] [blame]
# This makefile includes various integration tests, and is meant to be usable
# in both development and deployment settings.
#
# Its interface is as follows:
# Exports:
# apache_system_tests
# apache_vm_system_tests (includes tests that can be run on VMs)
# Imports:
# apache_install_conf (should read OPT_REWRITE_TEST, OPT_PROXY_TEST,
# OPT_SLURP_TEST, OPT_SPELING_TEST, OPT_MEMCACHED_TEST,
# OPT_MEMCACHE_LOADTEST_TEST, OPT_PURGING_LOADTEST_TEST,
# OPT_IUR_LOADTEST_TEST, OPT_IPRO_PRESERVE_LOADTEST_TEST,
# OPT_HTTPS_TEST,
# OPT_LOADTEST_TRACE_TEST, OPT_STRESS_TEST,
# OPT_SHARED_MEM_LOCK_TEST, OPT_GZIP_TEST,
# OPT_EXPERIMENT_GA_TEST, OPT_EXPERIMENT_NO_GA_TEST,
# OPT_PER_VHOST_STATS_TEST, OPT_NO_PER_VHOST_STATS_TEST,
# OPT_ALL_DIRECTIVES_TEST)
# stop, start (to stop and start Apache)
# apache_debug_restart
# apache_debug_stop
# apache_debug_leak_test, apache_debug_proxy_test, apache_debug_slurp_test
# APACHE_PORT
# APACHE_HTTPS_PORT
# APACHE_DEBUG_PAGESPEED_CONF
# MOD_PAGESPEED_CACHE
# MOD_PAGESPEED_ROOT
# INSTALL_DATA_DIR
# RCPORT1, RCPORT2, RCPORT3, RCPORT4, RCPORT5, RCPORT6, RCPORT7
# We want order of dependencies honored..
.NOTPARALLEL :
# Want |& support; and /bin/sh doesn't provide it at least on Ubuntu 11.04
SHELL=/bin/bash
# Make conf, log, and cache file locations accessible to apache/system_test.sh
export APACHE_DEBUG_PAGESPEED_CONF
export APACHE_LOG
export MOD_PAGESPEED_CACHE
apache_vm_system_tests : setup_doc_root
$(MAKE) FAST_RESTART=1 apache_debug_smoke_test
$(MAKE) FAST_RESTART=1 apache_debug_downstream_caching_test
$(MAKE) FAST_RESTART=1 apache_debug_per_vhost_stats_test
$(MAKE) FAST_RESTART=1 apache_debug_memcached_test
$(MAKE) FAST_RESTART=1 apache_debug_leak_test
$(MAKE) FAST_RESTART=1 apache_debug_rewrite_test
$(MAKE) FAST_RESTART=1 apache_debug_proxy_test
$(MAKE) FAST_RESTART=1 apache_debug_slurp_test
$(MAKE) FAST_RESTART=1 apache_debug_speling_test
$(MAKE) FAST_RESTART=1 apache_debug_gzip_test
$(MAKE) FAST_RESTART=1 apache_debug_experiment_test
$(MAKE) FAST_RESTART=1 apache_debug_vhost_only_test
$(MAKE) FAST_RESTART=1 apache_debug_global_off_test
$(MAKE) FAST_RESTART=1 apache_debug_shared_mem_lock_sanity_test
$(MAKE) apache_debug_https_fetch_test
$(MAKE) FAST_RESTART=1 apache_debug_stats_logging_test
$(MAKE) FAST_RESTART=1 apache_debug_all_directives_test
$(MAKE) FAST_RESTART=1 apache_debug_unplugged_test
$(MAKE) apache_install_conf
# 'apache_install_conf' should always be last, to leave your debug
# Apache server in a consistent state.
# apache_debug_serf_empty_header_test fails when testing on VMs for
# release builds. This appears to be due to the complicated proxy
# setup.
# TODO(jmarantz): fix this.
apache_system_tests : apache_vm_system_tests
$(MAKE) FAST_RESTART=1 apache_debug_serf_empty_header_test
$(MAKE) apache_install_conf
$(MAKE) FAST_RESTART=1 apache_debug_restart
APACHE_HOST = localhost
ifeq ($(APACHE_PORT),80)
APACHE_SERVER = $(APACHE_HOST)
else
APACHE_SERVER = $(APACHE_HOST):$(APACHE_PORT)
endif
APACHE_SECONDARY_SERVER = $(APACHE_HOST):$(APACHE_SECONDARY_PORT)
WGET = wget
WGET_PROXY = http_proxy=$(APACHE_SERVER) $(WGET) -q -O -
WGET_NO_PROXY = $(WGET) --no-proxy
export WGET
ifeq ($(APACHE_HTTPS_PORT),)
APACHE_HTTPS_SERVER =
else ifeq ($(APACHE_HTTPS_PORT),443)
APACHE_HTTPS_SERVER = localhost
else
APACHE_HTTPS_SERVER = localhost:$(APACHE_HTTPS_PORT)
endif
EXAMPLE = $(APACHE_SERVER)/mod_pagespeed_example
EXAMPLE_IMAGE = $(EXAMPLE)/images/Puzzle.jpg.pagespeed.ce.91_WewrLtP.jpg
EXAMPLE_BIG_CSS = $(EXAMPLE)/styles/big.css.pagespeed.ce.01O-NppLwe.css
EXAMPLE_COMBINE_CSS = $(EXAMPLE)/combine_css.html
TEST_ROOT = $(APACHE_SERVER)/mod_pagespeed_test
APACHE_SYSTEM_TEST = $(shell \
if [ -f $(MOD_PAGESPEED_ROOT)/pagespeed/apache/system_test.sh ]; then \
echo $(MOD_PAGESPEED_ROOT)/pagespeed/apache/system_test.sh ;\
else \
echo $(MOD_PAGESPEED_ROOT)/third_party/pagespeed/apache/system_test.sh ;\
fi)
# Installs debug configuration and runs a smoke test against it.
# This will blow away your existing pagespeed.conf,
# and clear the cache. It will also run with statistics off at the end,
# restoring it at the end
apache_debug_smoke_test : apache_install_conf apache_debug_restart
@echo '***' System-test with cold cache
$(MAKE) stop
rm -rf $(MOD_PAGESPEED_CACHE)/*
$(MAKE) start
CACHE_FLUSH_TEST=on \
RCPORT1=$(RCPORT1) \
RCPORT2=$(RCPORT2) \
RCPORT3=$(RCPORT3) \
RCPORT4=$(RCPORT4) \
RCPORT5=$(RCPORT5) \
RCPORT6=$(RCPORT6) \
RCPORT7=$(RCPORT7) \
APACHE_SECONDARY_PORT=$(APACHE_SECONDARY_PORT) \
APACHE_TERTIARY_PORT=$(APACHE_TERTIARY_PORT) \
APACHE_DOC_ROOT=$(APACHE_DOC_ROOT) \
FIRST_RUN=true \
$(APACHE_SYSTEM_TEST) $(APACHE_SERVER) $(APACHE_HTTPS_SERVER)
#
@echo '***' System-test with warm cache
CACHE_FLUSH_TEST=on \
RCPORT1=$(RCPORT1) \
RCPORT2=$(RCPORT2) \
RCPORT3=$(RCPORT3) \
RCPORT4=$(RCPORT4) \
RCPORT5=$(RCPORT5) \
RCPORT6=$(RCPORT6) \
RCPORT7=$(RCPORT7) \
APACHE_SECONDARY_PORT=$(APACHE_SECONDARY_PORT) \
APACHE_TERTIARY_PORT=$(APACHE_TERTIARY_PORT) \
APACHE_DOC_ROOT=$(APACHE_DOC_ROOT) \
$(APACHE_SYSTEM_TEST) $(APACHE_SERVER) $(APACHE_HTTPS_SERVER)
@echo '***' System-test with statistics off
mv $(APACHE_DEBUG_PAGESPEED_CONF) $(APACHE_DEBUG_PAGESPEED_CONF).save
sed -e "s/# ModPagespeedStatistics off/ModPagespeedStatistics off/" \
< $(APACHE_DEBUG_PAGESPEED_CONF).save \
> $(APACHE_DEBUG_PAGESPEED_CONF)
grep ModPagespeedStatistics $(APACHE_DEBUG_PAGESPEED_CONF)
grep ModPagespeedInheritVHostConfig $(APACHE_DEBUG_PAGESPEED_CONF)
$(MAKE) stop
$(MAKE) start
RCPORT1=$(RCPORT1) \
RCPORT2=$(RCPORT2) \
RCPORT3=$(RCPORT3) \
RCPORT4=$(RCPORT4) \
RCPORT5=$(RCPORT5) \
RCPORT6=$(RCPORT6) \
RCPORT7=$(RCPORT7) \
APACHE_SECONDARY_PORT=$(APACHE_SECONDARY_PORT) \
APACHE_TERTIARY_PORT=$(APACHE_TERTIARY_PORT) \
APACHE_DOC_ROOT=$(APACHE_DOC_ROOT) \
CACHE_FLUSH_TEST=on \
$(APACHE_SYSTEM_TEST) $(APACHE_SERVER) $(APACHE_HTTPS_SERVER)
#
# Now turn off ModPagespeedInheritVHostConfig, turn stats back on.
@echo '***' System-test without InheritVhostConfig, stats on.
sed -e "s/InheritVHostConfig on/InheritVHostConfig off/" \
< $(APACHE_DEBUG_PAGESPEED_CONF).save \
> $(APACHE_DEBUG_PAGESPEED_CONF)
grep ModPagespeedStatistics $(APACHE_DEBUG_PAGESPEED_CONF)
grep ModPagespeedInheritVHostConfig $(APACHE_DEBUG_PAGESPEED_CONF)
$(MAKE) stop
$(MAKE) start
CACHE_FLUSH_TEST=on \
NO_VHOST_MERGE=on \
RCPORT1=$(RCPORT1) \
RCPORT2=$(RCPORT2) \
RCPORT3=$(RCPORT3) \
RCPORT4=$(RCPORT4) \
RCPORT5=$(RCPORT5) \
RCPORT6=$(RCPORT6) \
RCPORT7=$(RCPORT7) \
APACHE_SECONDARY_PORT=$(APACHE_SECONDARY_PORT) \
APACHE_TERTIARY_PORT=$(APACHE_TERTIARY_PORT) \
APACHE_DOC_ROOT=$(APACHE_DOC_ROOT) \
$(APACHE_SYSTEM_TEST) $(APACHE_SERVER) $(APACHE_HTTPS_SERVER)
#
# Restore config
mv $(APACHE_DEBUG_PAGESPEED_CONF).save $(APACHE_DEBUG_PAGESPEED_CONF)
$(MAKE) apache_debug_stop
[ -z "`grep leaked_rewrite_drivers $(APACHE_LOG)`" ]
@echo PASS
apache_debug_rewrite_test : rewrite_test_prepare apache_install_conf \
apache_debug_restart
sleep 2
$(WGET_NO_PROXY) -q -O - --save-headers $(EXAMPLE_IMAGE) \
| head -14 | grep "Content-Type: image/jpeg"
$(WGET_NO_PROXY) -q -O - $(APACHE_SECONDARY_SERVER)/mod_pagespeed_statistics \
| grep cache_hits
$(WGET_NO_PROXY) -q -O - $(APACHE_SECONDARY_SERVER)/shortcut.html \
| grep "Filter Examples"
rewrite_test_prepare :
$(eval OPT_REWRITE_TEST="REWRITE_TEST=1")
rm -rf $(MOD_PAGESPEED_CACHE)/*
# This test checks that when mod_speling is enabled we handle the
# resource requests properly by nulling out request->filename. If
# we fail to do that then mod_speling rewrites the result to be a 300
# (multiple choices).
apache_debug_speling_test : speling_test_prepare apache_install_conf \
apache_debug_restart
@echo Testing compatibility with mod_speling:
$(WGET_NO_PROXY) -O /dev/null --save-headers $(EXAMPLE_IMAGE) 2>&1 \
| head | grep "HTTP request sent, awaiting response... 200 OK"
speling_test_prepare :
$(eval OPT_SPELING_TEST="SPELING_TEST=1")
rm -rf $(MOD_PAGESPEED_CACHE)/*
apache_debug_memcached_test :
rm -rf $(MOD_PAGESPEED_CACHE)/*
# run_program_with_memcached.sh exports $MEMCACHED_PORT which is
# needed by apache_install_conf so pagespeed.conf gets the
# right ModPagespeedMemcachedServers setup. MEMCACHED_PORT will
# be different on each run, which makes it easier for people to
# run system-tests and unit-tests in parallel with one another.
env APACHE_DOC_ROOT=$(APACHE_DOC_ROOT) \
$(INSTALL_DATA_DIR)/run_program_with_memcached.sh \
$(MAKE) apache_debug_memcached_test_run
$(MAKE) apache_debug_stop
[ -z "`grep leaked_rewrite_drivers $(APACHE_LOG)`" ]
@echo PASS
apache_debug_memcached_test_run :
$(MAKE) apache_install_conf OPT_MEMCACHED_TEST="MEMCACHED_TEST=1"
$(MAKE) apache_debug_restart
$(APACHE_SYSTEM_TEST) $(APACHE_SERVER) $(APACHE_HTTPS_SERVER)
CACHE_FLUSH_TEST=on \
RCPORT1=$(RCPORT1) \
RCPORT2=$(RCPORT2) \
RCPORT3=$(RCPORT3) \
RCPORT4=$(RCPORT4) \
RCPORT5=$(RCPORT5) \
RCPORT6=$(RCPORT6) \
RCPORT7=$(RCPORT7) \
APACHE_SECONDARY_PORT=$(APACHE_SECONDARY_PORT) \
APACHE_TERTIARY_PORT=$(APACHE_TERTIARY_PORT) \
$(APACHE_SYSTEM_TEST) $(APACHE_SERVER) $(APACHE_HTTPS_SERVER)
# This test checks that when ModPagespeedFetchWithGzip is enabled we
# fetch resources from origin with the gzip flag. Note that big.css
# uncompressed is 4307 bytes. As of Jan 2012 we get 339 bytes, but
# the compression is done by mod_deflate which might change. So we
# do a cumbersome range-check that the 4307 bytes gets compressed to
# somewhere between 200 and 500 bytes.
apache_debug_gzip_test : gzip_test_prepare apache_install_conf \
apache_debug_restart
@echo Testing efficacy of ModPagespeedFetchWithGzip:
# Note: The client request will not served with gzip because we do not
# have an Accept-Encoding header, we are testing that the backend fetch
# uses gzip.
$(WGET_NO_PROXY) -O /dev/null --save-headers $(EXAMPLE_BIG_CSS) 2>&1 \
| head | grep "HTTP request sent, awaiting response... 200 OK"
# TODO(sligocki): The serf_fetch_bytes_count should be available on
# this vhost's mod_pagespeed_statistics page. Why isn't it?
bytes=`$(WGET_NO_PROXY) -q -O - \
$(APACHE_SERVER)/mod_pagespeed_global_statistics \
| sed -n 's/serf_fetch_bytes_count: *//p'`; \
echo Compressed big.css took $$bytes bytes; \
test $$bytes -gt 200 -a $$bytes -lt 500
gzip_test_prepare :
$(eval OPT_GZIP_TEST="GZIP_TEST=1")
rm -rf $(MOD_PAGESPEED_CACHE)/*
# Test to make sure the experiment framework is sending its headers.
# TODO(nforman): Make this run multiple times and make sure we don't *always*
# get the same result.
apache_debug_experiment_test :
$(MAKE) apache_debug_experiment_ga_test
$(MAKE) apache_debug_experiment_no_ga_test
apache_debug_experiment_ga_test : experiment_ga_test_prepare \
apache_install_conf apache_debug_restart
$(INSTALL_DATA_DIR)/apache_experiment_ga_test.sh $(APACHE_SERVER)
apache_debug_experiment_no_ga_test : experiment_no_ga_test_prepare \
apache_install_conf apache_debug_restart
$(INSTALL_DATA_DIR)/apache_experiment_no_ga_test.sh $(APACHE_SERVER)
experiment_ga_test_prepare :
$(eval OPT_EXPERIMENT_GA_TEST="EXPERIMENT_GA_TEST=1")
rm -rf $(MOD_PAGESPEED_CACHE)/*
experiment_no_ga_test_prepare :
$(eval OPT_EXPERIMENT_NO_GA_TEST="EXPERIMENT_NO_GA_TEST=1")
rm -rf $(MOD_PAGESPEED_CACHE)/*
apache_debug_downstream_caching_test :
rm -rf $(MOD_PAGESPEED_CACHE)/*
$(MAKE) apache_install_conf apache_debug_restart
$(INSTALL_DATA_DIR)/apache_downstream_caching_test.sh $(APACHE_SERVER)
# Test to make sure we don't crash if we're off for global but on for vhosts.
# We use the stress test config as a base for that, as it has the vhosts all
# setup nicely; we just need to turn off ourselves for the global scope.
apache_debug_vhost_only_test :
$(MAKE) apache_install_conf \
OPT_LOADTEST_TRACE_TEST=LOADTEST_TRACE_TEST=1 \
OPT_STRESS_TEST=STRESS_TEST=1
echo 'ModPagespeed off' >> $(APACHE_DEBUG_PAGESPEED_CONF)
$(MAKE) apache_debug_restart
$(WGET_NO_PROXY) -O /dev/null --save-headers $(EXAMPLE) 2>&1 \
| head | grep "HTTP request sent, awaiting response... 200 OK"
# Regression test for serf fetching something with an empty header.
# We use a slurp-serving server to produce that.
EMPTY_HEADER_URL=http://www.modpagespeed.com/empty_header.html
apache_debug_serf_empty_header_test :
$(MAKE) apache_install_conf \
OPT_LOADTEST_TRACE_TEST=LOADTEST_TRACE_TEST=1 \
OPT_STRESS_TEST=STRESS_TEST=1 \
SLURP_DIR=$(PWD)/$(INSTALL_DATA_DIR)/mod_pagespeed_test/slurp
$(MAKE) apache_debug_restart
# Make sure we can fetch a URL with empty header correctly..
$(WGET_PROXY) $(EMPTY_HEADER_URL) > /dev/null
# Test to make sure we don't crash due to uninitialized statistics if we
# are off by default but turned on in some place.
apache_debug_global_off_test :
$(MAKE) apache_install_conf
echo 'ModPagespeed off' >> $(APACHE_DEBUG_PAGESPEED_CONF)
$(MAKE) apache_debug_restart
$(WGET_NO_PROXY) -O /dev/null --save-headers $(EXAMPLE)?PageSpeed=on 2>&1 \
| head | grep "HTTP request sent, awaiting response... 200 OK"
# Test to make sure HTTPS fetching works.
apache_debug_https_fetch_test :
$(MAKE) apache_install_conf
$(MAKE) apache_debug_restart
$(INSTALL_DATA_DIR)/apache_https_fetch_test.sh \
$(APACHE_SERVER) $(APACHE_HTTPS_SERVER)
# Sanity-check that enabling shared-memory locks don't cause the
# system to crash, and a rewrite does successfully happen.
apache_debug_shared_mem_lock_sanity_test : shared_mem_lock_test_prepare \
apache_install_conf apache_debug_restart
$(WGET_NO_PROXY) -q -O /dev/null \
$(EXAMPLE_COMBINE_CSS)?PageSpeedFilters=combine_css
sleep 1
$(WGET_NO_PROXY) -q -O - \
$(EXAMPLE_COMBINE_CSS)?PageSpeedFilters=combine_css \
| grep "\.pagespeed\.cc\."
shared_mem_lock_test_prepare :
$(eval OPT_SLURP_TEST="SHARED_MEM_LOCK_TEST=1")
$(MAKE) stop
# "Directory not empty" failures were observed here, so add sleep to
# wait for pending cache-writes to finish.
sleep 2
rm -rf $(MOD_PAGESPEED_CACHE)/*
$(MAKE) start
sleep 2
# Test that all directives are accepted by the options parser.
apache_debug_all_directives_test :
$(MAKE) apache_install_conf \
OPT_ALL_DIRECTIVES_TEST="ALL_DIRECTIVES_TEST=1"
$(MAKE) apache_debug_restart
# Test to make sure that per-vhost stats work.
STATS = mod_pagespeed_statistics
GLOBAL_STATS = mod_pagespeed_global_statistics
TRIM_PATH = \
"mod_pagespeed_example/trim_urls.html?PageSpeedFilters=trim_urls"
apache_debug_per_vhost_stats_test :
$(MAKE) apache_install_conf \
OPT_PER_VHOST_STATS_TEST="PER_VHOST_STATS_TEST=1" \
OPT_NO_PER_VHOST_STATS_TEST="NO_PER_VHOST_STATS_TEST=0"
$(MAKE) apache_debug_restart
@echo Fetch a trim URL example from VHost: 8080 -- that should bump
@echo the stat for that there + global but not on :8083
$(WGET_NO_PROXY) -q -O /dev/null $(APACHE_SERVER)/$(TRIM_PATH)
$(WGET_NO_PROXY) -q -O - $(APACHE_SERVER)/$(STATS) \
| grep url_trims | grep -w 1
$(WGET_NO_PROXY) -q -O - $(APACHE_SECONDARY_SERVER)/$(STATS) \
| grep url_trims | grep -w 0
$(WGET_NO_PROXY) -q -O - $(APACHE_SERVER)/$(GLOBAL_STATS) \
| grep url_trims | grep -w 1
$(WGET_NO_PROXY) -q -O - $(APACHE_SECONDARY_SERVER)/$(GLOBAL_STATS) \
| grep url_trims | grep -w 1
@echo Now on :8083 as well.
$(WGET_NO_PROXY) -q -O /dev/null $(APACHE_SECONDARY_SERVER)/$(TRIM_PATH)
$(WGET_NO_PROXY) -q -O - $(APACHE_SERVER)/$(STATS) \
| grep url_trims | grep -w 1
$(WGET_NO_PROXY) -q -O - $(APACHE_SECONDARY_SERVER)/$(STATS) \
| grep url_trims | grep -w 1
$(WGET_NO_PROXY) -q -O - $(APACHE_SERVER)/$(GLOBAL_STATS) \
| grep url_trims | grep -w 2
$(WGET_NO_PROXY) -q -O - $(APACHE_SECONDARY_SERVER)/$(GLOBAL_STATS) \
| grep url_trims | grep -w 2
# Without per-vhost stats.
$(MAKE) apache_install_conf \
OPT_PER_VHOST_STATS_TEST="PER_VHOST_STATS_TEST=0" \
OPT_NO_PER_VHOST_STATS_TEST="NO_PER_VHOST_STATS_TEST=1"
$(MAKE) apache_debug_restart
@echo Now try without global stats -- both should update at once.
$(WGET_NO_PROXY) -q -O /dev/null $(APACHE_SERVER)/$(TRIM_PATH)
$(WGET_NO_PROXY) -q -O - $(APACHE_SERVER)/$(STATS) \
| grep url_trims | grep -w 1
$(WGET_NO_PROXY) -q -O - $(APACHE_SECONDARY_SERVER)/$(STATS) \
| grep url_trims | grep -w 1
$(WGET_NO_PROXY) -q -O /dev/null $(APACHE_SECONDARY_SERVER)/$(TRIM_PATH)
$(WGET_NO_PROXY) -q -O - $(APACHE_SERVER)/$(STATS) \
| grep url_trims | grep -w 2
$(WGET_NO_PROXY) -q -O - $(APACHE_SECONDARY_SERVER)/$(STATS) \
| grep url_trims | grep -w 2
# Test that statistics logging works.
apache_debug_stats_logging_test :
$(MAKE) apache_install_conf \
OPT_STATS_LOGGING_TEST="STATS_LOGGING_TEST=1"
$(MAKE) apache_debug_restart
$(APACHE_SYSTEM_TEST) $(APACHE_SERVER) $(APACHE_HTTPS_SERVER)
# Tests that setting the root configuration 'unplugged' can't be overridden
# with a query-param, but can be overridden with an explicit vhost setting.
EXAMPLE_INDEX = mod_pagespeed_example/index.html
apache_debug_unplugged_test : apache_install_conf apache_debug_restart
$(MAKE) stop
mv $(APACHE_DEBUG_PAGESPEED_CONF) $(APACHE_DEBUG_PAGESPEED_CONF).save
# Note - there are multiple occurrences of "ModPagespeed on" in our
# debug pagespeed.conf. This article shows how to replace only the
# first one with sed: http://stackoverflow.com/questions/148451/
# how-to-use-sed-to-replace-only-the-first-occurrence-in-a-file
sed -e '0,/ModPagespeed on/{s/ModPagespeed on/ModPagespeed unplugged/}' \
< $(APACHE_DEBUG_PAGESPEED_CONF).save \
> $(APACHE_DEBUG_PAGESPEED_CONF)
$(MAKE) start
# Fetching from the root should be off, even if we try to turn it on.
[ -z "`$(WGET) -q --save-headers -O - \
$(APACHE_SERVER)/$(EXAMPLE_INDEX)?ModPagespeed=on | \
grep X-Mod-Pagespeed`" ]
# Fetching from the secondary host should be on.
http_proxy=$(APACHE_SECONDARY_SERVER) $(WGET) -q --save-headers -O - \
http://secondary.example.com/$(EXAMPLE_INDEX) | \
grep X-Mod-Pagespeed
#
# Restore config
mv $(APACHE_DEBUG_PAGESPEED_CONF).save $(APACHE_DEBUG_PAGESPEED_CONF)
$(MAKE) apache_debug_stop
@echo PASS
# Target used to populate the docroot for a webserver, including the
# read-only mod_pagespeed_example, mod_pagespeed_test, and do_not_modify,
# plus the read/write areas for cache purging and flush tests. The
# read-only directories are symlinked in for speed, and the read/write
# directories are deep-copied, but they are small.
setup_doc_root :
mkdir -p $(APACHE_DOC_ROOT)
rm -fr "$(APACHE_DOC_ROOT)/mod_pagespeed_example"
ln -Tsf "$(realpath $(INSTALL_DATA_DIR))/mod_pagespeed_example" \
$(APACHE_DOC_ROOT)/mod_pagespeed_example
rm -fr "$(APACHE_DOC_ROOT)/mod_pagespeed_test"
ln -Tsf "$(realpath $(INSTALL_DATA_DIR))/mod_pagespeed_test" \
$(APACHE_DOC_ROOT)/mod_pagespeed_test
rm -fr "$(APACHE_DOC_ROOT)/do_not_modify"
ln -Tsf "$(realpath $(INSTALL_DATA_DIR))/do_not_modify" \
$(APACHE_DOC_ROOT)/do_not_modify
rm -rf "$(APACHE_DOC_ROOT)/cache_flush"
cp -r "$(INSTALL_DATA_DIR)/mod_pagespeed_test/cache_flush" \
$(APACHE_DOC_ROOT)
rm -rf "$(APACHE_DOC_ROOT)/purge"
cp -r "$(INSTALL_DATA_DIR)/mod_pagespeed_test/purge" $(APACHE_DOC_ROOT)