Skip to content

Commit d389974

Browse files
authored
Merge pull request #196 from JuliaGeodynamics/pa-PTR_switch
[TESTING] Switch to ParallelTestRunner.jl
2 parents adcb95b + 649cfda commit d389974

8 files changed

Lines changed: 35 additions & 121 deletions

File tree

.github/workflows/CI.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,14 @@ jobs:
5656
version: '1.12'
5757
allow_failure: true
5858
steps:
59-
- uses: actions/checkout@v4
59+
- uses: actions/checkout@v6
6060
- uses: julia-actions/setup-julia@v2
6161
with:
6262
version: ${{ matrix.version }}
6363
arch: ${{ matrix.arch }}
64-
- uses: actions/cache@v4
65-
env:
66-
cache-name: cache-artifacts
64+
- uses: julia-actions/cache@v2
6765
with:
68-
path: ~/.julia/artifacts
69-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
70-
restore-keys: |
71-
${{ runner.os }}-test-${{ env.cache-name }}-
72-
${{ runner.os }}-test-
73-
${{ runner.os }}-
66+
include-matrix: false
7467
- uses: julia-actions/julia-buildpkg@latest
7568
- uses: julia-actions/julia-runtest@latest
7669
- uses: julia-actions/julia-processcoverage@v1

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "GeophysicalModelGenerator"
22
uuid = "3700c31b-fa53-48a6-808a-ef22d5a84742"
3+
version = "0.7.17"
34
authors = ["Boris Kaus", "Marcel Thielmann"]
4-
version = "0.7.16"
55

66
[deps]
77
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
@@ -22,6 +22,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
2222
MeshIO = "7269a6da-0436-5bbc-96c2-40638cbb6118"
2323
NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
2424
NearestNeighbors = "b8a86587-4115-5ab1-83bc-aa920d37bbce"
25+
ParallelTestRunner = "d3525ed8-44d0-4b2c-a655-542cee43accc"
2526
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
2627
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
2728
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
@@ -65,6 +66,7 @@ LightXML = "0.8, 0.9"
6566
MeshIO = "0.1 - 0.5"
6667
NCDatasets = "0.14"
6768
NearestNeighbors = "0.2 - 0.4"
69+
ParallelTestRunner = "2"
6870
Parameters = "0.9 - 0.12"
6971
SpecialFunctions = "1.0, 2"
7072
StaticArrays = "1"

