Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 10 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: rust
rust: nightly
services: docker

matrix:
jobs:
include:
# Linux
- name: "aarch64-unknown-linux-gnu"
Expand Down Expand Up @@ -46,7 +46,7 @@ matrix:
- name: "powerpc64le-unknown-linux-gnu"
env: TARGET=powerpc64le-unknown-linux-gnu NO_JEMALLOC_TESTS=1
- name: "x86_64-unknown-linux-gnu (nightly)"
env: TARGET=x86_64-unknown-linux-gnu VALGRIND=1 JEMALLOC_SYS_VERIFY_CONFIGURE=1
env: TARGET=x86_64-unknown-linux-gnu VALGRIND=1 # JEMALLOC_SYS_VERIFY_CONFIGURE=1
install: rustup component add llvm-tools-preview
addons: &valgrind
apt:
Expand All @@ -72,7 +72,8 @@ matrix:
install: true
script:
- cargo test --bench roundtrip
- cargo test --features=alloc_trait --bench roundtrip
# FIXME: Re-enable this when allocator API is stable.
# - cargo test --features=alloc_trait --bench roundtrip
- name: "x86_64-unknown-linux-musl"
env: TARGET=x86_64-unknown-linux-musl NOBGT=1 NO_JEMALLOC_TESTS=1

Expand All @@ -86,24 +87,10 @@ matrix:
# FIXME: cannot jemalloc tests fail due to:
# https://github.com/jemalloc/jemalloc/issues/1320
# https://github.com/gnzlbg/jemallocator/issues/85
- name: "i686-apple-darwin (nightly)"
env: TARGET=i686-apple-darwin NO_JEMALLOC_TESTS=1
os: osx
osx_image: xcode10
- name: "i686-apple-darwin (beta)"
env: TARGET=i686-apple-darwin NO_JEMALLOC_TESTS=1
os: osx
osx_image: xcode10
rust: beta
- name: "i686-apple-darwin (stable)"
env: TARGET=i686-apple-darwin NO_JEMALLOC_TESTS=1
os: osx
osx_image: xcode10
rust: stable
# FIXME: valgrind fails on OSX
# https://github.com/gnzlbg/jemallocator/issues/86
- name: "x86_64-apple-darwin (nightly)"
env: TARGET=x86_64-apple-darwin NO_JEMALLOC_TESTS=1 JEMALLOC_SYS_VERIFY_CONFIGURE=1
env: TARGET=x86_64-apple-darwin NO_JEMALLOC_TESTS=1 # JEMALLOC_SYS_VERIFY_CONFIGURE=1
os: osx
osx_image: xcode10
install: rustup component add llvm-tools-preview
Expand Down Expand Up @@ -132,7 +119,7 @@ matrix:
deploy:
provider: script
script: curl -LsSf https://git.io/fhJ8n | rustc - && (cd target/doc && ../../rust_out)
skip_cleanup: true
cleanup: true
on:
branch: master
- name: "rustfmt"
Expand All @@ -148,10 +135,10 @@ matrix:
# allow(clippy::all) fails in the syscrate, so we can't use --all here:
script: |
if rustup component add clippy-preview ; then
cargo clippy -p jemalloc-sys -- -D clippy::pedantic
cargo clippy -p jemallocator -- -D clippy::pedantic
cargo clippy -p jemallocator-global -- -D clippy::pedantic
cargo clippy -p jemalloc-ctl -- -D clippy::pedantic
cargo clippy -p jemalloc-sys -- -D clippy::all
cargo clippy -p jemallocator -- -D clippy::all
cargo clippy -p jemallocator-global -- -D clippy::all
cargo clippy -p jemalloc-ctl -- -D clippy::all
fi
- name: "Shellcheck"
install: true
Expand Down
1 change: 0 additions & 1 deletion benches/roundtrip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ mod pow2 {
1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072,
4194304
]);

}

