diff --git a/.gitignore b/.gitignore index 2886cee..6936990 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ /target **/*.rs.bk Cargo.lock -*.swp -.idea/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..47b5ffc --- /dev/null +++ b/.travis.yml @@ -0,0 +1,75 @@ +# Created by the Rust CI generator: https://github.com/bspeice/rust-ci +dist: trusty +language: rust +# Used during coverage to build kcov +addons.apt.packages: + - libcurl4-openssl-dev + - libelf-dev + - libdw-dev + - binutils-dev + +matrix: + include: + # Uniquely identifies the build that uploads to codecov.io + - env: CODECOV=TRUE + rust: nightly + # Uniquely identifies the build that uploads to crates.io + - env: CRATESIO=TRUE + rust: nightly + - rust: nightly + # To build against specific Rust versions, include an item like the following: + # - rust: 1.30.0 + - rust: nightly + os: osx + +before_install: + - set -e + - rustup self update + +install: + - source ~/.cargo/env || true + +script: + - rustup component add rustfmt-preview + - cargo fmt --all -- --check + - | + if [ -z "$TRAVIS_TAG" ]; then + cargo test + cargo test --release + fi + +after_script: set +e +after_success: | + # Build test coverage statistics + wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && \ + tar xzf master.tar.gz && \ + cd kcov-master && \ + mkdir build && \ + cd build && \ + cmake .. && \ + make && \ + make install DESTDIR=../../kcov-build && \ + rm -rf kcov-master && \ + for file in target/debug/*-*[^\.d]; do \ + mkdir -p "target/cov/$(basename $file)"; \ + ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file"; \ + done && \ + bash <(curl -s https://codecov.io/bash) && \ + echo "Uploaded code coverage" + +branches: + only: + # Release tags - vX.Y.Z + - /^v\d+\.\d+\.\d+.*$/ + - master + + +deploy: + - provider: cargo + on: + condition: "$CRATESIO = TRUE" + tags: true + skip_cleanup: true + token: "0I4H/gLnBP0G26lTWKAWTVzgBNulh1Ih4XIYtAtOSf5TTAH4J7h634qPCVU/D73RhyYQKIUT9FxtY107tPNDKqFDY0QK6WgJJIsHJw4LuS2A2XdPp7i5lU8LMc58o0Qq2wGV+1Fy5QLfMt0OfKJcu0QdZiOYffOL5Vquj6srlq0xhslD3Xit87P4H5tqQYHoKXNwkWFZhRPOMep14oU1F7gUrAFMFIxnHxpii06v3TYz1pmQ4xxfO8ElM8br6uhahgngAnJSmN57kPWpU43g2zltJEH6Hi0HDu0mzKTbkqFv/JXSuVd43vC6p8NGURdojTII3zsZ5Cg4R6Xnd/z++2QH71S9eD3FtyVp0pwprJxjLc2BLx/b53bD6i8YR2wLpuPk+d2Ghr04zJRPNNm2DK4Hpq2pk3pt06l3YnkJU3hb7Fbt8dacXag/3y6lf70Mj58bVcNuItVWF1u7+DTaVM5XdsD7ZerYRm0E4r5IbukEwz4Cjk4UCbFZgFk46jsG+AQ3ngIw1wjwAx16tpCmRKUNwR1h31TlKFm9ihE/kDiabia56jYJyzWhSu5GHppSEWmHBLajEse7SowpDTIAyJLKD3QG6/YT+ukulkb1lweS6AvlYaKiJo0H2h7ndUhXDMn9SnJUTQmFcnQ3N125l+NC6BY+Z1P/Sk7fKXmy55k=" + + diff --git a/CHANGELOG b/CHANGELOG.md similarity index 100% rename from CHANGELOG rename to CHANGELOG.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9162f33 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,31 @@ +# Contributing + +If you're interested in assisting with development, here are the best ways to help: + +## Bug Reports + +While this repository has automated testing in place, testing is no replacement for +real-world usage. If you have questions about what behavior should be, please open +an issue [on Github](https://github.com/bspeice/qadapt/issues). + +## Feature Requests + +The work of coding is never finished. If you have ideas on how to make this code +better for the future, please open an issue [on Github](https://github.com/bspeice/qadapt/issues). + +Writing code to implement the feature isn't mandatory (though is appreciated), +and there are no bad suggestions. + +## Documentation/Examples + +To make this project easy to use, additional documentation and usage examples +are greatly appreciated. Please also feel free to report typos and other +documentation clarity errors. + +## Pull Requests + +Thanks for your contribution! To assist expediently merging your code, +please ensure the following have been run: + +- [] `cargo fmt` +- [] `make doc` diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 0000000..9c957b1 --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +`qadapt` is developed by: + Bradlee Speice diff --git a/LICENSE b/LICENSE index b7759c7..36f6de2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,10 +1,11 @@ + Copyright 2018 Bradlee Speice Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..16d0d47 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +.PHONY: all +all: + @echo 'Please use `cargo` commands to manage building/testing qadapt' + +.PHONY: contributors +contributors: + @echo '`qadapt` is developed by:' > CONTRIBUTORS.md + @echo ' Bradlee Speice ' >> CONTRIBUTORS.md + @git log --format=' %aN <%aE>' | grep -v "Bradlee Speice " | sort -u >> CONTRIBUTORS.md + +.PHONY: readme README.md +readme: README.md + +README.md: src/lib.rs + @sed -i '/---/q' README.md + @cat src/lib.rs | grep '//!' | sed 's/^\/\/\! *//g' >> README.md + +.PHONY: doc +doc: readme contributors diff --git a/README.md b/README.md index 40b7f3d..c337207 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,25 @@ -The Quick And Dirty Allocation Profiling Tool -============================================= +# qadapt [![crates.io](https://img.shields.io/crates/v/qadapt.svg)](https://crates.io/crates/qadapt) [![docs.rs](https://docs.rs/qadapt/badge.svg)](https://docs.rs/qadapt/) +[![travisci](https://travis-ci.org/bspeice/qadapt.svg?branch=master)](https://travis-ci.org/bspeice/qadapt) + +[![codecov](https://codecov.io/gh/bspeice/qadapt/branch/master/graph/badge.svg)](https://codecov.io/gh/bspeice/qadapt) + +--- +# The Quick And Dirty Allocation Profiling Tool This allocator is a helper for writing high-performance code that is allocation/drop free; for functions annotated with `#[allocate_panic]`, QADAPT will detect when allocations/drops happen during their execution (and execution of any functions they call) and throw a -thread panic if this occurs. +thread panic if this occurs. QADAPT-related code is *stripped out during release builds*, +so no worries about random allocations crashing in production. -Because QADAPT panics on allocation and is rather slow (for an allocator) it is **strongly** -recommended that QADAPT (the allocator) be used only in code tests. Functions annotated with -`#[allocate_panic]` will have no side effects if the QADAPT allocator is not being used, -so the attribute is safe to leave everywhere. +Currently this crate is Nightly-only, but will work once `const fn` is in Stable. -Currently this crate is Nightly-only, but will work once `const fn` is in Stable. \ No newline at end of file +Please also take a look at [qadapt-macro](https://github.com/bspeice/qadapt/tree/master/qadapt-macro) +for some helper macros to make working with QADAPT a bit easier. diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..5fc3b00 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,59 @@ +environment: + matrix: + # MinGW + - TARGET: i686-pc-windows-gnu + RUST_VERSION: stable + - TARGET: x86_64-pc-windows-gnu + RUST_VERSION: stable + + # MSVC + - TARGET: i686-pc-windows-msvc + RUST_VERSION: stable + - TARGET: x86_64-pc-windows-msvc + RUST_VERSION: stable + + # Testing other channels + - TARGET: x86_64-pc-windows-gnu + RUST_VERSION: 1.30.1 + - TARGET: x86_64-pc-windows-gnu + RUST_VERSION: nightly + - TARGET: x86_64-pc-windows-msvc + RUST_VERSION: nightly + +install: + - ps: >- + If ($Env:TARGET -eq 'x86_64-pc-windows-gnu') { + $Env:PATH += ';C:\msys64\mingw64\bin' + } ElseIf ($Env:TARGET -eq 'i686-pc-windows-gnu') { + $Env:PATH += ';C:\msys64\mingw32\bin' + } + - curl -sSf -o rustup-init.exe https://win.rustup.rs/ + - rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION% + - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin + - rustc -Vv + - cargo -V + +test_script: + # If you need to run additional steps during testing, they should be placed + # inside this block + - if [%APPVEYOR_REPO_TAG%]==[false] ( + cargo test --target %TARGET% && + cargo test --target %TARGET% --release + ) + +cache: + - C:\Users\appveyor\.cargo\registry + - target + +branches: + only: + # release tag format is "vX.Y.Z" + - /^v\d+\.\d+\.\d+.*$/ + - master + +notifications: + - provider: Email + on_build_success: false + +# Building is done in the test phase, so we disable Appveyor's build phase. +build: false diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..9c47e51 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1 @@ +# Empty file uses default settings \ No newline at end of file