Skip to content

Commit

Permalink
Add missing import for Mmap (#515)
Browse files Browse the repository at this point in the history
* import Mmap

* add Mmap to _Project.toml

* add test for readmmap
  • Loading branch information
tknopp authored and musm committed Sep 7, 2018
1 parent 702743b commit ad5f958
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions _Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ BinDeps = "9e28174c-4ba2-5203-b857-d8d62c4213ee"
Blosc = "a74b3585-a348-5f62-a45c-50e91977d574"
Homebrew = "d9be37ee-ecc9-5288-90f1-b9ca67657a75"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
Mmap = "a63ad114-7e13-5084-954f-fe012c677804"
WinRPM = "c17dfb99-b4f7-5aad-8812-456da1ad7187"

[extras]
Expand Down
1 change: 1 addition & 0 deletions src/HDF5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Base:
setindex!, show, size, sizeof, write, isopen, iterate

import Libdl
import Mmap

export
# types
Expand Down
23 changes: 23 additions & 0 deletions test/mmap.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using HDF5
using Test

@testset "mmap" begin

# Create a new file
fn = tempname()
f = h5open(fn, "w")
@test isopen(f)

# Write HDF5 file
hdf5_A = d_create(f,"A",datatype(Int64),dataspace(3,3));
A = rand(Int64,3,3)
hdf5_A[:,:] = A
flush(f);
close(f);
# Read HDF5 file & MMAP
f = h5open(fn,"r");
A_mmaped = readmmap(f["A"]);

@test all(A .== A_mmaped)

end
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ include("extend_test.jl")
include("gc.jl")
include("external.jl")
include("swmr.jl")
if !Sys.iswindows() # Mmap needs to be fixed on windows
include("mmap.jl")
end
if get(Pkg.installed(), "MPI", nothing) !== nothing
# basic MPI tests, for actual parallel tests we need to run in MPI mode
include("mpio.jl")
Expand Down

0 comments on commit ad5f958

Please sign in to comment.