mod even {
Expand Down
51 changes: 28 additions & 23 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ fi

if [ "${TARGET}" = "x86_64-unknown-linux-gnu" ] || [ "${TARGET}" = "x86_64-apple-darwin" ]
then
${CARGO_CMD} build -vv --target "${TARGET}" 2>&1 | tee build_no_std.txt
# Not using tee to avoid too much logs that exceeds travis' limit.
if ! ${CARGO_CMD} build -vv --target "${TARGET}" > build_no_std.txt 2>&1; then
tail -n 1024 build_no_std.txt
exit 1
fi

# Check that the no-std builds are not linked against a libc with default
# features or the `use_std` feature enabled:
Expand All @@ -71,42 +75,42 @@ then
done
fi

${CARGO_CMD} test -vv --target "${TARGET}"
${CARGO_CMD} test --target "${TARGET}"

if [ "${JEMALLOC_SYS_GIT_DEV_BRANCH}" = "1" ]; then
# FIXME: profiling tests broken on dev-branch
# https://github.com/jemalloc/jemalloc/issues/1477
:
else
${CARGO_CMD} test -vv --target "${TARGET}" --features profiling
${CARGO_CMD} test --target "${TARGET}" --features profiling
fi

${CARGO_CMD} test -vv --target "${TARGET}" --features debug
${CARGO_CMD} test -vv --target "${TARGET}" --features stats
${CARGO_CMD} test --target "${TARGET}" --features debug
${CARGO_CMD} test --target "${TARGET}" --features stats
if [ "${JEMALLOC_SYS_GIT_DEV_BRANCH}" = "1" ]; then
# FIXME: profiling tests broken on dev-branch
# https://github.com/jemalloc/jemalloc/issues/1477
:
else
${CARGO_CMD} test -vv --target "${TARGET}" --features 'debug profiling'
${CARGO_CMD} test --target "${TARGET}" --features 'debug profiling'
fi

${CARGO_CMD} test -vv --target "${TARGET}" \
${CARGO_CMD} test --target "${TARGET}" \
--features unprefixed_malloc_on_supported_platforms
${CARGO_CMD} test -vv --target "${TARGET}" --no-default-features
${CARGO_CMD} test -vv --target "${TARGET}" --no-default-features \
${CARGO_CMD} test --target "${TARGET}" --no-default-features
${CARGO_CMD} test --target "${TARGET}" --no-default-features \
--features background_threads_runtime_support

if [ "${NOBGT}" = "1" ]
then
echo "enabling background threads by default at run-time is not tested"
else
${CARGO_CMD} test -vv --target "${TARGET}" --features background_threads
${CARGO_CMD} test --target "${TARGET}" --features background_threads
fi

${CARGO_CMD} test -vv --target "${TARGET}" --release
${CARGO_CMD} test -vv --target "${TARGET}" --manifest-path jemalloc-sys/Cargo.toml
${CARGO_CMD} test -vv --target "${TARGET}" \
${CARGO_CMD} test --target "${TARGET}" --release
${CARGO_CMD} test --target "${TARGET}" --manifest-path jemalloc-sys/Cargo.toml
${CARGO_CMD} test --target "${TARGET}" \
--manifest-path jemalloc-sys/Cargo.toml \
--features unprefixed_malloc_on_supported_platforms

Expand All @@ -116,25 +120,26 @@ case "${TARGET}" in
"x86_64-unknown-linux-musl") ;;
*)

${CARGO_CMD} test -vv --target "${TARGET}" \
${CARGO_CMD} test --target "${TARGET}" \
--manifest-path jemalloc-ctl/Cargo.toml \
--no-default-features
# FIXME: cross fails to pass features to jemalloc-ctl
# ${CARGO_CMD} test -vv --target "${TARGET}" \
# ${CARGO_CMD} test --target "${TARGET}" \
# --manifest-path jemalloc-ctl \
# --no-default-features --features use_std
;;
esac

${CARGO_CMD} test -vv --target "${TARGET}" -p systest
${CARGO_CMD} test -vv --target "${TARGET}" \
${CARGO_CMD} test --target "${TARGET}" -p systest
${CARGO_CMD} test --target "${TARGET}" \
--manifest-path jemallocator-global/Cargo.toml
${CARGO_CMD} test -vv --target "${TARGET}" \
${CARGO_CMD} test --target "${TARGET}" \
--manifest-path jemallocator-global/Cargo.toml \
--features force_global_jemalloc

