test report - embedding bzipped tar in a bash script (with uuencode)

Just a quick note on the cunning technique used in the making of tag_test.sh.

The utility's both data store and main interface is file system - which makes it easy to think of diff'ing directory trees (actual to golden) as a means to test the former.

Now, I would generate a golden test directory tree, test it manually all I want, tar-bzip2 it, and uuencode the data for pasting as an in-place redirection block (<<EOF) - which is fed to uudecode and untar in the script, of course.
And I'd also repeat this operation for every test I wanted to perform.

The resulting bash code is rather fatty, but it is totally self-contained.

1 comment: