From c32e6d67302a3cbee87f6c8cb88d5a6a6c28b960 Mon Sep 17 00:00:00 2001
From: Patrick O'Doherty
Date: Sun, 2 Jul 2017 14:28:52 -0700
Subject: [PATCH 1/7] .travis.yml to run test suite
Installs dependencies (including rust) and runs the existing test suite.
TODO: Introduce build matrix utilizing the rust toolchain to run test
suites both with and without the rust components.
---
.travis.yml | 10 ++++++++++
1 file changed, 10 insertions(+)
create mode 100644 .travis.yml
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000000..cd520748e3
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,10 @@
+language: c
+sudo: enabled
+dist: trusty
+
+before_install:
+ - sudo apt-get -qq update
+ - sudo apt-get -y install libevent-dev libseccomp2 zlib1g-dev
+ - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
+
+script: ./autogen.sh && ./configure --disable-asciidoc && make test
From 66322718234c0bc7a74be3e5d60b62b9e897abb3 Mon Sep 17 00:00:00 2001
From: Isis Lovecruft
Date: Mon, 17 Jul 2017 21:43:05 +0000
Subject: [PATCH 2/7] Fix and expand upon our Travis CI configuration.
* CHANGE .travis.yml so that commands for different purposes (e.g. getting
dependencies, building, testing) are in separate config lines and sections.
* CHANGE .travis.yml to use their mechanism for installing dependencies via
apt. [0] This also allows us to not need sudo (the "sudo: false" line).
* CHANGE Travis CI tests (the "script:" section) to build and run tests in the
same manner as Jenkins (i.e. with --enable-fatal-warnings and
--disable-silent-rules and run `make check`).
* CHANGE Travis config to install nightly rustc and cargo.
* CHANGE Travis config to split rust install into commands for getting
dependencies ("before_install:") and commands for installing them
("install:").
* REMOVE shell redirection when downloading the rustup.sh script.
* CHANGE cargo to be in "online mode" so that we can get our Rust dependencies.
There's not really a way to get the dependencies without using cargo
right now. See https://bugs.torproject.org/22830 for more info.
* REMOVE cargo "offline mode" envvars from rustup.sh invocation.
* ADD commands to get more info about rustc and cargo before building.
* FIX sourcing the cargo/toolchain environment that rustup creates. (Without
this, our build scripts don't know about anything called "rustc" or "cargo".)
* ADD Travis configuration to do all the target builds with both GCC and clang.
* ADD make flags to build with both of the cores available.
* ADD notifications for IRC, and configure email notifications (to the author
of the commit) only if the branch was previously building successfully and
the latest commit broke it.
* ADD the ability to run the Travis build matrix for OSX as well, but leave it
commented out by default (because it takes roughly ten times longer, due to a
shortage of OSX build machines).
* ADD Travis config option to cancel/fail the build early if one target has
already failed ("fast_finish: true").
* ADD comments to describe what our Travis config is doing and why it is
configured that way.
[0]: https://docs.travis-ci.com/user/installing-dependencies/#Installing-Packages-on-Container-Based-Infrastructure)
---
.travis.yml | 91 +++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 85 insertions(+), 6 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index cd520748e3..8e0bb2afe2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,10 +1,89 @@
language: c
-sudo: enabled
+
+compiler:
+ - gcc
+ - clang
+
+notifications:
+ irc:
+ channels:
+ - "irc.oftc.net#tor-bots"
+ template:
+ - "%{repository} %{branch} %{commit} - %{author}: %{commit_subject}"
+ - "Build #%{build_number} %{result}. Details: %{build_url}"
+ on_success: change
+ on_failure: change
+ email:
+ on_success: never
+ on_failure: change
+
+os:
+ - linux
+ ## Uncomment the following line to also run the entire build matrix on OSX.
+ ## This will make your CI builds take roughly ten times longer to finish.
+ # - osx
+
+## Use the Ubuntu Trusty images.
dist: trusty
-before_install:
- - sudo apt-get -qq update
- - sudo apt-get -y install libevent-dev libseccomp2 zlib1g-dev
- - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
+## We don't need sudo. (The "apt:" stanza after this allows us to not need sudo;
+## otherwise, we would need it for getting dependencies.)
+sudo: false
-script: ./autogen.sh && ./configure --disable-asciidoc && make test
+## (Linux only) Download our dependencies
+addons:
+ apt:
+ packages:
+ - libevent-dev
+ - libseccomp2
+ - zlib1g-dev
+
+## The build matrix in the following two stanzas expands into four builds (per OS):
+##
+## * with GCC, with Rust
+## * with GCC, without Rust
+## * with Clang, with Rust
+## * with Clang, without Rust
+env:
+ global:
+ ## The Travis CI environment allows us two cores, so let's use both.
+ - MAKEFLAGS="-j 2"
+ matrix:
+ - RUST_OPTIONS="--enable-rust --enable-cargo-online-mode"
+ - RUST_OPTIONS=""
+
+matrix:
+ ## If one build in the matrix fails (e.g. if building withour Rust and Clang
+ ## fails, but building with Rust and GCC is still going), then cancel the
+ ## entire job early and call the whole thing a failure.
+ fast_finish: true
+
+before_install:
+ ## If we're on OSX, homebrew usually needs to updated first
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
+ ## Download rustup
+ - curl -Ssf -o rustup.sh https://sh.rustup.rs
+
+install:
+ ## If we're on OSX use brew to install dependencies (for Linux, see the "apt:" section above)
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade openssl; }; fi
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade libevent; }; fi
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade pkg-config; }; fi
+ ## Install the nightly channels of rustc and cargo and setup our toolchain environment
+ - sh rustup.sh -y --default-toolchain nightly
+ - source $HOME/.cargo/env
+ ## Get some info about rustc and cargo
+ - which rustc
+ - which cargo
+ - rustc --version
+ - cargo --version
+
+script:
+ - ./autogen.sh
+ - ./configure $RUST_OPTIONS --disable-asciidoc --enable-fatal-warnings --disable-silent-rules
+ ## We run `make check` because that's what https://jenkins.torproject.org does.
+ - make check
+
+after_failure:
+ ## `make check` will leave a log file with more details of test failures.
+ - cat test-suite.log
From cdb3e17ba279402c3a5bf7e8baf6fe7a07311770 Mon Sep 17 00:00:00 2001
From: Isis Lovecruft
Date: Wed, 12 Jul 2017 00:32:38 +0000
Subject: [PATCH 3/7] Add a changes file for bug22636.
---
changes/bug22636 | 8 ++++++++
1 file changed, 8 insertions(+)
create mode 100644 changes/bug22636
diff --git a/changes/bug22636 b/changes/bug22636
new file mode 100644
index 0000000000..770cac72e9
--- /dev/null
+++ b/changes/bug22636
@@ -0,0 +1,8 @@
+ o Build features:
+ - Tor's repository now includes a Travis Continuous Integration (CI)
+ configuration file (.travis.yml). This is meant to help new developers and
+ contributors who fork Tor to a Github repository be better able to test
+ their changes, and understand what we expect to pass. To use this new build
+ feature, you must fork Tor to your Github account, then go into the
+ "Integrations" menu in the repository settings for your fork and enable
+ Travis, then push your changes.
From f18205f2e193773cb904823a71e24518dc26d521 Mon Sep 17 00:00:00 2001
From: Isis Lovecruft
Date: Mon, 24 Jul 2017 18:26:36 +0000
Subject: [PATCH 4/7] Fix CI homebrew checks for outdated packages.
(cherry picked from commit 8f8689f70235dc19cbc5092ea148af5772a9cdc3)
---
.travis.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 8e0bb2afe2..6ce2b87a99 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -66,9 +66,9 @@ before_install:
install:
## If we're on OSX use brew to install dependencies (for Linux, see the "apt:" section above)
- - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade openssl; }; fi
- - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade libevent; }; fi
- - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade pkg-config; }; fi
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade openssl; }; fi
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated libevent || brew upgrade libevent; }; fi
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated pkg-config || brew upgrade pkg-config; }; fi
## Install the nightly channels of rustc and cargo and setup our toolchain environment
- sh rustup.sh -y --default-toolchain nightly
- source $HOME/.cargo/env
From c84d394176c252f31c0d14ca62e7e0940a2202f8 Mon Sep 17 00:00:00 2001
From: Isis Lovecruft
Date: Mon, 24 Jul 2017 18:53:18 +0000
Subject: [PATCH 5/7] Install optional dependencies during Travis CI builds.
(cherry picked from commit 1bb00fb812c0df7a574ed62e9f53b0e8192c7d04)
---
.travis.yml | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 6ce2b87a99..c8b9382f57 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -34,9 +34,15 @@ sudo: false
addons:
apt:
packages:
+ ## Required dependencies
- libevent-dev
- libseccomp2
- zlib1g-dev
+ ## Optional dependencies
+ - liblzma-dev
+ - libscrypt-dev
+ ## zstd doesn't exist in Ubuntu Trusty
+ #- libzstd
## The build matrix in the following two stanzas expands into four builds (per OS):
##
@@ -65,10 +71,14 @@ before_install:
- curl -Ssf -o rustup.sh https://sh.rustup.rs
install:
- ## If we're on OSX use brew to install dependencies (for Linux, see the "apt:" section above)
+ ## If we're on OSX use brew to install required dependencies (for Linux, see the "apt:" section above)
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade openssl; }; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated libevent || brew upgrade libevent; }; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated pkg-config || brew upgrade pkg-config; }; fi
+ ## If we're on OSX also install the optional dependencies
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated xz || brew upgrade xz; }; fi
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated libscrypt || brew upgrade libscrypt; }; fi
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated zstd || brew upgrade zstd; }; fi
## Install the nightly channels of rustc and cargo and setup our toolchain environment
- sh rustup.sh -y --default-toolchain nightly
- source $HOME/.cargo/env
From 1d42316f49098e5fd5613bfa39dd6e3b02e3bd61 Mon Sep 17 00:00:00 2001
From: Isis Lovecruft
Date: Mon, 24 Jul 2017 20:25:25 +0000
Subject: [PATCH 6/7] Only install Rust in CI if RUST_OPTIONS is set.
(cherry picked from commit e5dd07a4c64fd2a4132ab1f6dec64640a95da35e)
---
.travis.yml | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index c8b9382f57..09ee44b0b2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -68,7 +68,7 @@ before_install:
## If we're on OSX, homebrew usually needs to updated first
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
## Download rustup
- - curl -Ssf -o rustup.sh https://sh.rustup.rs
+ - if [[ "$RUST_OPTIONS" != "" ]]; then curl -Ssf -o rustup.sh https://sh.rustup.rs; fi
install:
## If we're on OSX use brew to install required dependencies (for Linux, see the "apt:" section above)
@@ -80,13 +80,13 @@ install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated libscrypt || brew upgrade libscrypt; }; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated zstd || brew upgrade zstd; }; fi
## Install the nightly channels of rustc and cargo and setup our toolchain environment
- - sh rustup.sh -y --default-toolchain nightly
- - source $HOME/.cargo/env
+ - if [[ "$RUST_OPTIONS" != "" ]]; then sh rustup.sh -y --default-toolchain nightly; fi
+ - if [[ "$RUST_OPTIONS" != "" ]]; then source $HOME/.cargo/env; fi
## Get some info about rustc and cargo
- - which rustc
- - which cargo
- - rustc --version
- - cargo --version
+ - if [[ "$RUST_OPTIONS" != "" ]]; then which rustc; fi
+ - if [[ "$RUST_OPTIONS" != "" ]]; then which cargo; fi
+ - if [[ "$RUST_OPTIONS" != "" ]]; then rustc --version; fi
+ - if [[ "$RUST_OPTIONS" != "" ]]; then cargo --version; fi
script:
- ./autogen.sh
From 810bbb791157d9ad2c7f7ae9452e01563ef2af04 Mon Sep 17 00:00:00 2001
From: Isis Lovecruft
Date: Mon, 24 Jul 2017 23:07:09 +0000
Subject: [PATCH 7/7] Builds on CI should use --enable-fragile-hardening.
(cherry picked from commit c91a57ccf90308c6728184b43519f96b61acb95d)
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 09ee44b0b2..8d6be32fcd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -90,7 +90,7 @@ install:
script:
- ./autogen.sh
- - ./configure $RUST_OPTIONS --disable-asciidoc --enable-fatal-warnings --disable-silent-rules
+ - ./configure $RUST_OPTIONS --disable-asciidoc --enable-fatal-warnings --disable-silent-rules --enable-fragile-hardening
## We run `make check` because that's what https://jenkins.torproject.org does.
- make check