if [ "${TRAVIS_RUST_VERSION}" = "nightly" ]
then
# The Alloc trait is unstable:
${CARGO_CMD} test -vv --target "${TARGET}" --features alloc_trait
fi
# FIXME: Re-enable following test when allocator API is stable again.
# if [ "${TRAVIS_RUST_VERSION}" = "nightly" ]
# then
# # The Alloc trait is unstable:
# ${CARGO_CMD} test --target "${TARGET}" --features alloc_trait
# fi
3 changes: 0 additions & 3 deletions jemalloc-ctl/src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ pub trait AsName {

impl AsName for [u8] {
fn name(&self) -> &Name {
use str;
assert!(
!self.is_empty(),
"cannot create Name from empty byte-string"
Expand Down Expand Up @@ -125,14 +124,12 @@ impl Name {

impl fmt::Debug for Name {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use str;
write!(f, "{}", str::from_utf8(&self.0).unwrap())
}
}

impl fmt::Display for Name {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use str;
write!(f, "{}", str::from_utf8(&self.0).unwrap())
}
}
Expand Down
38 changes: 11 additions & 27 deletions jemalloc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ extern crate fs_extra;

use std::env;
use std::fs;
use std::fs::File;
use std::path::{Path, PathBuf};
use std::process::Command;

Expand Down Expand Up @@ -54,16 +53,18 @@ macro_rules! warning {
}
}

// TODO: split main functions and remove following allow.
#[allow(clippy::cognitive_complexity)]
fn main() {
let target = env::var("TARGET").expect("TARGET was not set");
let host = env::var("HOST").expect("HOST was not set");
let num_jobs = env::var("NUM_JOBS").expect("NUM_JOBS was not set");
let out_dir = PathBuf::from(env::var_os("OUT_DIR").expect("OUT_DIR was not set"));
let src_dir = env::current_dir().expect("failed to get current directory");

info!("TARGET={}", target.clone());
info!("HOST={}", host.clone());
info!("NUM_JOBS={}", num_jobs.clone());
info!("TARGET={}", target);
info!("HOST={}", host);
info!("NUM_JOBS={}", num_jobs);
info!("OUT_DIR={:?}", out_dir);
let build_dir = out_dir.join("build");
info!("BUILD_DIR={:?}", build_dir);
Expand Down Expand Up @@ -185,28 +186,11 @@ fn main() {
run(&mut cmd);

for f in &config_files {
use std::io::Read;
fn read_content(file_path: &Path) -> String {
assert!(
file_path.exists(),
"config file path `{}` does not exist",
file_path.display()
);
let mut file = File::open(file_path).expect("file not found");
let mut content = String::new();
file.read_to_string(&mut content)
.expect("failed to read file");
content
}

if verify_configure {
let current = read_content(&jemalloc_src_dir.join(f));
let reference = read_content(&Path::new("configure").join(f));
assert_eq!(
current, reference,
"the current and reference configuration files \"{}\" differ",
f
);
let mut cmd = Command::new("diff");
run(cmd
.arg(&jemalloc_src_dir.join(f))
.arg(&Path::new("configure").join(f)));
}
}
} else {
Expand All @@ -231,7 +215,7 @@ fn main() {
.env("CC", compiler.path())
.env("CFLAGS", cflags.clone())
.env("LDFLAGS", cflags.clone())
.env("CPPFLAGS", cflags.clone())
.env("CPPFLAGS", cflags)
.arg("--disable-cxx");

if target.contains("ios") {
Expand Down Expand Up @@ -361,7 +345,7 @@ fn main() {
.arg("install_lib_static")
.arg("install_include")
.arg("-j")
.arg(num_jobs.clone()));
.arg(num_jobs));

println!("cargo:root={}", out_dir.display());

Expand Down
2 changes: 1 addition & 1 deletion jemalloc-sys/configure/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.1.0-0-g61efbda7098de6fe64c362d309824864308c36d4
5.2.1-0-gea6b3e973b477b8061e0076bb257dbd7f3faa756
Loading