Skip to content

Commit

Permalink
Add aqua tests
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Jun 14, 2023
1 parent 3321fc8 commit d8fd62d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
BFloat16s = "ab4f0b2a-ad5b-11e8-123f-65d77653426b"
CUDA_Runtime_jll = "76a88914-d11a-5bdc-97e0-2f5a05c973a2"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Expand Down
37 changes: 37 additions & 0 deletions test/aqua.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Test
using CUDA
using Aqua

@testset "Aqua tests (performance)" begin
# This tests that we don't accidentally run into
# https://github.com/JuliaLang/julia/issues/29393
# Aqua.test_unbound_args(CUDA)
ua = Aqua.detect_unbound_args_recursively(CUDA)
@info "Number of unbound argument methods: $(length(ua))"
@test length(ua) 26

# See: https://github.com/SciML/OrdinaryDiffEq.jl/issues/1750
# Test that we're not introducing method ambiguities across deps
ambs = Aqua.detect_ambiguities(CUDA; recursive = true)
pkg_match(pkgname, pkdir::Nothing) = false
pkg_match(pkgname, pkdir::AbstractString) = occursin(pkgname, pkdir)
filter!(x -> pkg_match("CUDA", pkgdir(last(x).module)), ambs)

# Uncomment for debugging:
# for method_ambiguity in ambs
# @show method_ambiguity
# end
@test length(ambs) 35
@info "Number of method ambiguities: $(length(ambs))"
end

@testset "Aqua tests (additional)" begin
Aqua.test_undefined_exports(CUDA)
# Aqua.test_stale_deps(CUDA) # failing
Aqua.test_deps_compat(CUDA)
Aqua.test_project_extras(CUDA)
Aqua.test_project_toml_formatting(CUDA)
# Aqua.test_piracy(CUDA) # failing
end

nothing
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import REPL
using Printf: @sprintf
using TimerOutputs

@testset "Aqua" begin
include("aqua.jl")
end

# work around JuliaLang/Pkg.jl#2500
if VERSION < v"1.8"
test_project = first(Base.load_path())
Expand Down

0 comments on commit d8fd62d

Please sign in to comment.