Skip to content

Commit

Permalink
add multithreaded save test
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Oct 24, 2020
1 parent f4ee837 commit c292520
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
environment:
JULIA_NUM_THREADS: 2
matrix:
- julia_version: 0.7
- julia_version: 1.0
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ julia:
- 1.0
- 1
- nightly
env:
- JULIA_NUM_THREADS=2
matrix:
allow_failures:
- julia: nightly
Expand Down
7 changes: 7 additions & 0 deletions test/loadsave.jl
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,13 @@ end # module Dummy
@test load(fn) == a
rm(fn)

if Threads.nthreads() > 1
Threads.@threads for i in 1:(Threads.nthreads() * 5)
fn = string(tempname(), ".dmy")
save(fn, a)
end
end

# force format
fn = string(tempname(), ".dmy")
savestreaming(format"DUMMY", fn) do writer
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ using FileIO
using FilePathsBase
using Test

Threads.nthreads() <= 1 && @info "Threads.nthreads() = $(Threads.nthreads()), multithread tests will be disabled"

# Both FileIO and FilePathsBase export filename, but we only want the FileIO definition.
using FileIO: filename

Expand Down

0 comments on commit c292520

Please sign in to comment.