1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681
|
#include <test.h>
#include <cf3.defs.h>
#include <dbm_api.h>
#include <lastseen.h>
#include <item_lib.h>
#include <misc_lib.h> /* xsnprintf */
#include <known_dirs.h>
char CFWORKDIR[CF_BUFSIZE];
void UpdateLastSawHost(const char *hostkey, const char *address,
bool incoming, time_t timestamp);
/* For abbreviation of tests. */
#define IP1 "127.0.0.121"
#define IP2 "127.0.0.122"
#define IP3 "127.0.0.123"
#define KEY1 "SHA=key1"
#define KEY2 "SHA=key2"
#define KEY3 "SHA=key3"
#define ACC LAST_SEEN_ROLE_ACCEPT
#define DBHasStr(dbh, s) HasKeyDB(dbh, s, strlen(s)+1)
#define DBPutStr(dbh, k, s) WriteDB(dbh, k, s, strlen(s)+1)
char tmpbuf[CF_BUFSIZE];
#define DBGetStr(dbh, s) (ReadDB(dbh, s, tmpbuf, sizeof(tmpbuf)) ? tmpbuf : NULL)
static void tests_setup(void)
{
static char env[] = /* Needs to be static for putenv() */
"CFENGINE_TEST_OVERRIDE_WORKDIR=/tmp/lastseen_test.XXXXXX";
char *workdir = strchr(env, '=') + 1; /* start of the path */
assert(workdir - 1 && workdir[0] == '/');
mkdtemp(workdir);
strlcpy(CFWORKDIR, workdir, CF_BUFSIZE);
putenv(env);
mkdir(GetStateDir(), (S_IRWXU | S_IRWXG | S_IRWXO));
}
static void tests_teardown(void)
{
char cmd[CF_BUFSIZE];
xsnprintf(cmd, CF_BUFSIZE, "rm -rf '%s'", GetStateDir());
system(cmd);
xsnprintf(cmd, CF_BUFSIZE, "rm -rf '%s'", GetWorkDir());
system(cmd);
}
static void setup(void)
{
char cmd[CF_BUFSIZE];
xsnprintf(cmd, CF_BUFSIZE, "rm -rf '%s'/*", GetStateDir());
system(cmd);
}
static void test_newentry(void)
{
setup();
UpdateLastSawHost("SHA-12345", "127.0.0.64", true, 666);
DBHandle *db;
OpenDB(&db, dbid_lastseen);
KeyHostSeen q;
assert_int_equal(ReadDB(db, "qiSHA-12345", &q, sizeof(q)), true);
assert_false(q.acknowledged);
assert_int_equal(q.lastseen, 666);
assert_double_close(q.Q.q, 0.0);
assert_double_close(q.Q.dq, 0.0);
assert_double_close(q.Q.expect, 0.0);
assert_double_close(q.Q.var, 0.0);
assert_int_equal(ReadDB(db, "qoSHA-12345", &q, sizeof(q)), false);
char address[CF_BUFSIZE];
assert_int_equal(ReadDB(db, "kSHA-12345", address, sizeof(address)), true);
assert_string_equal(address, "127.0.0.64");
char hostkey[CF_BUFSIZE];
assert_int_equal(ReadDB(db, "a127.0.0.64", hostkey, sizeof(hostkey)), true);
assert_string_equal(hostkey, "SHA-12345");
CloseDB(db);
}
static void test_update(void)
{
setup();
UpdateLastSawHost("SHA-12345", "127.0.0.64", true, 555);
UpdateLastSawHost("SHA-12345", "127.0.0.64", true, 1110);
DBHandle *db;
OpenDB(&db, dbid_lastseen);
KeyHostSeen q;
assert_int_equal(ReadDB(db, "qiSHA-12345", &q, sizeof(q)), true);
assert_false(q.acknowledged);
assert_int_equal(q.lastseen, 1110);
assert_double_close(q.Q.q, 555.0);
assert_double_close(q.Q.dq, 555.0);
assert_double_close(q.Q.expect, 222.0);
assert_double_close(q.Q.var, 123210.0);
CloseDB(db);
}
static void test_HostkeyToAddress(void)
{
setup();
UpdateLastSawHost("SHA-12345", "127.0.0.64", true, 555);
char *address = HostkeyToAddress("SHA-12345");
assert_string_equal(address, "127.0.0.64");
free(address);
}
static void test_reverse_missing(void)
{
setup();
/* Check that resolution return false */
char result[CF_BUFSIZE];
assert_int_equal(Address2Hostkey(result, sizeof(result), "127.0.0.64"), false);
}
static void test_reverse_conflict(void)
{
setup();
UpdateLastSawHost("SHA-12345", "127.0.0.64", true, 555);
/* Overwrite reverse entry with different one. */
DBHandle *db;
OpenDB(&db, dbid_lastseen);
assert_int_equal(WriteDB(db, "a127.0.0.64", "SHA-98765", strlen("SHA-98765") + 1), true);
/* Check that resolution returns the last forced entry and is not bothered
* by the inconsistency (despite outputing a warning). */
char result[CF_BUFSIZE];
assert_int_equal(Address2Hostkey(result, sizeof(result), "127.0.0.64"), true);
assert_string_equal(result, "SHA-98765");
/* Both entries still exist despite inconsistency. */
assert_int_equal(DBHasStr(db, "a127.0.0.64"), true);
assert_int_equal(DBHasStr(db, "kSHA-12345"), true);
/* And the inconsistency (missing entry) is not auto-fixed... :-( */
assert_int_equal(DBHasStr(db, "kSHA-98765"), false);
CloseDB(db);
}
static void test_reverse_missing_forward(void)
{
setup();
UpdateLastSawHost("SHA-12345", "127.0.0.64", true, 555);
DBHandle *db;
OpenDB(&db, dbid_lastseen);
assert_int_equal(DeleteDB(db, "kSHA-12345"), true);
/* Check that resolution returns true despite the missing entry (a warning
* should be printed though). */
char result[CF_BUFSIZE];
assert_int_equal(Address2Hostkey(result, sizeof(result), "127.0.0.64"), true);
/* Entry still exists despite inconsistency. */
assert_int_equal(DBHasStr(db, "a127.0.0.64"), true);
/* And the inconsistency was not auto-fixed, entry is still missing. :-( */
assert_int_equal(DBHasStr(db, "kSHA-12345"), false);
CloseDB(db);
}
static void test_remove(void)
{
setup();
UpdateLastSawHost("SHA-12345", "127.0.0.64", true, 555);
UpdateLastSawHost("SHA-12345", "127.0.0.64", false, 556);
//RemoveHostFromLastSeen("SHA-12345");
DeleteDigestFromLastSeen("SHA-12345", NULL, 0, true);
DBHandle *db;
OpenDB(&db, dbid_lastseen);
assert_int_equal(HasKeyDB(db, "qiSHA-12345", strlen("qiSHA-12345") + 1), false);
assert_int_equal(HasKeyDB(db, "qoSHA-12345", strlen("qoSHA-12345") + 1), false);
assert_int_equal(HasKeyDB(db, "kSHA-12345", strlen("kSHA-12345") + 1), false);
assert_int_equal(HasKeyDB(db, "a127.0.0.64", strlen("a127.0.0.64") + 1), false);
CloseDB(db);
}
static void test_remove_no_a_entry(void)
{
setup();
UpdateLastSawHost("SHA-12345", "127.0.0.64", true, 555);
UpdateLastSawHost("SHA-12345", "127.0.0.64", false, 556);
DBHandle *db;
OpenDB(&db, dbid_lastseen);
assert_true(DeleteDB(db, "a127.0.0.64"));
assert_false(DeleteDigestFromLastSeen("SHA-12345", NULL, 0, true));
assert_true(DeleteDigestFromLastSeen("SHA-12345", NULL, 0, false));
assert_false(HasKeyDB(db, "qiSHA-12345", strlen("qiSHA-12345") + 1));
assert_false(HasKeyDB(db, "qoSHA-12345", strlen("qoSHA-12345") + 1));
assert_false(HasKeyDB(db, "kSHA-12345", strlen("kSHA-12345") + 1));
assert_false(HasKeyDB(db, "a127.0.0.64", strlen("a127.0.0.64") + 1));
CloseDB(db);
}
static void test_remove_ip(void)
{
setup();
UpdateLastSawHost("SHA-12345", "127.0.0.64", true, 555);
UpdateLastSawHost("SHA-12345", "127.0.0.64", false, 556);
char digest[CF_BUFSIZE];
DeleteIpFromLastSeen("127.0.0.64", digest, sizeof(digest));
DBHandle *db;
OpenDB(&db, dbid_lastseen);
assert_int_equal(HasKeyDB(db, "qiSHA-12345", strlen("qiSHA-12345") + 1), false);
assert_int_equal(HasKeyDB(db, "qoSHA-12345", strlen("qoSHA-12345") + 1), false);
assert_int_equal(HasKeyDB(db, "kSHA-12345", strlen("kSHA-12345") + 1), false);
assert_int_equal(HasKeyDB(db, "a127.0.0.64", strlen("a127.0.0.64") + 1), false);
CloseDB(db);
}
/* These tests can't be multi-threaded anyway. */
static DBHandle *DBH;
static void begin()
{
bool b = OpenDB(&DBH, dbid_lastseen);
assert_int_equal(b, true);
//*state = db;
}
static void end()
{
CloseDB(DBH);
DBH = NULL;
char cmd[CF_BUFSIZE];
xsnprintf(cmd, sizeof(cmd), "rm -rf '%s'/*", GetStateDir());
system(cmd);
}
/**
* ============== DB CONSISTENCY TESTS ===============
*
* @WARNING TO CODER: think twice before you change this test. Changing it to
* accommodate your needs means that you change what "consistent"
* lastseen database is. Lastseen consistency was transcribed as this
* test after a lot of late-hours pondering.
*
* Are you sure you want to continue? (y/n)
*/
/**
* ===== CONSISTENT CASES =====
*
*
* 1. Everything is as expected here.
*
* aIP1 -> KEY1
* kKEY1 -> IP1
* aIP2 -> KEY2
* kKEY2 -> IP2
*
* consistent_1a: Fill lastseen DB using the lastseen.h API.
* consistent_1b: Same, but fill lastseen DB directly by use of dbm_api.h API.
*
*
* 2. A host connecting from IP1, then connects from IP2.
*
* aIP1 -> KEY1
* aIP2 -> KEY1
* kKEY1 -> IP2
*
* consistent_2a: lastseen.h API.
* consistent_2b: dbm_api.h API.
*
*
* 3. The host at IP1 gets reinstalled and changes key from KEY1 to KEY2.
*
* aIP1 -> KEY2
* kKEY1 -> aIP1
* kKEY2 -> aIP1
*
* consistent_3a: lastseen.h API.
* consistent_3b: dbm_api.h API.
*
*
* 4. Many hosts can use the same key - a mess, but consistent
* (usecase by Bas van der Vlies in scientific clusters).
*
* aIP1 -> KEY1
* aIP2 -> KEY1
* aIP3 -> KEY1
* kKEY1 -> aIP1
*
*
* 5. Host connects from IP1 with KEY1, then changes address to IP2 keeps the
* same key, later changes key to KEY2.
*
* aIP1 -> KEY1
* aIP2 -> KEY2
* kKEY1 -> aIP2
* kKEY2 -> aIP2
*
*
* 6. Similar to previous but can't occur unless somebody restores an old key
* on a host. Still the db should be considered consistent.
*
* aIP1 -> KEY1
* aIP2 -> KEY1
* kKEY1 -> aIP2
* kKEY2 -> aIP2
*
*
* 7. Similarly messed-up but not inconsistent state.
*
* aIP1 -> KEY1
* aIP2 -> KEY1
* kKEY1 -> aIP2
* kKEY2 -> aIP1
*
*
*/
/* TODO assert the two DBs from "a" and "b" tests are exactly the same! */
static void test_consistent_1a()
{
LastSaw1(IP1, KEY1, ACC);
LastSaw1(IP2, KEY2, ACC);
assert_string_equal(DBGetStr(DBH, "a"IP1), KEY1);
assert_string_equal(DBGetStr(DBH, "a"IP2), KEY2);
assert_string_equal(DBGetStr(DBH, "k"KEY1), IP1);
assert_string_equal(DBGetStr(DBH, "k"KEY2), IP2);
assert_int_equal(IsLastSeenCoherent(), true);
}
static void test_consistent_1b()
{
assert_int_equal(DBPutStr(DBH, "a"IP1, KEY1), true);
assert_int_equal(DBPutStr(DBH, "k"KEY1, IP1), true);
assert_int_equal(DBPutStr(DBH, "a"IP2, KEY2), true);
assert_int_equal(DBPutStr(DBH, "k"KEY2, IP2), true);
assert_int_equal(IsLastSeenCoherent(), true);
}
static void test_consistent_2a()
{
LastSaw1(IP1, KEY1, ACC);
LastSaw1(IP2, KEY1, ACC);
assert_string_equal(DBGetStr(DBH, "a"IP1), KEY1);
assert_string_equal(DBGetStr(DBH, "a"IP2), KEY1);
assert_string_equal(DBGetStr(DBH, "k"KEY1), IP2);
assert_int_equal(IsLastSeenCoherent(), true);
}
static void test_consistent_2b()
{
assert_int_equal(DBPutStr(DBH, "a"IP1, KEY1), true);
assert_int_equal(DBPutStr(DBH, "a"IP2, KEY1), true);
assert_int_equal(DBPutStr(DBH, "k"KEY1, IP2), true);
assert_int_equal(IsLastSeenCoherent(), true);
}
static void test_consistent_3a()
{
LastSaw1(IP1, KEY1, ACC);
LastSaw1(IP1, KEY2, ACC);
assert_string_equal(DBGetStr(DBH, "a"IP1), KEY2);
assert_string_equal(DBGetStr(DBH, "k"KEY1), IP1);
assert_string_equal(DBGetStr(DBH, "k"KEY2), IP1);
assert_int_equal(IsLastSeenCoherent(), true);
}
static void test_consistent_3b()
{
assert_int_equal(DBPutStr(DBH, "a"IP1, KEY2), true);
assert_int_equal(DBPutStr(DBH, "k"KEY1, IP1), true);
assert_int_equal(DBPutStr(DBH, "k"KEY2, IP1), true);
assert_int_equal(IsLastSeenCoherent(), true);
}
static void test_consistent_4a()
{
LastSaw1(IP1, KEY1, ACC);
LastSaw1(IP2, KEY1, ACC);
LastSaw1(IP3, KEY1, ACC);
assert_string_equal(DBGetStr(DBH, "a"IP1), KEY1);
assert_string_equal(DBGetStr(DBH, "a"IP2), KEY1);
assert_string_equal(DBGetStr(DBH, "a"IP3), KEY1);
assert_string_equal(DBGetStr(DBH, "k"KEY1), IP3);
assert_int_equal(IsLastSeenCoherent(), true);
}
static void test_consistent_4b()
{
assert_int_equal(DBPutStr(DBH, "a"IP1, KEY1), true);
assert_int_equal(DBPutStr(DBH, "a"IP2, KEY1), true);
assert_int_equal(DBPutStr(DBH, "a"IP3, KEY1), true);
/* Just a bit different than what the lastseen API created in the 4a case,
* but still consistent. */
assert_int_equal(DBPutStr(DBH, "k"KEY1, IP1), true);
assert_int_equal(IsLastSeenCoherent(), true);
}
static void test_consistent_5a()
{
LastSaw1(IP1, KEY1, ACC);
LastSaw1(IP2, KEY1, ACC);
LastSaw1(IP2, KEY2, ACC);
assert_string_equal(DBGetStr(DBH, "a"IP1), KEY1);
assert_string_equal(DBGetStr(DBH, "a"IP2), KEY2);
assert_string_equal(DBGetStr(DBH, "k"KEY1), IP2);
assert_string_equal(DBGetStr(DBH, "k"KEY2), IP2);
assert_int_equal(IsLastSeenCoherent(), true);
}
static void test_consistent_5b()
{
assert_int_equal(DBPutStr(DBH, "a"IP1, KEY1), true);
assert_int_equal(DBPutStr(DBH, "a"IP2, KEY2), true);
assert_int_equal(DBPutStr(DBH, "k"KEY1, IP2), true);
assert_int_equal(DBPutStr(DBH, "k"KEY2, IP2), true);
assert_int_equal(IsLastSeenCoherent(), true);
}
static void test_consistent_6a()
{
LastSaw1(IP1, KEY1, ACC); /* initial bootstrap */
LastSaw1(IP2, KEY1, ACC); /* move to new IP */
LastSaw1(IP2, KEY2, ACC); /* issue new key */
LastSaw1(IP2, KEY1, ACC); /* restore old key */
assert_string_equal(DBGetStr(DBH, "a"IP1), KEY1);
assert_string_equal(DBGetStr(DBH, "a"IP2), KEY1);
assert_string_equal(DBGetStr(DBH, "k"KEY1), IP2);
assert_string_equal(DBGetStr(DBH, "k"KEY2), IP2);
assert_int_equal(IsLastSeenCoherent(), true);
}
static void test_consistent_6b()
{
assert_int_equal(DBPutStr(DBH, "a"IP1, KEY1), true);
assert_int_equal(DBPutStr(DBH, "a"IP2, KEY1), true);
assert_int_equal(DBPutStr(DBH, "k"KEY1, IP2), true);
assert_int_equal(DBPutStr(DBH, "k"KEY2, IP2), true);
assert_int_equal(IsLastSeenCoherent(), true);
}
/**
* @NOTE I haven't been able to get the consistent_7 case with regular
* dbm_api.h calls. Maybe it should be considered inconsistent state of
* the db?
*/
/*
static void test_consistent_7a()
{
LastSaw1(IP2, KEY1, ACC);
LastSaw1(IP1, KEY2, ACC);
LastSaw1(IP2, KEY1, ACC);
LastSaw1(IP1, KEY1, ACC);
assert_string_equal(DBGetStr(DBH, "a"IP1), KEY1);
assert_string_equal(DBGetStr(DBH, "a"IP2), KEY1);
assert_string_equal(DBGetStr(DBH, "k"KEY1), IP2);
assert_string_equal(DBGetStr(DBH, "k"KEY2), IP1);
assert_int_equal(IsLastSeenCoherent(), true);
}
*/
static void test_consistent_7b()
{
assert_int_equal(DBPutStr(DBH, "a"IP1, KEY1), true);
assert_int_equal(DBPutStr(DBH, "a"IP2, KEY1), true);
assert_int_equal(DBPutStr(DBH, "k"KEY1, IP2), true);
assert_int_equal(DBPutStr(DBH, "k"KEY2, IP1), true);
assert_int_equal(IsLastSeenCoherent(), true);
}
/**
* ===== INCONSISTENT CASES =====
* Should never happen if our software is bug-free!
*
*
* 1. KEY2 appears as a value but not "kKEY2" as a key.
*
* aIP1 -> KEY2
*
*
* 2. Same case, a bit more complex example.
*
* aIP1 -> KEY1
* aIP2 -> KEY2
* aKEY1 -> IP1
*
*
* 3. IP2 appears as a value but not "aIP2" as a key.
*
* kKEY1 -> IP2
*
*
* 4. Same case, a bit more complex example.
*
* aIP1 -> KEY1
* kKEY1 -> aIP1
* kKEY2 -> aIP2
*
*
* 5. The two previous cases at the same time!
*
* kKEY1 -> IP2
* aIP1 -> KEY2
*
*
* 6. Same, a bit more complex example.
*
* aIP1 -> KEY1
* aIP3 -> KEY2
* kKEY1 -> IP2
* kKEY3 -> IP2
*
*/
static void test_inconsistent_1()
{
assert_int_equal(DBPutStr(DBH, "a"IP1, KEY2), true);
assert_int_equal(IsLastSeenCoherent(), false);
}
static void test_inconsistent_2()
{
assert_int_equal(DBPutStr(DBH, "a"IP1, KEY1), true);
assert_int_equal(DBPutStr(DBH, "a"IP2, KEY2), true);
assert_int_equal(DBPutStr(DBH, "k"KEY1, IP1), true);
assert_int_equal(IsLastSeenCoherent(), false);
}
static void test_inconsistent_3()
{
assert_int_equal(DBPutStr(DBH, "k"KEY1, IP2), true);
assert_int_equal(IsLastSeenCoherent(), false);
}
static void test_inconsistent_4()
{
assert_int_equal(DBPutStr(DBH, "a"IP1, KEY1), true);
assert_int_equal(DBPutStr(DBH, "k"KEY1, IP1), true);
assert_int_equal(DBPutStr(DBH, "k"KEY2, IP2), true);
assert_int_equal(IsLastSeenCoherent(), false);
}
static void test_inconsistent_5()
{
assert_int_equal(DBPutStr(DBH, "k"KEY1, IP2), true);
assert_int_equal(DBPutStr(DBH, "a"IP1, KEY2), true);
assert_int_equal(IsLastSeenCoherent(), false);
}
static void test_inconsistent_6()
{
assert_int_equal(DBPutStr(DBH, "a"IP1, KEY1), true);
assert_int_equal(DBPutStr(DBH, "a"IP3, KEY2), true);
assert_int_equal(DBPutStr(DBH, "k"KEY1, IP2), true);
assert_int_equal(DBPutStr(DBH, "k"KEY3, IP2), true);
assert_int_equal(IsLastSeenCoherent(), false);
}
/* TODO run lastseen consistency checks after every cf-serverd *acceptance*
* test, deployment test, and stress test! */
int main()
{
tests_setup();
const UnitTest tests[] =
{
unit_test(test_newentry),
unit_test(test_update),
unit_test(test_HostkeyToAddress),
unit_test(test_reverse_missing),
unit_test(test_reverse_conflict),
unit_test(test_reverse_missing_forward),
unit_test(test_remove),
unit_test(test_remove_no_a_entry),
unit_test(test_remove_ip),
unit_test_setup_teardown(test_consistent_1a, begin, end),
unit_test_setup_teardown(test_consistent_1b, begin, end),
unit_test_setup_teardown(test_consistent_2a, begin, end),
unit_test_setup_teardown(test_consistent_2b, begin, end),
unit_test_setup_teardown(test_consistent_3a, begin, end),
unit_test_setup_teardown(test_consistent_3b, begin, end),
unit_test_setup_teardown(test_consistent_4a, begin, end),
unit_test_setup_teardown(test_consistent_4b, begin, end),
unit_test_setup_teardown(test_consistent_5a, begin, end),
unit_test_setup_teardown(test_consistent_5b, begin, end),
unit_test_setup_teardown(test_consistent_6a, begin, end),
unit_test_setup_teardown(test_consistent_6b, begin, end),
// unit_test_setup_teardown(test_consistent_7a, begin, end),
unit_test_setup_teardown(test_consistent_7b, begin, end),
unit_test_setup_teardown(test_inconsistent_1, begin, end),
unit_test_setup_teardown(test_inconsistent_2, begin, end),
unit_test_setup_teardown(test_inconsistent_3, begin, end),
unit_test_setup_teardown(test_inconsistent_4, begin, end),
unit_test_setup_teardown(test_inconsistent_5, begin, end),
unit_test_setup_teardown(test_inconsistent_6, begin, end),
};
PRINT_TEST_BANNER();
int ret = run_tests(tests);
tests_teardown();
return ret;
}
/* STUBS */
void FatalError(ARG_UNUSED char *s, ...)
{
fail();
exit(42);
}
pthread_mutex_t *cft_output;
char *HashPrintSafe(ARG_UNUSED char *dst, ARG_UNUSED size_t dst_size,
ARG_UNUSED const unsigned char *digest,
ARG_UNUSED HashMethod type, ARG_UNUSED bool use_prefix)
{
fail();
}
void HashPubKey(ARG_UNUSED const RSA *key,
ARG_UNUSED unsigned char digest[EVP_MAX_MD_SIZE + 1],
ARG_UNUSED HashMethod type)
{
fail();
}
|