diff --git a/.travis.yml b/.travis.yml index 8ef39c6..1c5329c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,8 @@ os: - linux - osx julia: - - 0.6 + - 0.7 + - 1.0 - nightly matrix: allow_failures: diff --git a/REQUIRE b/REQUIRE index bef2ac2..7a1f688 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,2 +1,2 @@ -julia 0.6 -BinaryProvider 0.3.3 +julia 0.7 +BinaryProvider 0.4.0 diff --git a/appveyor.yml b/appveyor.yml index 6704798..c2588f1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,20 +1,24 @@ environment: matrix: - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe" - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" + - julia_version: 0.7 + - julia_version: 1 + - julia_version: nightly + +platform: + - x86 # 32-bit + - x64 # 64-bit + +# # Uncomment the following lines to allow failures on nightly julia +# # (tests will run but not make your overall status red) +# matrix: +# allow_failures: +# - julia_version: nightly branches: only: - master - /release-.*/ -matrix: - allow_failures: - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" - notifications: - provider: Email on_build_success: false @@ -22,19 +26,18 @@ notifications: on_build_status_changed: false install: - - ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12" -# Download most recent Julia Windows binary - - ps: (new-object net.webclient).DownloadFile( - $env:JULIA_URL, - "C:\projects\julia-binary.exe") -# Run installer silently, output to C:\projects\julia - - C:\projects\julia-binary.exe /S /D=C:\projects\julia + - ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1")) build_script: -# Need to convert from shallow to complete for Pkg.clone to work - - IF EXIST .git\shallow (git fetch --unshallow) - - C:\projects\julia\bin\julia -e "versioninfo(); - Pkg.clone(pwd(), \"Snappy\"); Pkg.build(\"Snappy\")" + - echo "%JL_BUILD_SCRIPT%" + - C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%" test_script: - - C:\projects\julia\bin\julia -e "Pkg.test(\"Snappy\")" + - echo "%JL_TEST_SCRIPT%" + - C:\julia\bin\julia -e "%JL_TEST_SCRIPT%" + +# # Uncomment to support code coverage upload. Should only be enabled for packages +# # which would have coverage gaps without running on Windows +# on_success: +# - echo "%JL_CODECOV_SCRIPT%" +# - C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%" diff --git a/deps/.gitignore b/deps/.gitignore index f717950..098bf86 100644 --- a/deps/.gitignore +++ b/deps/.gitignore @@ -3,3 +3,4 @@ downloads src usr builds +build.log diff --git a/src/Snappy.jl b/src/Snappy.jl index 2be5762..f38db56 100644 --- a/src/Snappy.jl +++ b/src/Snappy.jl @@ -25,7 +25,7 @@ end function compress(input::Vector{UInt8}) ilen = length(input) maxlen = snappy_max_compressed_length(UInt(ilen)) - compressed = Array{UInt8}(maxlen) + compressed = Array{UInt8}(undef, maxlen) olen, st = snappy_compress(input, compressed) if st != SnappyOK error("failed to compress the data") @@ -40,7 +40,7 @@ function uncompress(input::Array{UInt8}) if st != SnappyOK error("faield to guess the length of the uncompressed data (the compressed data may be broken?)") end - uncompressed = Array{UInt8}(explen) + uncompressed = Array{UInt8}(undef, explen) olen, st = snappy_uncompress(input, uncompressed) if st != SnappyOK error("failed to uncompress the data") diff --git a/test/runtests.jl b/test/runtests.jl index 0881793..094ecef 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,6 @@ using Snappy -using Base.Test +using Random +using Test @testset "Low-level Interfaces" begin SnappyOK = Snappy.SnappyOK @@ -14,13 +15,13 @@ using Base.Test buffer_size = 100 for original in originals() # compress - compressed = Array{UInt8}(buffer_size) + compressed = Array{UInt8}(undef, buffer_size) olen, st = Snappy.snappy_compress(Vector{UInt8}(original), compressed) @test st == SnappyOK resize!(compressed, olen) # uncompress - uncompressed = Array{UInt8}(buffer_size) + uncompressed = Array{UInt8}(undef, buffer_size) olen, st = Snappy.snappy_uncompress(compressed, uncompressed) @test st == SnappyOK resize!(uncompressed, olen) @@ -33,24 +34,24 @@ using Base.Test original = "orig" # prepare too small buffer to compress - compressed = Array{UInt8}(1) + compressed = Array{UInt8}(undef, 1) _, st = Snappy.snappy_compress(Vector{UInt8}(original), compressed) @test st == SnappyBufferTooSmall # now enough buffer size - compressed = Array{UInt8}(100) + compressed = Array{UInt8}(undef, 100) olen, st = Snappy.snappy_compress(Vector{UInt8}(original), compressed) @test st == SnappyOK resize!(compressed, olen) # again the prepared buffer is too small to uncompress - uncompressed = Array{UInt8}(1) + uncompressed = Array{UInt8}(undef, 1) olen, st = Snappy.snappy_uncompress(compressed, uncompressed) @test st == SnappyBufferTooSmall # Break compressed data and detect it original = "orig" - compressed = Array{UInt8}(100) + compressed = Array{UInt8}(undef, 100) olen, st = Snappy.snappy_compress(Vector{UInt8}(original), compressed) @test st == SnappyOK resize!(compressed, olen) @@ -62,7 +63,7 @@ using Base.Test # Estimate compressed size for original in originals() maxlen = Snappy.snappy_max_compressed_length(UInt(length(original))) - compressed = Array{UInt8}(100) + compressed = Array{UInt8}(undef, 100) olen, st = Snappy.snappy_compress(Vector{UInt8}(original), compressed) @test st == SnappyOK #@show Int(olen), Int(maxlen) @@ -71,7 +72,7 @@ using Base.Test # Estimate uncompressed size for original in originals() - compressed = Array{UInt8}(100) + compressed = Array{UInt8}(undef, 100) olen, st = Snappy.snappy_compress(Vector{UInt8}(original), compressed) @test st == SnappyOK resize!(compressed, olen) @@ -83,7 +84,7 @@ end @testset "High-level Interfaces" begin # QuickCheck-like property satisfaction tests (compress ○ uncompress = id) - srand(2014) + Random.seed!(2014) # byte arrays randbytes(n) = rand(UInt8, n) @@ -98,7 +99,7 @@ end # Large data # 128MiB - srand(2014) + Random.seed!(2014) original = randstring(128 * 1024^2) original_bytes = Vector{UInt8}(original) @test uncompress(compress(original_bytes)) == original_bytes