Skip to content

Commit

Permalink
Add test group for testing from upstream (= Trixi.jl) (#7)
Browse files Browse the repository at this point in the history
* Do not reexport Trixi.jl

* Add Trixi as test dependency

* Add function that actually exercises Trixi
  • Loading branch information
sloede authored Nov 5, 2023
1 parent ffe28b8 commit 769078f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ authors = ["Andrew R. Winters <[email protected]>", "Michael Schlottke-
version = "0.1.0-pre"

[deps]
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Trixi = "a7f1ee26-1774-49b1-8366-f1abc58fbfcb"

[compat]
Reexport = "1"
Trixi = "0.5.17"
julia = "1.8"
7 changes: 2 additions & 5 deletions src/TrixiShallowWater.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
module TrixiShallowWater

# import @reexport now to make it available for further imports/exports
using Reexport: @reexport

# Make all of Trixi.jl available to a user of this package
@reexport using Trixi
using Trixi: Trixi

# Write your package code here.
foo() = true
bar() = false
baz() = Trixi.examples_dir()

end
4 changes: 4 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
[deps]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Trixi = "a7f1ee26-1774-49b1-8366-f1abc58fbfcb"

[compat]
Trixi = "0.5"
23 changes: 20 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
using TrixiShallowWater
using Test

@testset "TrixiShallowWater.jl" begin
@test TrixiShallowWater.foo() == true
@test TrixiShallowWater.bar() == false
# We run tests in parallel with CI jobs setting the `TRIXI_TEST` environment
# variable to determine the subset of tests to execute.
# By default, we just run the threaded tests since they are relatively cheap
# and test a good amount of different functionality.
const TRIXI_TEST = get(ENV, "TRIXI_TEST", "all")
const TRIXI_MPI_NPROCS = clamp(Sys.CPU_THREADS, 2, 3)
const TRIXI_NTHREADS = clamp(Sys.CPU_THREADS, 2, 3)

@time @testset "TrixiShallowWater.jl tests" begin
@time if TRIXI_TEST == "all"
@test TrixiShallowWater.foo() == true
@test TrixiShallowWater.bar() == false
@test TrixiShallowWater.baz() isa String
end

@time if TRIXI_TEST == "all" || TRIXI_TEST == "upstream"
@testset "baz()" begin
@test TrixiShallowWater.baz() isa String
end
end
end

0 comments on commit 769078f

Please sign in to comment.