aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2011-12-21 16:15:18 +0100
committerRaimo Niskanen <[email protected]>2011-12-21 16:15:18 +0100
commit4e0e77ea852ae9bd63308b37feb4ad72246a8932 (patch)
treec259ed4a5b0d4ac8163d68edaba4ef557b8624ce
parent2839bd40b0598b793e2038e2ed7068747905481e (diff)
downloadotp-4e0e77ea852ae9bd63308b37feb4ad72246a8932.tar.gz
otp-4e0e77ea852ae9bd63308b37feb4ad72246a8932.tar.bz2
otp-4e0e77ea852ae9bd63308b37feb4ad72246a8932.zip
prim_file_SUITE: large_file success depends on wordsize
Check VM wordsize to see if a driver command with data larger than 32-bit size is supposed to succeed. On wordsize 4 machines (32-bit) {error,einval} is expected since the total size passed to a driver can not exceed sizeof(ErlDrvSizeT).
-rw-r--r--lib/kernel/test/prim_file_SUITE.erl13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/kernel/test/prim_file_SUITE.erl b/lib/kernel/test/prim_file_SUITE.erl
index 831eadb04a..3e2202922c 100644
--- a/lib/kernel/test/prim_file_SUITE.erl
+++ b/lib/kernel/test/prim_file_SUITE.erl
@@ -1343,10 +1343,15 @@ do_large_write(Name) ->
Chunk = <<0:ChunkSize/unit:8>>,
Data = zip_data(lists:duplicate(Chunks, Chunk), Interleave),
Size = Chunks * ChunkSize + Chunks, % 4 G + 32
- ok = prim_file:write_file(Name, Data),
- {ok,#file_info{size=Size}} = file:read_file_info(Name),
- {ok,Fd} = prim_file:open(Name, [read]),
- check_large_write(Dog, Fd, ChunkSize, 0, Interleave).
+ Wordsize = erlang:system_info(wordsize),
+ case prim_file:write_file(Name, Data) of
+ ok when Wordsize =:= 8 ->
+ {ok,#file_info{size=Size}} = file:read_file_info(Name),
+ {ok,Fd} = prim_file:open(Name, [read]),
+ check_large_write(Dog, Fd, ChunkSize, 0, Interleave);
+ {error,einval} when Wordsize =:= 4 ->
+ ok
+ end.
check_large_write(Dog, Fd, ChunkSize, Pos, [X|Interleave]) ->
Pos1 = Pos + ChunkSize,