redis development: How do I add/enable debug messages when running unit tests

Viewed 227

I am adding a command to the redis code and when I run the unit test, I want to see the content of some of the data structures. I am running the test like this: ./runtest --single unit/acl. I have also added server log like this:

serverLog(LL_NOTICE, "This is called when the test is run");

However, I don't see this message printed on the screen. How do I add print statements and debug redis code?

1 Answers

Be sure to execute make after modifying the source code.

You will not see serverLog() messages when you execute the test runner; they are from redis-server.

For test runs, redis-server logs are written to tests/tmp/<test-directory>/stdout.


Development cycle:

  1. Edit source code
  2. Write tests
  3. Compile source code
    • make
  4. Run tests
    • ./runtest (add your arguments)
  5. Inspect redis-server logs
    • less tests/tmp/*/stdout
  6. Delete test artifacts
    • rm -rf tests/tmp/*
Related