Skip to content

Commit

Permalink
style: Run restyled on Travis and Circle CI scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed May 8, 2020
1 parent 8f4400b commit 3d601fe
Show file tree
Hide file tree
Showing 15 changed files with 116 additions and 109 deletions.
30 changes: 15 additions & 15 deletions .circleci/cmake-asan
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

set -eu

Expand All @@ -9,28 +9,28 @@ add_flag -Werror
add_flag -fdiagnostics-color=always
add_flag -fno-omit-frame-pointer
add_flag -fsanitize=address,undefined
cmake -B_build -H. -GNinja \
-DCMAKE_C_FLAGS="$C_FLAGS" \
-DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
-DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
-DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
-DMIN_LOGGER_LEVEL=TRACE \
-DMUST_BUILD_TOXAV=ON \
-DNON_HERMETIC_TESTS=ON \
-DSTRICT_ABI=ON \
-DTEST_TIMEOUT_SECONDS=120 \
-DUSE_IPV6=OFF \
cmake -B_build -H. -GNinja \
-DCMAKE_C_FLAGS="$C_FLAGS" \
-DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
-DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
-DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
-DMIN_LOGGER_LEVEL=TRACE \
-DMUST_BUILD_TOXAV=ON \
-DNON_HERMETIC_TESTS=ON \
-DSTRICT_ABI=ON \
-DTEST_TIMEOUT_SECONDS=120 \
-DUSE_IPV6=OFF \
-DAUTOTEST=ON

cd _build

ninja install -j$(nproc)
ninja install -j"$(nproc)"

export ASAN_OPTIONS="detect_invalid_pointer_pairs=1"
export ASAN_OPTIONS="$ASAN_OPTIONS,detect_stack_use_after_return=1"
export ASAN_OPTIONS="$ASAN_OPTIONS,strict_init_order=1"
export ASAN_OPTIONS="$ASAN_OPTIONS,strict_string_checks=1"
export ASAN_OPTIONS="$ASAN_OPTIONS,symbolize=1"
ctest -j50 --output-on-failure ||
ctest -j50 --output-on-failure --rerun-failed
ctest -j50 --output-on-failure --rerun-failed
30 changes: 15 additions & 15 deletions .circleci/cmake-tsan
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

set -eu

Expand All @@ -9,26 +9,26 @@ add_flag -Werror
add_flag -fdiagnostics-color=always
add_flag -fno-omit-frame-pointer
add_flag -fsanitize=thread
cmake -B_build -H. -GNinja \
-DCMAKE_C_FLAGS="$C_FLAGS" \
-DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
-DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
-DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
-DMIN_LOGGER_LEVEL=TRACE \
-DMUST_BUILD_TOXAV=ON \
-DNON_HERMETIC_TESTS=ON \
-DSTRICT_ABI=ON \
-DTEST_TIMEOUT_SECONDS=120 \
-DUSE_IPV6=OFF \
cmake -B_build -H. -GNinja \
-DCMAKE_C_FLAGS="$C_FLAGS" \
-DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
-DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
-DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
-DMIN_LOGGER_LEVEL=TRACE \
-DMUST_BUILD_TOXAV=ON \
-DNON_HERMETIC_TESTS=ON \
-DSTRICT_ABI=ON \
-DTEST_TIMEOUT_SECONDS=120 \
-DUSE_IPV6=OFF \
-DAUTOTEST=ON

cd _build

ninja install -j$(nproc)
ninja install -j"$(nproc)"

export TSAN_OPTIONS="halt_on_error=1"
export TSAN_OPTIONS="$TSAN_OPTIONS,second_deadlock_stack=1"
export TSAN_OPTIONS="$TSAN_OPTIONS,symbolize=1"
ctest -j50 --output-on-failure ||
ctest -j50 --output-on-failure --rerun-failed
ctest -j50 --output-on-failure --rerun-failed
22 changes: 12 additions & 10 deletions .travis/autotools-linux
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
#!/bin/sh
#!/bin/bash

ACTION="$1"

set -eu

CACHEDIR="$HOME/cache"
NPROC=`nproc`
NPROC=$(nproc)

