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?:

Description

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 data_test.py session_test.py test.py ; 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: data_test.py
.......
----------------------------------------------------------------------
Ran 7 tests in 0.005s

OK
Running test: session_test.py
..........
----------------------------------------------------------------------
Ran 10 tests in 0.010s

OK
Running test: test.py
...........FF........
======================================================================
FAIL: test_to_wire_of_bool_false (__main__.TestCCWireEncoding)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", 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 "test.py", 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

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

Subtickets

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.