Black-box tester » History » Version 2
Borja Sotomayor, 04/11/2010 10:37 PM
| 1 | 1 | Borja Sotomayor | h1. Black-box tester |
|---|---|---|---|
| 2 | |||
| 3 | To better test your chidb implementation, we are providing a black-box testing program. This program will take a libchidb implementation, a run a series of tests on it. However, you are not provided with the source code for the tests, or even a description of what each test does (other than what part of libchidb it is testing). If a test does not pass, you will have to rely on the testing framework's error message, which could be something useful like this: |
||
| 4 | |||
| 5 | <pre> |
||
| 6 | CU_ASSERT(db->bt->pager->page_size == 1024); |
||
| 7 | </pre> |
||
| 8 | |||
| 9 | Or something less useful like this: |
||
| 10 | |||
| 11 | <pre> |
||
| 12 | CU_ASSERT(!strcmp(data, values[i])); |
||
| 13 | </pre> |
||
| 14 | |||
| 15 | Or you might just encounter a segmentation fault. If you don't immediately know why the test failed, then it's time to fire up the debugger and figure it out. |
||
| 16 | |||
| 17 | h2. How to run the black-box tester |
||
| 18 | |||
| 19 | 2 | Borja Sotomayor | # Download the following tarball: attachment:chidb-blackbox.tar.gz (for 32-bit machines) or attachment:chidb-blackbox_64bit.tar.gz (for 64-bit machines) |
| 20 | 1 | Borja Sotomayor | # Untar it in an empty directory. |
| 21 | # Set the LD_LIBRARY_PATH environment variable to wherever your libchidb.so file is. |
||
| 22 | # Run the executable "tests". |
||
| 23 | |||
| 24 | h2. Comments |
||
| 25 | |||
| 26 | # The tests for Step N assume that Step N-1 has been implemented. However, don't feel like you have to nail all the tests in one step before moving on to the next one. The tests exploit several corner cases, so maybe you just haven't figured those out yet, but have a good enough solution to move on to the next step. |
||
| 27 | # Do not obsess about the tests. They are not going to be used to grade you, and are simply provided as a way for you to quickly verify if your solution for a given step is correct. |
||
| 28 | # If your implementation passes all the tests, that doesn't mean that your project is 100% correct, but it's certainly a pretty good sign. |
||
| 29 | |||
| 30 | h2. Expected output |
||
| 31 | |||
| 32 | If all the tests run successfully, you should see the following: |
||
| 33 | |||
| 34 | <pre> |
||
| 35 | |||
| 36 | |||
| 37 | CUnit - A Unit testing framework for C - Version 2.1-0 |
||
| 38 | http://cunit.sourceforge.net/ |
||
| 39 | |||
| 40 | |||
| 41 | Suite: utils |
||
| 42 | Test: Get/put uint16 ... passed |
||
| 43 | Test: Get/put uint32 ... passed |
||
| 44 | Test: Get/put varint32 ... passed |
||
| 45 | Suite: dbrecord |
||
| 46 | Test: Single-string record ... passed |
||
| 47 | Test: Single-int8 record ... passed |
||
| 48 | Test: Single-int16 record ... passed |
||
| 49 | Test: Single-int32 record ... passed |
||
| 50 | Test: Single-null record ... passed |
||
| 51 | Test: Multiple-field record ... passed |
||
| 52 | Test: Packing/unpacking a record ... passed |
||
| 53 | Suite: pager |
||
| 54 | Test: Opening an existing file ... passed |
||
| 55 | Test: Reading pages ... passed |
||
| 56 | Test: Allocating/writing/reading a page ... passed |
||
| 57 | Suite: Step 1a: Opening an existing chidb file |
||
| 58 | Test: 1a.1 ... passed |
||
| 59 | Test: 1a.2 ... passed |
||
| 60 | Test: 1a.3 ... passed |
||
| 61 | Suite: Step 2: Loading a B-Tree node from the file |
||
| 62 | Test: 2.1 ... passed |
||
| 63 | Test: 2.2 ... passed |
||
| 64 | Test: 2.3 ... passed |
||
| 65 | Test: 2.4 ... passed |
||
| 66 | Test: 2.5 ... passed |
||
| 67 | Test: 2.6 ... passed |
||
| 68 | Suite: Step 3: Creating and writing a B-Tree node to disk |
||
| 69 | Test: 3.1 ... passed |
||
| 70 | Test: 3.2 ... passed |
||
| 71 | Test: 3.3 ... passed |
||
| 72 | Test: 3.4 ... passed |
||
| 73 | Test: 3.5 ... passed |
||
| 74 | Test: 3.6 ... passed |
||
| 75 | Test: 3.7 ... passed |
||
| 76 | Test: 3.8 ... passed |
||
| 77 | Test: 3.9 ... passed |
||
| 78 | Test: 3.10 ... passed |
||
| 79 | Suite: Step 1b: Opening a new chidb file |
||
| 80 | Test: 1b.1 ... passed |
||
| 81 | Test: 1b.2 ... passed |
||
| 82 | Suite: Step 4: Manipulating B-Tree cells |
||
| 83 | Test: 4.1 ... passed |
||
| 84 | Test: 4.2 ... passed |
||
| 85 | Test: 4.3 ... passed |
||
| 86 | Test: 4.4 ... passed |
||
| 87 | Suite: Step 5: Finding a value in a B-Tree |
||
| 88 | Test: 5.1 ... passed |
||
| 89 | Test: 5.2 ... passed |
||
| 90 | Suite: Step 6: Insertion into a leaf without splitting |
||
| 91 | Test: 6.1 ... passed |
||
| 92 | Test: 6.2 ... passed |
||
| 93 | Suite: Step 7: Insertion with splitting |
||
| 94 | Test: 7.1 ... passed |
||
| 95 | Test: 7.2 ... passed |
||
| 96 | Test: 7.3 ... passed |
||
| 97 | Suite: Step 8: Supporting index B-Trees |
||
| 98 | Test: 8.1 ... passed |
||
| 99 | Test: 8.2 ... passed |
||
| 100 | Test: 8.3 ... passed |
||
| 101 | |||
| 102 | --Run Summary: Type Total Ran Passed Failed |
||
| 103 | suites 12 12 n/a 0 |
||
| 104 | tests 48 48 48 0 |
||
| 105 | asserts 56611 56611 56611 0 |
||
| 106 | </pre> |