travis_install() {
# Install vanilla NaCl only.
[ -f "$CACHEDIR/lib/amd64/libnacl.a" ] || {
curl https://hyperelliptic.org/nacl/nacl-20110221.tar.bz2 | tar jx
cd nacl-20110221 # pushd
cd nacl-20110221 # pushd
"./do"
# "make install"
mkdir -p "$CACHEDIR/include"; mv build/*/include/* "$CACHEDIR/include"
mkdir -p "$CACHEDIR/lib" ; mv build/*/lib/* "$CACHEDIR/lib"
cd - # popd
mkdir -p "$CACHEDIR/include"
mv build/*/include/* "$CACHEDIR/include"
mkdir -p "$CACHEDIR/lib"
mv build/*/lib/* "$CACHEDIR/lib"
cd - # popd
}
}

Expand All @@ -38,11 +40,11 @@ travis_script() {

autoreconf -fi
mkdir -p _build
cd _build # pushd
../configure $CONFIG_FLAGS || (cat config.log && false)
cd _build # pushd
../configure "${CONFIG_FLAGS[@]}" || (cat config.log && false)
make "-j$NPROC" -k CFLAGS="$C_FLAGS" LDFLAGS="$LD_FLAGS"
make -j50 -k distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIG_FLAGS" || (cat tox-*/_build/build/test-suite.log && false)
cd - # popd
make -j50 -k distcheck DISTCHECK_CONFIGURE_FLAGS="${CONFIG_FLAGS[*]}" || (cat tox-*/_build/build/test-suite.log && false)
cd - # popd
}

if [ "-z" "$ACTION" ]; then
Expand Down
13 changes: 6 additions & 7 deletions .travis/cmake-freebsd-env.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

# Common variables and functions

Expand All @@ -8,19 +8,19 @@ SCREEN_SESSION=freebsd
SSH_PORT=10022

FREEBSD_VERSION="12.1"
IMAGE_NAME=FreeBSD-${FREEBSD_VERSION}-RELEASE-amd64.raw
IMAGE_NAME=FreeBSD-$FREEBSD_VERSION-RELEASE-amd64.raw
# https://download.freebsd.org/ftp/releases/VM-IMAGES/12.1-RELEASE/amd64/Latest/
IMAGE_SHA512="a65da6260f5f894fc86fbe1f27dad7800906da7cffaa5077f82682ab74b6dd46c4ce87158c14b726d74ca3c6d611bea3bb336164da3f1cb990550310b110da22"

RUN() {
ssh -t -o ConnectionAttempts=120 -o ConnectTimeout=2 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p $SSH_PORT "$@"
ssh -t -o ConnectionAttempts=120 -o ConnectTimeout=2 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p "$SSH_PORT" "$@"
}

