Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dontmerge] Introduce a bug on top of #864 to see if cirrus catches it #887

Closed
wants to merge 5 commits into from
Closed
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
191 changes: 191 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
env:
WIDEMUL: auto
BIGNUM: auto
STATICPRECOMPUTATION: yes
ECMULTGENPRECISION: auto
ASM: no
BUILD: check
WITH_VALGRIND: yes
RUN_VALGRIND: no
EXTRAFLAGS:
HOST:
ECDH: no
RECOVERY: no
SCHNORRSIG: no
EXPERIMENTAL: no
CTIMETEST: yes
BENCH: yes
ITERS: 2
# We only need the top commit
CIRRUS_CLONE_DEPTH: 1

cat_logs_snippet: &CAT_LOGS
always:
test_logs_script:
- cat tests.log || true
- cat exhaustive_tests.log || true
- cat valgrind_ctime_test.log || true
- cat bench.log || true
on_failure:
debug_output_script:
- cat config.log || true
- cat test_env.log || true
- env

task:
name: "x86_64: Linux (Alpine Linux, Nix Shell)"
container:
dockerfile: ci/linux-nixos.Dockerfile
# Reduce number of CPUs to be able to do more builds in parallel.
cpu: 1
# More than enough for our scripts.
memory: 1G
matrix: &ENV_MATRIX
- env: {WIDEMUL: int64, RECOVERY: yes}
- env: {WIDEMUL: int64, ECDH: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes}
- env: {WIDEMUL: int128}
- env: {WIDEMUL: int128, RECOVERY: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes}
- env: {WIDEMUL: int128, ECDH: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes}
- env: {WIDEMUL: int128, ASM: x86_64}
- env: {BIGNUM: no}
- env: {BIGNUM: no, RECOVERY: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes}
- env: {BIGNUM: no, STATICPRECOMPUTATION: no}
- env: {BUILD: distcheck, WITH_VALGRIND: no, CTIMETEST: no, BENCH: no}
- env: {CPPFLAGS: -DDETERMINISTIC}
- env: {CFLAGS: -O0, CTIMETEST: no}
- env:
CFLAGS: "-fsanitize=undefined -fno-omit-frame-pointer"
LDFLAGS: "-fsanitize=undefined -fno-omit-frame-pointer"
UBSAN_OPTIONS: "print_stacktrace=1:halt_on_error=1"
BIGNUM: no
ASM: x86_64
ECDH: yes
RECOVERY: yes
EXPERIMENTAL: yes
SCHNORRSIG: yes
CTIMETEST: no
- env: { ECMULTGENPRECISION: 2 }
- env: { ECMULTGENPRECISION: 8 }
- env:
RUN_VALGRIND: yes
BIGNUM: no
ASM: x86_64
ECDH: yes
RECOVERY: yes
EXPERIMENTAL: yes
SCHNORRSIG: yes
EXTRAFLAGS: "--disable-openssl-tests"
BUILD:
matrix:
- env:
CC: gcc
- env:
CC: clang
test_script:
- nix-shell ci/shell.nix --run ./ci/cirrus.sh
<< : *CAT_LOGS

task:
name: "i686: Linux (Alpine Linux, Nix Shell)"
container:
dockerfile: ci/linux-nixos.Dockerfile
cpu: 1
memory: 1G
env:
HOST: i686-linux-gnu
ECDH: yes
RECOVERY: yes
EXPERIMENTAL: yes
SCHNORRSIG: yes
matrix:
- env:
CC: gcc
- env:
CC: clang
matrix:
- env:
BIGNUM: gmp
- env:
BIGNUM: no
test_script:
- nix-shell ci/shell-i686.nix --run ./ci/cirrus.sh
<< : *CAT_LOGS

task:
name: "x86_64: macOS Catalina"
macos_instance:
image: catalina-base
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
matrix:
<< : *ENV_MATRIX
matrix:
- env:
CC: gcc-9
- env:
CC: clang
# Update Command Line Tools
# Uncomment this if the Command Line Tools on the CirrusCI macOS image are too old to brew valgrind.
# See https://apple.stackexchange.com/a/195963 for the implementation.
## update_clt_script:
## - system_profiler SPSoftwareDataType
## - touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
## - |-
## PROD=$(softwareupdate -l | grep "*.*Command Line" | tail -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | sed 's/Label: //g' | tr -d '\n')
## # For debugging
## - softwareupdate -l && echo "PROD: $PROD"
## - softwareupdate -i "$PROD" --verbose
## - rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
##
brew_valgrind_pre_script:
- brew config
- brew tap --shallow LouisBrunner/valgrind
# Fetch valgrind source but don't build it yet.
- brew fetch --HEAD LouisBrunner/valgrind/valgrind
brew_valgrind_cache:
# This is $(brew --cellar valgrind) but command substition does not work here.
folder: /usr/local/Cellar/valgrind
# Rebuild cache if ...
fingerprint_script:
# ... macOS version changes:
- sw_vers
# ... brew changes:
- brew config
# ... valgrind changes:
- git -C "$(brew --cache)/valgrind--git" rev-parse HEAD
populate_script:
# If there's no hit in the cache, build and install valgrind.
- brew install --HEAD LouisBrunner/valgrind/valgrind
brew_valgrind_post_script:
# If we have restored valgrind from the cache, tell brew to create symlink to the PATH.
# If we haven't restored from cached (and just run brew install), this is a no-op.
- brew link valgrind
brew_script:
- brew install automake libtool gmp gcc@9
test_script:
- ./ci/cirrus.sh
<< : *CAT_LOGS

