Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Testing

jeffkaufman edited this page Apr 29, 2013 · 17 revisions

To run the ngx_pagespeed tests you need to first have built it. You also need to check out mod_pagespeed, but we can take a shortcut and do this the easy way, without gyp, because we don't need any dependencies:

$ svn checkout https://modpagespeed.googlecode.com/svn/tags/1.5.27.2/ mod_pagespeed

Then run:

test/run_tests.sh \
  primary_port \
  secondary_port \
  mod_pagespeed_dir \
  nginx_executable_path

For example:

$ test/run_tests.sh 8050 8051 /path/to/mod_pagespeed \
    /path/to/sbin/nginx

All of these paths need to be absolute.

This should print out a lot of lines like:

TEST: Make sure 404s aren't rewritten
      check_not fgrep /mod_pagespeed_beacon /dev/fd/63

and then eventually:

Failing Tests:
  In-place resource optimization
  In-place resource optimization
  In-place resource optimization
  compression is enabled for rewritten JS.
  compression is enabled for rewritten JS.
FAIL.
With serf fetcher setup.

Each of these failed tests is a known issue:

If it fails with:

TEST: PHP is enabled.
...
in 'PHP is enabled.'
FAIL.

the problem is that the test expects a php server to be running on port 9000:

$ sudo apt-get install php5-cgi
$ php-cgi -b 127.0.0.1:9000 &

If it fails with some other error, that's a problem, and it would be helpful for you to submit a bug.

Log files are in test/tmp/error.log and test/tmp/access.log.

Testing with memcached

Start an memcached server:

$ memcached -p 11211

In ngx_pagespeed/test/pagespeed_test.conf.template uncomment:

pagespeed MemcachedServers "localhost:11211";
pagespeed MemcachedThreads 1;

Then run the system test as above.

Testing with valgrind

If you set the environment variable USE_VALGRIND=true then the tests will run with valgrind:

USE_VALGRIND=true test/nginx_system_test.sh ...

Testing with the native fetcher

You can run the whole system test with the native fetcher instead of the serf fetcher:

TEST_NATIVE_FETCHER=true TEST_SERF_FETCHER=false test/nginx_system_test.sh ...

You can also run all the tests twice, once for each fetcher, serf fetcher first:

TEST_NATIVE_FETCHER=true test/nginx_system_test.sh ...

Manual debugging

If you just want to run some wgets against the testing setup you can ask the testing script to quit before actually running any tests, leaving nginx up:

RUN_TESTS=true test/nginx_system_test.sh ...