start_vm() {
screen -d -m qemu-system-x86_64 -curses -m 2048 -smp $NPROC -net user,hostfwd=tcp::${SSH_PORT}-:22 -net nic "$IMAGE_NAME"
screen -d -m qemu-system-x86_64 -curses -m 2048 -smp "$NPROC" -net user,hostfwd=tcp::"$SSH_PORT"-:22 -net nic "$IMAGE_NAME"

# Wait for ssh to start listening on the port
while ! echo "exit" | nc localhost ${SSH_PORT} | grep 'OpenSSH'; do
while ! echo "exit" | nc localhost "$SSH_PORT" | grep 'OpenSSH'; do
sleep 5
done

Expand All @@ -29,8 +29,7 @@ start_vm() {
RUN last
}

stop_vm()
{
stop_vm() {
# Turn it off
# We use this contraption because for some reason `shutdown -h now` and
# `poweroff` result in FreeBSD not shutting down on Travis (they work on my
Expand Down
47 changes: 24 additions & 23 deletions .travis/cmake-freebsd-stage1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

# Download and initial setup of the FreeBSD VM

Expand All @@ -9,7 +9,7 @@ set -eux
. .travis/cmake-freebsd-env.sh

travis_install() {
git tag -l --sort=version:refname > GIT_TAGS
git tag -l --sort=version:refname >GIT_TAGS

OLD_PWD="$PWD"

Expand All @@ -19,9 +19,9 @@ travis_install() {
# === Get the VM image, set it up and cache ===

# Create image if it's not cached, or if this build script has changed, or a new toxcore tag was pushed
sha256sum "$OLD_PWD/.travis/cmake-freebsd-env.sh" > /tmp/sha
sha256sum "$OLD_PWD/.travis/cmake-freebsd-stage1" >> /tmp/sha
sha256sum "$OLD_PWD/.travis/cmake-freebsd-stage1.expect" >> /tmp/sha
sha256sum "$OLD_PWD/.travis/cmake-freebsd-env.sh" >/tmp/sha
sha256sum "$OLD_PWD/.travis/cmake-freebsd-stage1" >>/tmp/sha
sha256sum "$OLD_PWD/.travis/cmake-freebsd-stage1.expect" >>/tmp/sha
if [ ! -f "./$IMAGE_NAME.tgz" ] || [ ! -f ./cmake-freebsd-stage1-all.sha256 ] || [ "$(cat cmake-freebsd-stage1-all.sha256)" != "$(cat /tmp/sha)" ] || ! diff -u ./GIT_TAGS "$OLD_PWD/GIT_TAGS"; then
rm -rf ./*

Expand All @@ -42,16 +42,16 @@ travis_install() {
DL_MIRROR_11=14

# There are 11 mirrors
DL_MIRROR_RANDOM=`expr $(date +%s) % 11 + 1`
DL_URL="ftp://ftp$(eval echo \$DL_MIRROR_$DL_MIRROR_RANDOM).us.freebsd.org/pub/FreeBSD/releases/VM-IMAGES/${FREEBSD_VERSION}-RELEASE/amd64/Latest/${IMAGE_NAME}.xz"
DL_MIRROR_RANDOM=$(expr "$(date +%s)" % 11 + 1)
DL_URL="ftp://ftp$(eval echo \$DL_MIRROR_"$DL_MIRROR_RANDOM").us.freebsd.org/pub/FreeBSD/releases/VM-IMAGES/$FREEBSD_VERSION-RELEASE/amd64/Latest/$IMAGE_NAME.xz"

# Make sure there are no partial downloads from the previous loop iterations
rm -rf ./*

wget --tries 1 "$DL_URL" && break
done

if ! ( echo "$IMAGE_SHA512 $IMAGE_NAME.xz" | sha512sum -c --status - ) ; then
if ! (echo "$IMAGE_SHA512 $IMAGE_NAME.xz" | sha512sum -c --status -); then
echo "Error: sha512 of $IMAGE_NAME.xz doesn't match the known one"
exit 1
fi
Expand Down Expand Up @@ -81,18 +81,19 @@ travis_install() {
RUN chsh -s /usr/local/bin/bash root

# Install required toxcore dependencies
RUN PAGER=cat ASSUME_ALWAYS_YES=YES pkg install git \
opus \
libconfig \
libvpx \
libsodium \
gmake \
cmake \
pkgconf \
portaudio \
libsndfile \
texinfo \
autotools
RUN PAGER=cat ASSUME_ALWAYS_YES=YES pkg install \
git \
opus \
libconfig \
libvpx \
libsodium \
gmake \
cmake \
pkgconf \
portaudio \
libsndfile \
texinfo \
autotools

# === Cache the VM image ===

Expand All @@ -103,9 +104,9 @@ travis_install() {
rm "$IMAGE_NAME"

cp "$OLD_PWD/GIT_TAGS" .
sha256sum "$OLD_PWD/.travis/cmake-freebsd-env.sh" > cmake-freebsd-stage1-all.sha256
sha256sum "$OLD_PWD/.travis/cmake-freebsd-stage1" >> cmake-freebsd-stage1-all.sha256
sha256sum "$OLD_PWD/.travis/cmake-freebsd-stage1.expect" >> cmake-freebsd-stage1-all.sha256
sha256sum "$OLD_PWD/.travis/cmake-freebsd-env.sh" >cmake-freebsd-stage1-all.sha256
sha256sum "$OLD_PWD/.travis/cmake-freebsd-stage1" >>cmake-freebsd-stage1-all.sha256
sha256sum "$OLD_PWD/.travis/cmake-freebsd-stage1.expect" >>cmake-freebsd-stage1-all.sha256
ls -lh
fi

Expand Down
4 changes: 2 additions & 2 deletions .travis/cmake-freebsd-stage2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

# Toxcore building

Expand Down Expand Up @@ -35,7 +35,7 @@ travis_install() {
cd "$OLD_PWD"

# Copy over toxcore code from Travis to qemu
scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -P $SSH_PORT -r ./* root@localhost:~
scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -P "$SSH_PORT" -r ./* root@localhost:~

RUN ls -lh
}
Expand Down
10 changes: 5 additions & 5 deletions .travis/cmake-osx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/sh
#!/bin/bash

ACTION="$1"

set -eu

CACHEDIR="$HOME/cache"
NPROC=`sysctl -n hw.physicalcpu`
NPROC=$(sysctl -n hw.physicalcpu)

travis_install() {
# Workaround for bug in Homebrew where it only finds an old Ruby version.
Expand Down Expand Up @@ -35,11 +35,11 @@ travis_script() {
-DUSE_IPV6=OFF \
-DAUTOTEST=ON

cd _build # pushd
cd _build # pushd
make "-j$NPROC" -k install
make "-j$NPROC" test ARGS="-j50" || \
make "-j$NPROC" test ARGS="-j50" ||
make "-j$NPROC" test ARGS="-j50 --rerun-failed" CTEST_OUTPUT_ON_FAILURE=1
cd - # popd
cd - # popd
}

if [ "-z" "$ACTION" ]; then
Expand Down
2 changes: 1 addition & 1 deletion .travis/cmake-win32
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

i686=true
x86_64=false
Expand Down
2 changes: 1 addition & 1 deletion .travis/cmake-win64
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

i686=false
x86_64=true
Expand Down
16 changes: 8 additions & 8 deletions .travis/cmake-windows.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#!/bin/sh
#!/bin/bash

ACTION="$1"

set -eu

CACHEDIR="$HOME/cache"
NPROC=`nproc`
NPROC=$(nproc)

travis_install() {
cd other/docker/windows

docker build \
--build-arg SUPPORT_ARCH_i686=$i686 \
--build-arg SUPPORT_ARCH_x86_64=$x86_64 \
--build-arg SUPPORT_ARCH_i686="$i686" \
--build-arg SUPPORT_ARCH_x86_64="$x86_64" \
--build-arg SUPPORT_TEST=true \
-t toxcore-$WINDOWS_ARCH \
-t toxcore-"$WINDOWS_ARCH" \
.
}

Expand All @@ -27,8 +27,8 @@ travis_script() {

docker run \
-e ALLOW_TEST_FAILURE=true \
-e ENABLE_ARCH_i686=$i686 \
-e ENABLE_ARCH_x86_64=$x86_64 \
-e ENABLE_ARCH_i686="$i686" \
-e ENABLE_ARCH_x86_64="$x86_64" \
-e ENABLE_TEST=true \
-e EXTRA_CMAKE_FLAGS="-DBOOTSTRAP_DAEMON=OFF -DMIN_LOGGER_LEVEL=DEBUG -DTEST_TIMEOUT_SECONDS=90 -DAUTOTEST=ON" \
-e CMAKE_C_FLAGS="$C_FLAGS" \
Expand All @@ -38,7 +38,7 @@ travis_script() {
-v "$PWD:/toxcore" \
-v "$PWD/result:/prefix" \
--rm \
toxcore-$WINDOWS_ARCH
toxcore-"$WINDOWS_ARCH"
}

if [ "-z" "$ACTION" ]; then
Expand Down
2 changes: 1 addition & 1 deletion .travis/flags-clang.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

. .travis/flags.sh

Expand Down
2 changes: 1 addition & 1 deletion .travis/flags-gcc.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

. .travis/flags.sh

Expand Down
Loading

0 comments on commit 3d601fe

Please sign in to comment.