|
@@ -1,4 +1,4 @@
|
|
|
-import os, sys, mmap, random, string, binascii
|
|
|
+import os, sys, mmap, random, string
|
|
|
from regression import Regression
|
|
|
|
|
|
loader = os.environ['PAL_LOADER']
|
|
@@ -10,7 +10,7 @@ def prepare_files(args):
|
|
|
if os.path.exists("file_nonexist.tmp"):
|
|
|
os.remove("file_nonexist.tmp")
|
|
|
|
|
|
- with open("file_delete.tmp", "w") as f:
|
|
|
+ with open("file_delete.tmp", "wb") as f:
|
|
|
f.write(file_exist)
|
|
|
|
|
|
# Running File
|
|
@@ -27,13 +27,13 @@ regression.add_check(name="Basic File Creation",
|
|
|
"File Creation Test 3 OK" in res[0].log)
|
|
|
|
|
|
regression.add_check(name="File Reading",
|
|
|
- check=lambda res: ("Read Test 1 (0th - 40th): " + binascii.hexlify(file_exist[0:40])) in res[0].log and
|
|
|
- ("Read Test 2 (0th - 40th): " + binascii.hexlify(file_exist[0:40])) in res[0].log and
|
|
|
- ("Read Test 3 (200th - 240th): " + binascii.hexlify(file_exist[200:240])) in res[0].log)
|
|
|
+ check=lambda res: ("Read Test 1 (0th - 40th): " + file_exist[0:40].hex()) in res[0].log and
|
|
|
+ ("Read Test 2 (0th - 40th): " + file_exist[0:40].hex()) in res[0].log and
|
|
|
+ ("Read Test 3 (200th - 240th): " + file_exist[200:240].hex()) in res[0].log)
|
|
|
|
|
|
def check_write(res):
|
|
|
global file_exist
|
|
|
- with open("file_nonexist.tmp", "r") as f:
|
|
|
+ with open("file_nonexist.tmp", "rb") as f:
|
|
|
file_nonexist = f.read()
|
|
|
return file_exist[0:40] == file_nonexist[200:240] and \
|
|
|
file_exist[200:240] == file_nonexist[0:40]
|
|
@@ -47,11 +47,10 @@ regression.add_check(name="File Attribute Query by Handle",
|
|
|
check=lambda res: ("Query by Handle: type = 1, size = %d" % (len(file_exist))) in res[0].log)
|
|
|
|
|
|
regression.add_check(name="File Mapping",
|
|
|
- check=lambda res: ("Map Test 1 (0th - 40th): " + binascii.hexlify(file_exist[0:40])) in res[0].log and
|
|
|
- ("Map Test 2 (200th - 240th): " + binascii.hexlify(file_exist[200:240])) in res[0].log and
|
|
|
- ("Map Test 3 (4096th - 4136th): " + binascii.hexlify(file_exist[4096:4136])) in res[0].log and
|
|
|
- ("Map Test 4 (4296th - 4336th): " +
|
|
|
- binascii.hexlify(file_exist[4296:4336])) in res[0].log)
|
|
|
+ check=lambda res: ("Map Test 1 (0th - 40th): " + file_exist[0:40].hex()) in res[0].log and
|
|
|
+ ("Map Test 2 (200th - 240th): " + file_exist[200:240].hex()) in res[0].log and
|
|
|
+ ("Map Test 3 (4096th - 4136th): " + file_exist[4096:4136].hex()) in res[0].log and
|
|
|
+ ("Map Test 4 (4296th - 4336th): " + file_exist[4296:4336].hex()) in res[0].log)
|
|
|
|
|
|
regression.add_check(name="Set File Length",
|
|
|
check=lambda res: os.stat("file_nonexist.tmp").st_size == mmap.ALLOCATIONGRANULARITY)
|