From 8e6af471c301a725bd10f8b029f19c6fbb92d7ac Mon Sep 17 00:00:00 2001 From: Jerry Ling Date: Sat, 4 Sep 2021 08:08:55 -0400 Subject: [PATCH] bump version and refine tests (#80) --- .github/workflows/ci.yml | 5 ++++- Project.toml | 2 +- src/UnROOT.jl | 3 ++- src/iteration.jl | 2 +- test/runtests.jl | 5 ++++- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32d75567..22f7efcc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,8 @@ jobs: fail-fast: false matrix: version: + - '1.5' + - '1.4' - '1.3' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'. - '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia. - 'nightly' @@ -40,6 +42,8 @@ jobs: ${{ runner.os }}- - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 + env: + JULIA_NUM_THREADS: "3" - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v1 with: @@ -67,4 +71,3 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} - JULIA_NUM_THREADS: "3" diff --git a/Project.toml b/Project.toml index 480633b7..464e5be4 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "UnROOT" uuid = "3cd96dde-e98d-4713-81e9-a4a1b0235ce9" authors = ["Tamas Gal", "Jerry Ling", "Johannes Schumann", "Nick Amin"] -version = "0.3.7" +version = "0.4.0" [deps] AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" diff --git a/src/UnROOT.jl b/src/UnROOT.jl index f2b242a7..63f9b60a 100644 --- a/src/UnROOT.jl +++ b/src/UnROOT.jl @@ -12,8 +12,9 @@ using Mixers, Parameters, Memoization, LRUCache import Tables, TypedTables, PrettyTables, DataFrames -@static if VERSION < v"1.4" +@static if VERSION < v"1.6" Base.first(a::AbstractVector{S}, n::Integer) where S<: AbstractString = a[1:(length(a) > n ? n : end)] + Base.first(a::S, n::Integer) where S<: AbstractString = a[1:(length(a) > n ? n : end)] end include("constants.jl") diff --git a/src/iteration.jl b/src/iteration.jl index c4395a3d..fce82358 100644 --- a/src/iteration.jl +++ b/src/iteration.jl @@ -101,7 +101,7 @@ mutable struct LazyBranch{T,J,B} <: AbstractVector{T} return new{T,J,typeof(_buffer)}(f, b, length(b), b.fBasketEntry, [_buffer for _ in 1:Threads.nthreads()], - [0:0 for _ in 1:Threads.nthreads()]) + [0:-1 for _ in 1:Threads.nthreads()]) end end diff --git a/test/runtests.jl b/test/runtests.jl index 0e81e024..534e3c4f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -464,7 +464,7 @@ end rootfile = ROOTFile(joinpath(SAMPLES_DIR, "issue61.root")) arr = LazyTree(rootfile,"Events").Jet_pt; _ = length.(arr); - @test length(arr.buffer[1]) == length(arr.buffer_range[1]) + @test length.(arr.buffer) == length.(arr.buffer_range) close(rootfile) end @@ -522,6 +522,9 @@ end @test nmu == 878 + if get(ENV, "CI", "false") == "true" + @test Threads.nthreads() > 1 + end nmus = zeros(Int, Threads.nthreads()) Threads.@threads for i in 1:length(t) nmus[Threads.threadid()] += length(t.Muon_pt[i])