]> granicus.if.org Git - pdns/commitdiff
Allow running the edns1 test on python 3
authorPieter Lexis <pieter.lexis@powerdns.com>
Wed, 21 Mar 2018 14:43:06 +0000 (15:43 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Wed, 30 May 2018 08:00:51 +0000 (10:00 +0200)
regression-tests.nobackend/edns1/test-edns.py

index d7ab3eb098ee591dd5018e32f790f879a16347e6..b71d1a67949b2c15e3aee469d20d017b60bce3fb 100755 (executable)
@@ -1,8 +1,9 @@
 #!/usr/bin/env python
 
+from __future__ import print_function
 import socket
 
-MESSAGE="\xaf\x03\x00\x20\x00\x01\x00\x00\x00\x00\x00\x01\x04\x75\x6e\x69\x74\x04\x74\x65\x73\x74\x00\x00\x06\x00\x01\x00\x00\x29\x10\x00\x00\x64\x00\x00\x00\x10\x00\x0a\x00\x08\x39\x70\xad\xaf\xca\xa8\x96\xca\x00\x64\x00\x00"
+MESSAGE=b"\xaf\x03\x00\x20\x00\x01\x00\x00\x00\x00\x00\x01\x04\x75\x6e\x69\x74\x04\x74\x65\x73\x74\x00\x00\x06\x00\x01\x00\x00\x29\x10\x00\x00\x64\x00\x00\x00\x10\x00\x0a\x00\x08\x39\x70\xad\xaf\xca\xa8\x96\xca\x00\x64\x00\x00"
 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 
 sock.bind(("127.0.0.1",5502))
@@ -11,9 +12,9 @@ sock.sendto(MESSAGE, ("127.0.0.1", 5501))
 data, addr = sock.recvfrom(512)
 
 # make sure data is correct
-EXPECT="\xaf\x03\x84\x00\x00\x01\x00\x00\x00\x00\x00\x01\x04\x75\x6e\x69\x74\x04\x74\x65\x73\x74\x00\x00\x06\x00\x01\x00\x00\x29\x06\x90\x01\x00\x00\x00\x00\x00"
+EXPECT=b"\xaf\x03\x84\x00\x00\x01\x00\x00\x00\x00\x00\x01\x04\x75\x6e\x69\x74\x04\x74\x65\x73\x74\x00\x00\x06\x00\x01\x00\x00\x29\x06\x90\x01\x00\x00\x00\x00\x00"
 
 if (data != EXPECT):
-  print "Invalid EDNS response, expected extended RCODE=BADVERS, no SOA, and OPT version 0"
+  print("Invalid EDNS response, expected extended RCODE=BADVERS, no SOA, and OPT version 0")
 else:
-  print "EDNS response OK"
+  print("EDNS response OK")