Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 0.7 #13

Merged
merged 3 commits into from
Aug 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ os:
- linux
- osx
julia:
- 0.6
- 0.7
- 1.0
- nightly
notifications:
email: false
Expand All @@ -14,4 +15,4 @@ notifications:
# - julia -e 'Pkg.clone(pwd()); Pkg.build("ComputationalResources"); Pkg.test("ComputationalResources"; coverage=true)'
after_success:
# push coverage results to Codecov
- julia -e 'cd(Pkg.dir("ComputationalResources")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
- julia -e 'using Pkg, ComputationalResources; cd(joinpath(pathof(ComputationalResources)), "..")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ argument (conventionally, the first argument) to a function, where
optionally store additional settings that you can customize; for
example you could define a `TimeOut` type:

```jl
immutable TimeOut
```julia
struct TimeOut
seconds::Float64
end
```
Expand Down Expand Up @@ -88,8 +88,6 @@ test/
where `...` means additional files. `Dummy.jl` might start like this:

```julia
__precompile__() # precompilation is allowed

module Dummy

using ComputationalResources
Expand Down Expand Up @@ -125,8 +123,6 @@ end
Your `DummyAF` module is implemented in `DummyAF.jl`, which might look like this:

```julia
__precompile__()

module DummyAF

using ComputationalResources, Dummy, ArrayFire
Expand Down
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
julia 0.6
julia 0.7
2 changes: 0 additions & 2 deletions src/ComputationalResources.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
__precompile__()

module ComputationalResources

export
Expand Down
2 changes: 0 additions & 2 deletions test/packages/Dummy1/src/Dummy1.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
__precompile__()

module Dummy1

using ComputationalResources
Expand Down
2 changes: 0 additions & 2 deletions test/packages/Dummy1/src/Dummy1AF.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
__precompile__()

module Dummy1AF

using ComputationalResources, Dummy1
Expand Down
58 changes: 31 additions & 27 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
using ComputationalResources
using Base.Test

for r in (CPU1(5), CPUThreads(5), ArrayFireLibs(5), CUDALibs(5), OpenCLLibs(5))
for T in (CPU1, CPUThreads, ArrayFireLibs, CUDALibs, OpenCLLibs)
r1 = T(r)
@test r1.settings === 5
using Test

@testset "ComputationalResources" begin
@testset "Settings" begin
for r in (CPU1(5), CPUThreads(5), ArrayFireLibs(5), CUDALibs(5), OpenCLLibs(5))
for T in (CPU1, CPUThreads, ArrayFireLibs, CUDALibs, OpenCLLibs)
r1 = T(r)
@test r1.settings === 5
end
end

@test isa(CPUThreads(), AbstractCPU{Nothing})
@test isa(CUDALibs(), AbstractResource{Nothing})
@test isa(OpenCLLibs(), AbstractResource{Nothing})
end
end

push!(LOAD_PATH, joinpath(dirname(@__FILE__), "packages"))

import Dummy1
@testset "Dummy1" begin
push!(LOAD_PATH, joinpath(dirname(@__FILE__), "packages"))

@test Dummy1.foo(CPU1())
@test_throws MethodError Dummy1.foo(ArrayFireLibs())
@eval import Dummy1

addresource(ArrayFireLibs)
@test haveresource(ArrayFireLibs)
@test Dummy1.foo(CPU1())
@test_throws MethodError Dummy1.foo(ArrayFireLibs())

reload("Dummy1")
addresource(ArrayFireLibs)
@test haveresource(ArrayFireLibs)

@test Dummy1.foo(CPU1())
@test Dummy1.foo(ArrayFireLibs())
Main.Dummy1.__init__()

rmresource(ArrayFireLibs)
@test Main.Dummy1.foo(CPU1())
@test Main.Dummy1.foo(ArrayFireLibs())

reload("Dummy1")
rmresource(ArrayFireLibs)

@test Dummy1.foo(CPU1())
@test_throws MethodError Dummy1.foo(ArrayFireLibs())
include("packages/Dummy1/src/Dummy1.jl")

pop!(LOAD_PATH)
@test Main.Dummy1.foo(CPU1())
@test_throws MethodError Main.Dummy1.foo(ArrayFireLibs())

@test isa(CPUThreads(), AbstractCPU{Void})
@test isa(CUDALibs(), AbstractResource{Void})
@test isa(OpenCLLibs(), AbstractResource{Void})

nothing
pop!(LOAD_PATH)
end
end