rmw (Remove to Waste)

Code Testing

General Testing

If you’re writing a patch, using make check will cover most of rmw’s operations. If there’s a test missing, please open a ticket.

Testing the purge feature

Setting the RMWTRASH environmental variable at run-time to “fake-year” will write the year 1999 to the DeletionDate string in the .trashinfo file.

RMWTRASH=fake-year rmw some.txt temp.asc files.doc

Then run rmw with the purge option

rmw -fg

Profiling

To get a profile of rmw using GNU gprof, first you’ll need to rebuild rmw with different compiler flags. The easiest way to do that is

make clean
../configure --enable-debug=profile
make

Then run rmw with any parameters you like.

ex: ./rmw -l

That will produce a file called gmon.out. Now run gprof ./rmw gmon.out to view the results.

How to Create a Unit Test

This example shows how to create a unit test after adding a new function. In strings_rmw.c I’ve added the function bufchk_len(). The test I created for it is buffer_overrun.c; then I’ve added the test to test/Makefile.am and re-ran ‘automake’.

 Edit or Improve this page

Valid XHTML 1.0!

Powered by jekyll