ext/Gmsh_utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Reads a Gmsh file and returns a `FEData` object with info about the mesh. `tag_n
1414
"""
1515
function import_Gmsh(fname::String)
1616

17-
mesh = GmshDiscreteModel(fname, renumber = false)
17+
mesh = GmshDiscreteModel(fname, renumber = false, has_affine_map = false)
1818

1919
# Extract vertices
2020
nverts = length(mesh.grid.node_coordinates)

src/IO.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ GeoData
5959
"""
6060
function load_GMG(filename::String, dir = pwd(); maxattempts = 5)
6161

62-
local_filename = "download_GMG_temp.jld2"
62+
local_filename = "download_GMG_temp_$(getpid()).jld2"
6363
if contains(filename, "http")
6464
file_ext = download_data(filename, local_filename, dir = dir, maxattempts = maxattempts)
6565
else
@@ -72,7 +72,7 @@ function load_GMG(filename::String, dir = pwd(); maxattempts = 5)
7272

7373
# remove local temporary file
7474
if contains(filename, "http")
75-
rm(local_filename)
75+
rm(joinpath(dir, local_filename), force = true)
7676
end
7777

7878
return data
@@ -118,4 +118,4 @@ function download_data(url::String, local_filename = "temp.dat"; dir = pwd(), ma
118118
end
119119

120120
return file_ext
121-
end
121+
end

src/ProfileProcessing.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ function create_profile_screenshot!(Profile::ProfileData, DataSet::NamedTuple)
299299
x_profile = flatten_cross_section(data_tmp, Start = Profile.start_lonlat) # compute the distance along the profile
300300
data_tmp = addfield(data_tmp, "x_profile", x_profile)
301301

302-
# add the data set as a NamedTuple
302+
# add the data set as a NamedTuple
303303
data_NT = NamedTuple{(DataSetName[idata],)}((data_tmp,))
304304
tmp = merge(tmp, data_NT)
305305
else
@@ -414,8 +414,6 @@ function extract_ProfileData!(Profile::ProfileData, VolData::Union{Nothing, GeoD
414414
end
415415

416416

417-
418-
419417
"""
420418
This reads the picked profiles from disk and returns a vector of ProfileData
421419
"""

src/data_import.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,15 +366,15 @@ function tomo_2_GeoData(filename::String; vel_type::String = "vs")
366366

367367
# Extract the variables
368368
depth = data["depth"][:]
369-
lon = data["longitude"][:]
370-
lat = data["latitude"][:]
371-
vel = data[vel_type][:,:,:]
369+
lon = data["longitude"][:]
370+
lat = data["latitude"][:]
371+
vel = data[vel_type][:, :, :]
372372

373373
# create lon, lat, depth grid
374374
Lon, Lat, Depth = lonlatdepth_grid(lon, lat, .- depth)
375375

376376
# create GeoData struct
377-
Tomo_data = GeoData(Lon, Lat, Depth, (vel=vel,))
377+
Tomo_data = GeoData(Lon, Lat, Depth, (vel = vel,))
378378

379379
return Tomo_data
380-
end
380+
end

test/runtests.jl

Lines changed: 18 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,25 @@
11
using GeophysicalModelGenerator
2-
using Test
2+
using ParallelTestRunner
33

4-
@testset verbose = true "GeophysicalModelGenerator" begin
4+
testsuite = find_tests(@__DIR__)
55

6-
@testset "Data import.jl" begin
7-
include("test_data_import.jl")
8-
end
9-
@testset "Data types.jl" begin
10-
include("test_data_types.jl")
11-
end
12-
@testset "Paraview" begin
13-
include("test_paraview.jl")
14-
end
15-
@testset "Paraview collection" begin
16-
include("test_paraview_collection.jl")
17-
end
18-
@testset "Gravity model" begin
19-
include("test_voxel_gravity.jl")
20-
end
21-
@testset "Nearest points" begin
22-
include("test_nearest_points.jl")
23-
end
24-
@testset "Utils" begin
25-
include("test_utils.jl")
26-
end
27-
@testset "Transformations" begin
28-
include("test_transformation.jl")
29-
end
30-
@testset "Surfaces" begin
31-
include("test_surfaces.jl")
32-
end
33-
34-
@testset "LaMEM" begin
35-
include("test_lamem.jl")
36-
end
37-
38-
@testset "pTatin" begin
39-
include("test_pTatin_IO.jl")
40-
end
41-
42-
@testset "SetupGeometry" begin
43-
include("test_setup_geometry.jl")
44-
end
45-
46-
@testset "STL" begin
47-
include("test_stl.jl")
48-
end
49-
50-
@testset "IO" begin
51-
include("test_IO.jl")
52-
end
53-
54-
@testset "ProfileProcessing" begin
55-
include("test_ProfileProcessing.jl")
56-
end
57-
58-
@testset "GMT integration" begin
59-
include("test_GMT.jl")
60-
end
61-
62-
@testset "Gmsh integration" begin
63-
include("test_Gmsh.jl")
64-
end
65-
66-
@testset "Event counts" begin
67-
include("test_event_counts.jl")
68-
end
69-
@testset "Create movie" begin
70-
include("test_create_movie.jl")
71-
end
72-
73-
@testset "Sea level" begin
74-
include("test_sea_level.jl")
75-
end
76-
77-
@testset "Ridge Thermal Structure Tests" begin
78-
include("test_ridge_segments.jl")
79-
end
80-
81-
@testset "Plate Tests" begin
82-
include("test_plate.jl")
83-
end
84-
85-
@testset "Waterflow" begin
86-
include("test_WaterFlow.jl")
87-
end
88-
89-
@testset "ASAGI_IO" begin
90-
include("test_ASAGI_IO.jl")
6+
# Add `using GeophysicalModelGenerator` to each test
7+
for (name, expr) in testsuite
8+
if name != "test_tutorials" # Tutorials are standalone
9+
testsuite[name] = quote
10+
using GeophysicalModelGenerator
11+
$expr
12+
end
9113
end
14+
end
9215

93-
@testset "Chmy" begin
94-
include("test_Chmy.jl")
16+
try
17+
ParallelTestRunner.runtests(GeophysicalModelGenerator, ARGS; testsuite)
18+
finally
19+
# Cleanup
20+
foreach(f -> rm(joinpath(@__DIR__, f)), filter(endswith(".vts"), readdir(@__DIR__)))
21+
foreach(f -> rm(joinpath(@__DIR__, f)), filter(endswith(".vtu"), readdir(@__DIR__)))
22+
if isdir(joinpath(@__DIR__, "markers"))
23+
rm(joinpath(@__DIR__, "markers"), recursive = true)
9524
end
9625
end
97-
98-
# Include tutorials
99-
include("test_tutorials.jl")
100-
101-
# Cleanup
102-
foreach(rm, filter(endswith(".vts"), readdir()))
103-
foreach(rm, filter(endswith(".vtu"), readdir()))
104-
rm("./markers/", recursive = true)

test/test_setup_geometry.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# test setting geometries in the different grid types
2-
using Test, GeophysicalModelGenerator, GeoParams
2+
using Test, GeophysicalModelGenerator, GeoParams, Statistics
33

44
# GeoData
55
Lon3D, Lat3D, Depth3D = lonlatdepth_grid(1.0:1:10.0, 11.0:1:20.0, (-20:1:-10) * km);

0 commit comments

Comments
 (0)