Opened 10 years ago

Closed 10 years ago

#156 closed defect (fixed)

boolean tests failure

Reported by: jreed Owned by: jelte
Priority: medium Milestone:
Component: Unclassified Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity:
Sub-Project: Feature Depending on Ticket:
Estimated Difficulty: Add Hours to Ticket:
Total Hours: Internal?:


Opening this ticket to keep track of this.

Jelte provided various different patches to fix or to workaround this problem.

make  check-local
for pytest in ; do  echo Running test: $pytest ;  env PYTHONPATH=/home/reed/work/isc/bind10/svn/branches/trac153/src/lib/python  /usr/pkg/bin/python3.1 $pytest ;  done
Running test:
Ran 7 tests in 0.005s

Running test:
Ran 10 tests in 0.010s

Running test:
FAIL: test_to_wire_of_bool_false (__main__.TestCCWireEncoding)
Traceback (most recent call last):
  File "", line 87, in test_to_wire_of_bool_false
    self.assertEqual(wire, b'Skan\x04bool%\x01\x00')
AssertionError: b'Skan\x04bool%\x010' != b'Skan\x04bool%\x01\x00'

FAIL: test_to_wire_of_bool_true (__main__.TestCCWireEncoding)
Traceback (most recent call last):
  File "", line 83, in test_to_wire_of_bool_true
    self.assertEqual(wire, b'Skan\x04bool%\x01\x01')
AssertionError: b'Skan\x04bool%\x011' != b'Skan\x04bool%\x01\x01'

Ran 21 tests in 0.007s

FAILED (failures=2)
*** Error code 1

make: stopped in /home/reed/work/isc/bind10/svn/branches/trac153/src/lib/python/isc/cc/tests
*** Error code 1


Attachments (1)

bool_wire_format.patch (1.5 KB) - added by jelte 10 years ago.

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by jelte

comment:1 Changed 10 years ago by jelte

The tests expect the boolean representation to be 0x00 and 0x01, while the python code makes it the ascii value of '0' and '1' (and accepts both). I looked at the c++ code and it apparently wasn't consistent there either.

Attached patch irons this out (i chose the ascii value, our tests use strings and 0x00 isn't really a fun value in null-terminated strings).

After we resolve ticket #155 we can revisit this choice imo (also dependent on the discussion on whether we should have wireformat for boolean in the first place).

comment:2 Changed 10 years ago by jreed

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

I committed this workaround in revision 1765. I assign to jelte to take what ever action is needed later for correct fix. (Maybe other ticket #155 is good enough and this ticket can be closed.)

comment:3 Changed 10 years ago by jelte

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

The fix is good (for now), tests deferred to ticket #155 (which will probably be closed if we go to JSON, unless we need these tests for that too).

Note: See TracTickets for help on using tickets.