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

Reorganizing testing #7

Merged
merged 4 commits into from
Jul 19, 2019
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
/dev/
/deps/usr
/deps/build.log
/deps/build_script.jl
/deps/build_*.jl
/deps/deps.jl
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version = "0.1.0"
BinaryProvider = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
CxxWrap = "1f15a43c-97ca-5a2a-ae31-89f07a497df4"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"

[compat]
julia = "1"
Expand Down
7 changes: 4 additions & 3 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
# Order matters, because dependency checks
dependencies = [
"https://github.com/JuliaPackaging/JuliaBuilder/releases/download/v1.0.0-2/build_Julia.v1.0.0.jl",
"https://github.com/JuliaInterop/libcxxwrap-julia/releases/download/v0.5.1/build_libcxxwrap-julia-1.0.v0.5.1.jl",
"https://github.com/TeroFrondelius/tfelBuilder/releases/download/v0.1.0/build_tfel_binaries.v3.2.1-master.jl",
"https://github.com/JuliaInterop/libcxxwrap-julia/releases/download/v0.5.3/build_libcxxwrap-julia-1.0.v0.5.3.jl",
"https://github.com/TeroFrondelius/tfelBuilder/releases/download/v0.3.0/build_tfel_binaries.v3.2.1-master.jl",
"https://github.com/TeroFrondelius/mgisBuilder/releases/download/v0.2.0/build_mgis_binaries.v1.0.0-master.jl"
]

for build_script in dependencies
include(download(build_script,"build_script.jl"))
script_name = split(build_script,"/")[end]
include(download(build_script,script_name))
end
18 changes: 14 additions & 4 deletions src/MFrontInterface.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
module MFrontInterface
const lpath = abspath(joinpath(dirname(Base.find_package("MFrontInterface")),"..","deps","usr","lib"))
import Libdl
if Sys.iswindows()
const lpath = abspath(joinpath(dirname(Base.find_package("MFrontInterface")),"..","deps","usr","bin"))
else
const lpath = abspath(joinpath(dirname(Base.find_package("MFrontInterface")),"..","deps","usr","lib"))
end

using CxxWrap
@wrapmodule(joinpath(lpath,"mgis-julia.so"),:define_mgis_module)
@wrapmodule(joinpath(lpath,"mgis-julia." * Libdl.dlext),:define_mgis_module)
function __init__()
@initcxx
end

module behaviour
const lpath = abspath(joinpath(dirname(Base.find_package("MFrontInterface")),"..","deps","usr","lib"))
if Sys.iswindows()
const lpath = abspath(joinpath(dirname(Base.find_package("MFrontInterface")),"..","deps","usr","bin"))
else
const lpath = abspath(joinpath(dirname(Base.find_package("MFrontInterface")),"..","deps","usr","lib"))
end
using CxxWrap
@wrapmodule(joinpath(lpath,"mgis-julia.so"),:define_mgis_behaviour_module)
import Libdl
@wrapmodule(joinpath(lpath,"mgis-julia." * Libdl.dlext),:define_mgis_behaviour_module)
function __init__()
@initcxx
end
Expand Down
Binary file modified test/data/libBehaviour.so
Binary file not shown.
15 changes: 9 additions & 6 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
using MFrontInterface
using DelimitedFiles
using Test
lpath = MFrontInterface.lpath

lpath = abspath(joinpath(dirname(Base.find_package("MFrontInterface")),"..","deps","usr"))
# shorten namespace name
mbv = MFrontInterface.behaviour

# comparison criterion
eps = 1.e-12

@testset "MFrontInterface.jl" begin
@testset "Binary dependencies" begin
@test isfile(joinpath(lpath,"lib","mgis-julia.so"))
@test isfile(joinpath(lpath,"lib","libMFrontGenericInterface.so"))
@test isfile(joinpath(lpath,"bin","mfront"))
include("test_binary_dependencies.jl")
if Sys.islinux()
include("test_norton_model.jl")
end
include("test_norton_model.jl")
end
13 changes: 13 additions & 0 deletions test/test_binary_dependencies.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@testset "Binary dependencies" begin
if Sys.iswindows()
lpath = abspath(joinpath(dirname(Base.find_package("MFrontInterface")),"..","deps","usr","bin"))
@test isfile(joinpath(lpath,"mgis-julia.dll"))
@test isfile(joinpath(lpath,"libMFrontGenericInterface.dll"))
@test isfile(joinpath(lpath,"mfront.exe"))
else
lpath = abspath(joinpath(dirname(Base.find_package("MFrontInterface")),"..","deps","usr"))
@test isfile(joinpath(lpath,"lib","mgis-julia.so"))
@test isfile(joinpath(lpath,"lib","libMFrontGenericInterface.so"))
@test isfile(joinpath(lpath,"bin","mfront"))
end
end
6 changes: 0 additions & 6 deletions test/test_norton_model.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
@testset "Norton model" begin

# shorten namespace name
mbv = MFrontInterface.behaviour

# comparison criterion
eps = 1.e-12

b = load("data/libBehaviour.so","Norton", mbv.Tridimensional)

d = BehaviourData(b)
Expand Down