Skip to content

Commit

Permalink
Update to julia 0.7/1.0 (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidanthoff authored and bicycle1885 committed Oct 29, 2018
1 parent ed779e0 commit 1bbda31
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 37 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ os:
- linux
- osx
julia:
- 0.6
- 0.7
- 1.0
- nightly
matrix:
allow_failures:
Expand Down
4 changes: 2 additions & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
julia 0.6
BinaryProvider 0.3.3
julia 0.7
BinaryProvider 0.4.0
45 changes: 24 additions & 21 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,43 @@
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
on_build_failure: false
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%"
1 change: 1 addition & 0 deletions deps/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ downloads
src
usr
builds
build.log
4 changes: 2 additions & 2 deletions src/Snappy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down
23 changes: 12 additions & 11 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Snappy
using Base.Test
using Random
using Test

@testset "Low-level Interfaces" begin
SnappyOK = Snappy.SnappyOK
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 1bbda31

Please sign in to comment.