Skip to content

How to create testdata

Steven Wu edited this page Oct 28, 2016 · 2 revisions

Copied from devonogear/devonogear wiki and PR [devonogear/devonogear#113] (https://github.com/denovogear/denovogear/pull/113)

SHA256 is considered more secure that MD5, so it is a good idea to use it to validate our testdata.tar.gz download.

At the same time, create a make_testdata_sum target to simplify the calculation of the SHA256, e.g.

  1. Commit new testing data to the testdata repo.
  2. Identify the commit id of the updated testdata repo
  3. Edit the TESTDATA_COMMIT in test/CMakeList.txt to reflect the new id.
  4. Run make make_testdata_sum to calculate the SHA256 of the data
  5. Paste the result into TESTDATA_SHA256 in test/CmakeList.txt
  6. Run make testdata to verify that it works.

If you add or edit files in the test data repository you will need to edit the Tests/CMakeLists.txt file of the denovogear repo to ensure the new data is downloaded when tests are run. Specifically you need to include the sha-1 hash for the commit that includes your changes and an SHA256 checksum for the contents of the repo.

SET(TESTDATA_COMMIT c4ff355)
SET(TESTDATA_SHA256 b8c2f82f6b6662d1826e99722e378b2e6af25499eed553c4ec451633ce45935d)

The sha can be found on the repo's github page, or by typing git log on your local machine.

The SHA256 checksum can be generated by editing TESTDATA_COMMIT and calling

make make_testdata_sum

See #113.

The sum can also be generated with a one-liner

wget -q -O -  https://api.github.com/repos/denovogear/testdata/tarball/${commit-sha}  | sha256sum

Run make testdata to verify that it works.