task:
name: "s390x (big-endian): Linux (Debian QEMU)"
container:
dockerfile: ci/linux-debian-s390-qemu.Dockerfile
cpu: 1
memory: 1G
env:
QEMU_CMD: qemu-s390x
HOST: s390x-linux-gnu
BUILD:
WITH_VALGRIND: no
BIGNUM: no
ECDH: yes
RECOVERY: yes
EXPERIMENTAL: yes
SCHNORRSIG: yes
CTIMETEST: no
test_script:
# https://sourceware.org/bugzilla/show_bug.cgi?id=27008
- rm /etc/ld.so.cache
- ./ci/cirrus.sh
<< : *CAT_LOGS
109 changes: 0 additions & 109 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
libsecp256k1
============

[![Build Status](https://travis-ci.org/bitcoin-core/secp256k1.svg?branch=master)](https://travis-ci.org/bitcoin-core/secp256k1)
[![Build Status](https://api.cirrus-ci.com/github/bitcoin-core/secp256k1.svg?branch=master)](https://cirrus-ci.com/github/bitcoin-core/secp256k1)

Optimized C library for ECDSA signatures and secret/public key operations on curve secp256k1.

Expand Down
42 changes: 29 additions & 13 deletions contrib/travis.sh → ci/cirrus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
set -e
set -x

if [ "$HOST" = "i686-linux-gnu" ]
then
export CC="$CC -m32"
fi
if [ "$TRAVIS_OS_NAME" = "osx" ] && [ "$TRAVIS_COMPILER" = "gcc" ]
then
export CC="gcc-9"
fi
export LC_ALL=C

env >> test_env.log

$CC -v || true
valgrind --version || true

./autogen.sh

# Nix doesn't store GNU file in /usr/bin, see https://lists.gnu.org/archive/html/bug-libtool/2015-09/msg00000.html .
# The -i'' is necessary for macOS portability, see https://stackoverflow.com/a/4247319 .
sed -i'' -e 's@/usr/bin/file@$(which file)@g' configure

./configure \
--enable-experimental="$EXPERIMENTAL" \
Expand All @@ -25,23 +29,35 @@ if [ -n "$BUILD" ]
then
make -j2 "$BUILD"
fi

if [ "$RUN_VALGRIND" = "yes" ]
then
make -j2
# the `--error-exitcode` is required to make the test fail if valgrind found errors, otherwise it'll return 0 (https://www.valgrind.org/docs/manual/manual-core.html)
valgrind --error-exitcode=42 ./tests 16
valgrind --error-exitcode=42 ./exhaustive_tests
fi

if [ -n "$QEMU_CMD" ]
then
make -j2
$QEMU_CMD ./tests 16
$QEMU_CMD ./exhaustive_tests
fi

if [ "$BENCH" = "yes" ]
then
# Using the local `libtool` because on macOS the system's libtool has nothing to do with GNU libtool
EXEC='./libtool --mode=execute'
if [ -n "$QEMU_CMD" ]
then
EXEC="$EXEC $QEMU_CMD"
fi
if [ "$RUN_VALGRIND" = "yes" ]
then
# Using the local `libtool` because on macOS the system's libtool has nothing to do with GNU libtool
EXEC='./libtool --mode=execute valgrind --error-exitcode=42'
else
EXEC=
EXEC="$EXEC valgrind --error-exitcode=42"
fi
# This limits the iterations in the benchmarks below to ITER(set in .travis.yml) iterations.
# This limits the iterations in the benchmarks below to ITER iterations.
export SECP256K1_BENCH_ITERS="$ITERS"
{
$EXEC ./bench_ecmult
Expand Down
6 changes: 6 additions & 0 deletions ci/linux-debian-s390-qemu.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM debian

RUN dpkg --add-architecture s390x
RUN apt-get update
RUN apt-get install --no-install-recommends --no-upgrade -y make automake libtool
RUN apt-get install --no-install-recommends --no-upgrade -y gcc-s390x-linux-gnu libc6-dev-s390x-cross qemu-user libc6:s390x
12 changes: 12 additions & 0 deletions ci/linux-nixos.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM nixos/nix

COPY ci/shell.nix /tmp
COPY ci/shell-i686.nix /tmp

RUN nix-channel --remove nixpkgs
RUN nix-channel --add https://nixos.org/channels/nixos-20.09 nixpkgs
RUN nix-channel --update

# Run dummy command "true" in the nix-shell just to get the packages prepared.
RUN nix-shell /tmp/shell.nix --command true
RUN nix-shell /tmp/shell-i686.nix --command true
Loading