Skip to content

Commit

Permalink
ci: Explicitly test v2 and v2_wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
ribose-jeffreylau committed Jan 28, 2022
1 parent 6b97b86 commit 60f2ad7
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 39 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-10.15, macos-11.0]
retrace-test: [v1, v2, v2wrapper]
if: "!contains(github.event.head_commit.message, 'skip ci')"

steps:
Expand All @@ -68,9 +69,5 @@ jobs:
for var in OPENSSL_PREFIX PKG_CONFIG_PATH LDFLAGS CPPFLAGS PATH; do echo "${var}=${!var}" | tee -a "${GITHUB_ENV}"; done
cd /usr/local/include
sudo ln -s "${OPENSSL_PREFIX}/include/openssl" .
- name: Configure
run: |
./autogen.sh
./configure --enable-tests
- name: Build
run: ./ci/main.sh
run: ./ci/main.sh ${{ matrix.retrace-test }}
4 changes: 3 additions & 1 deletion .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
retrace-test: [v1, v2, v2wrapper]
if: "!contains(github.event.head_commit.message, 'skip ci')"

steps:
Expand All @@ -47,4 +48,5 @@ jobs:
- uses: cachix/install-nix-action@v15
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix-build
- run: |
nix build .#${{ matrix.retrace-test }} || { nix log /nix/store/*-retrace-unstable.drv ; exit 1 ; }
7 changes: 2 additions & 5 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
retrace-test: [v1, v2, v2wrapper]
if: "!contains(github.event.head_commit.message, 'skip ci')"

steps:
Expand All @@ -59,9 +60,5 @@ jobs:
run: |
./ci/before_install.sh
./ci/install.sh cmocka libnereon
- name: Configure
run: |
./autogen.sh
./configure --enable-tests
- name: Build
run: ./ci/main.sh
run: ./ci/main.sh ${{ matrix.retrace-test }}
9 changes: 3 additions & 6 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ jobs:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
retrace-test: [v1, v2, v2wrapper]
if: "!contains(github.event.head_commit.message, 'skip ci')"

defaults:
Expand All @@ -70,10 +72,5 @@ jobs:
./ci/before_install.sh
./ci/install.sh libnereon
- name: Configure
run: |
./autogen.sh
./configure --enable-tests
- name: Build
run: ./ci/main.sh
run: ./ci/main.sh ${{ matrix.retrace-test }}
61 changes: 42 additions & 19 deletions ci/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,53 @@ CFLAGS="-I${CMOCKA_INSTALL}/include"

export LD_LIBRARY_PATH CFLAGS LDFLAGS

install_retrace() {
. ci/lib.sh

: "${SUDO:=$(get_sudo)}"

test_retrace() {
{ [[ ! -r Makefile ]] || make clean ; } && \
sh autogen.sh && \
./configure \
--disable-silent-rules \
--with-cmocka="${CMOCKA_INSTALL}" \
--enable-tests && \
make clean && \
make

sudo make install
./configure "$@" && \
make ${MAKE_FLAGS:+$MAKE_FLAGS}

$SUDO make install
make check
}

test_retrace() {
make clean
./configure \
test_retracev1() {
test_retrace \
--disable-silent-rules \
--with-cmocka="${CMOCKA_INSTALL}" \
--enable-tests
}

test_retracev2() {
MAKE_FLAGS=V=1 test_retrace \
--enable-v2 \
--enable-tests && \
make clean
make V=1
--enable-tests
}

sudo make install
make check
test_retracev2wrapper() {
MAKE_FLAGS=V=1 test_retrace \
--enable-v2 \
--enable-v2_wrapper \
--enable-tests
}

main() {
# Run these tests by default
if [[ $# -lt 1 ]]
then
test_retracev1
test_retracev2
test_retracev2wrapper
else
for arg in "$@"
do
test_retrace"$arg"
done
fi
}

install_retrace
test_retrace
main "$@"
7 changes: 5 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
defaultPackage = pkgs.callPackage ./default.nix { };
rec {
packages.v1 = pkgs.callPackage ./nix/default.nix { };
packages.v2 = pkgs.callPackage ./nix/v2.nix { };
packages.v2wrapper = pkgs.callPackage ./nix/v2wrapper.nix { };
defaultPackage = packages.v1;
});
}
6 changes: 5 additions & 1 deletion default.nix → nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ stdenv.mkDerivation rec {
pname = "retrace";
version = "unstable";

src = ./.;
src = ./..;

buildInputs = with pkgs; [
openssl
];

configureFlags = [
"--disable-silent-rules"
"--enable-tests"
"--with-cmocka=${pkgs.cmocka}"
];

nativeBuildInputs = with pkgs; [
Expand All @@ -26,6 +28,8 @@ stdenv.mkDerivation rec {
cmocka
];

doCheck = true;

outputs = [ "out" "lib" "dev" ];

meta = with lib; {
Expand Down
9 changes: 9 additions & 0 deletions nix/v2.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{ pkgs ? import <nixpkgs> { }
, lib ? pkgs.lib
, stdenv ? pkgs.stdenv
}:

(pkgs.callPackage ./default.nix { }).overrideAttrs (oldAttrs: {
configureFlags = oldAttrs.configureFlags ++ [ "--enable-v2" ];
makeFlags = [ "V=1" ];
})
8 changes: 8 additions & 0 deletions nix/v2wrapper.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ pkgs ? import <nixpkgs> { }
, lib ? pkgs.lib
, stdenv ? pkgs.stdenv
}:

(pkgs.callPackage ./v2.nix { }).overrideAttrs (oldAttrs: {
configureFlags = oldAttrs.configureFlags ++ [ "--enable-v2_wrapper" ];
})

0 comments on commit 60f2ad7

Please sign in to comment.