Skip to content

Commit

Permalink
Make ./test.sh work again
Browse files Browse the repository at this point in the history
Use a comment as a placeholder in Cargo.toml instead of specifying crate-type by default.
  • Loading branch information
oyvindln committed Jan 26, 2018
1 parent b7da730 commit 0adc62b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ exclude = ["benches/data/*"]

[lib]
name = "miniz_oxide_c_api"
# Place to modify crate type in test build script while --crate-type=staticlib seems broken
#CRATE_TYPE

[dependencies]
libc = "0.2.22"
Expand Down
12 changes: 9 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@

cd $(dirname $0)

OLD="crate-type = \['rlib'\]"
OLD="\#CRATE_TYPE"
NEW="crate-type = \['staticlib', 'rlib'\]"

# Tell cargo that we want a static library to link with.
# --crate-type=staticlib doesn't seem to work, so we modify
# Cargo.toml temoprarily instead.
sed -i "s/$OLD/$NEW/g" Cargo.toml

rm -f libminiz_oxide_c_api.a

if [[ ($# == 0 || $1 == "--release" ) ]]; then
# cargo rustc --release -- --emit asm
cargo build --release --features=miniz_zip || exit 1
cargo build --release --features=miniz_zip -- || exit 1
cp target/release/libminiz_oxide_c_api.a .
elif [[ $1 == "--debug" ]]; then
cargo build --features=miniz_zip || exit 1
cp target/debug/libminiz_oxide_c_api.a .
else
echo --relese or --debug
fi

sed -i "s/$NEW/$OLD/g" Cargo.toml
5 changes: 1 addition & 4 deletions run_fuzz.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/usr/bin/env bash

OLD="crate-type = \['staticlib', 'rlib'\]"
NEW="crate-type = \['rlib'\]"

sed -i "s/$OLD/$NEW/g" Cargo.toml
# TODO: This is broken at the moment.
cargo fuzz run fuzz_high -- -max_len=900

0 comments on commit 0adc62b

Please sign in to comment.