Skip to content

Commit

Permalink
Merge #922: Add mingw32-w64/wine CI build
Browse files Browse the repository at this point in the history
ed5a199 tests: fopen /dev/urandom in binary mode (Tim Ruffing)
4dc37bf Add mingw32-w64/wine CI build (Pieter Wuille)

Pull request description:

ACKs for top commit:
  real-or-random:
    ACK ed5a199
  jonasnick:
    utACK ed5a199

Tree-SHA512: 45afc394e3a200f7c020426a66f78df8d12827b9dc91bb04dc1708c3ad5cdc4e7d20554d6d5c046d288552f4e722d4fe8a0f3234b662e7351a4d27aaaeb0d5c0
  • Loading branch information
jonasnick committed May 2, 2021
2 parents 7012a18 + ed5a199 commit 34388af
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
21 changes: 21 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,24 @@ task:
- rm /etc/ld.so.cache
- ./ci/cirrus.sh
<< : *CAT_LOGS

task:
name: "x86_64 (mingw32-w64): Windows (Debian stable, Wine)"
container:
dockerfile: ci/linux-debian.Dockerfile
cpu: 1
memory: 1G
env:
WINE_CMD: wine64-stable
HOST: x86_64-w64-mingw32
BUILD:
WITH_VALGRIND: no
ECDH: yes
RECOVERY: yes
EXPERIMENTAL: yes
SCHNORRSIG: yes
CTIMETEST: no
<< : *MERGE_BASE
test_script:
- ./ci/cirrus.sh
<< : *CAT_LOGS
12 changes: 11 additions & 1 deletion ci/cirrus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ valgrind --version || true
make

# Print information about binaries so that we can see that the architecture is correct
file *tests || true
file *tests* || true
file bench_* || true
file .libs/* || true

Expand All @@ -47,6 +47,12 @@ then
$QEMU_CMD ./exhaustive_tests
fi

if [ -n "$WINE_CMD" ]
then
$WINE_CMD ./tests 16
$WINE_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
Expand All @@ -59,6 +65,10 @@ then
then
EXEC="$EXEC valgrind --error-exitcode=42"
fi
if [ -n "$WINE_CMD" ]
then
EXEC="$WINE_CMD"
fi
# This limits the iterations in the benchmarks below to ITER iterations.
export SECP256K1_BENCH_ITERS="$ITERS"
{
Expand Down
6 changes: 5 additions & 1 deletion ci/linux-debian.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ RUN apt-get install --no-install-recommends --no-upgrade -y \
make automake libtool pkg-config dpkg-dev valgrind qemu-user \
gcc clang libc6-dbg \
gcc-i686-linux-gnu libc6-dev-i386-cross libc6-dbg:i386 \
gcc-s390x-linux-gnu libc6-dev-s390x-cross libc6-dbg:s390x
gcc-s390x-linux-gnu libc6-dev-s390x-cross libc6-dbg:s390x \
wine gcc-mingw-w64-x86-64

# Run a dummy command in wine to make it set up configuration
RUN wine64-stable xcopy || true
2 changes: 1 addition & 1 deletion src/testrand_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static void secp256k1_testrand_init(const char* hexseed) {
pos++;
}
} else {
FILE *frand = fopen("/dev/urandom", "r");
FILE *frand = fopen("/dev/urandom", "rb");
if ((frand == NULL) || fread(&seed16, 1, sizeof(seed16), frand) != sizeof(seed16)) {
uint64_t t = time(NULL) * (uint64_t)1337;
fprintf(stderr, "WARNING: could not read 16 bytes from /dev/urandom; falling back to insecure PRNG\n");
Expand Down

0 comments on commit 34388af

Please sign in to comment.