Opened 8 years ago

Closed 8 years ago

#1812 closed defect (fixed)

HashTest tests fail on OpenBSD

Reported by: muks Owned by: muks
Priority: medium Milestone: Sprint-20120320
Component: Unclassified Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: DNS Feature Depending on Ticket:
Estimated Difficulty: 0 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no

Description

HashTest? tests fail on OpenBSD 5.0 (x86_64):

[ RUN ] HashTest.Algorithm
hash_unittest.cc:96: Failure
Expected: (newsize + 2) >= (cursize), actual: 3 vs 50
[ FAILED ] HashTest.Algorithm (6 ms)

[ RUN ] HashTest.MixedCase
hash_unittest.cc:130: Failure
Expected: (value1) != (value2), actual: 0 vs 0
[ FAILED ] HashTest.MixedCase (2 ms)

[ RUN ] HashTest.ClassCodes
hash_unittest.cc:171: Failure
Expected: (newsize + 2) >= (cursize), actual: 3 vs 10
[ FAILED ] HashTest.ClassCodes (2 ms)

Subtickets

Change History (7)

comment:1 Changed 8 years ago by muks

  • Owner set to muks
  • Status changed from new to assigned

Assigning to myself

comment:2 Changed 8 years ago by muks

  • Milestone changed from New Tasks to Sprint-DHCP-20120319

Adding to current milestone.

comment:3 Changed 8 years ago by muks

  • Milestone changed from Sprint-DHCP-20120319 to Sprint-20120320

comment:4 Changed 8 years ago by muks

  • Owner changed from muks to UnAssigned
  • Status changed from assigned to reviewing

Ready for review.

comment:5 Changed 8 years ago by muks

Btw, the tests fail because random() always returns 0 on OpenBSD 5.0, when the RNG is initialized with srandom(0).

Here is a testcase:

#include <stdio.h>
#include <stdlib.h>

int
main (int argc, char *argv[])
{
  int i;

  srandom (0);

  for (i = 0; i < 32; i++)
    printf ("%ld\n", random());

  return 0;
}

This prints all 0s on OpenBSD, and random values on Linux.

comment:6 Changed 8 years ago by jelte

  • Owner changed from UnAssigned to muks

I removed one newline there (before the else), but this solution seems fine to me, it can be merged

comment:7 Changed 8 years ago by muks

  • Resolution set to fixed
  • Status changed from reviewing to closed

Pushed to master:

* 3dfd3b2 [1812] remove newline
* 7b7252d [1812] Initialize srandom() with seed other than 0 when not using a random seed

Resolving bug as fixed.

Note: See TracTickets for help on using tickets.