Add windows and macOS tests (#148)

Update the github actions workflow to v3 and add windows and macOS tests.
This commit is contained in:
Bailey Thompson
2022-04-29 23:36:25 -04:00
committed by GitHub
parent d7c0177b34
commit a270dc1a1d
7 changed files with 61 additions and 25 deletions

View File

@@ -2,28 +2,52 @@ name: build
on: [push]
jobs:
debug:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: make test_debug
- run: ./ContainersTestDebug
optimized:
runs-on: ubuntu-latest
- run: ./ContainersTest
debug_windows:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: make test_debug_no_malloc_fail
- run: ./ContainersTest
optimized:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- run: make test_optimized
- run: ./ContainersTestOptimized
- run: ./ContainersTest
optimized_windows:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
steps:
- uses: actions/checkout@v3
- run: make test_optimized_no_malloc_fail
- run: ./ContainersTest
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: make test_coverage
- run: ./ContainersTestCoverage
- run: ./ContainersTest
- run: bash <(curl -s https://codecov.io/bash)
valgrind:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: sudo apt install -y valgrind
- run: make test_valgrind
- run: valgrind --leak-check=full --error-exitcode=1 ./ContainersTestValgrind
- run: make test_debug_no_malloc_fail
- run: valgrind --leak-check=full --error-exitcode=1 ./ContainersTest

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2017-2020 Bailey Thompson
Copyright (c) 2017-2022 Bailey Thompson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -23,15 +23,20 @@ header:
python3 compile_headers.py $(version)
test_debug:
@gcc src/*.c tst/*.c -Wall -Wextra -Wpedantic -Werror -std=c89 -O0 -ldl -o ContainersTestDebug
@gcc src/*.c tst/*.c -Wall -Wextra -Wpedantic -Werror -std=c89 -O0 -ldl -o ContainersTest
test_optimized:
@gcc src/*.c tst/*.c -Wall -Wextra -Wpedantic -Werror -std=c89 -O3 -ldl -o ContainersTestOptimized
@gcc src/*.c tst/*.c -Wall -Wextra -Wpedantic -Werror -std=c89 -O3 -ldl -o ContainersTest
test_debug_no_malloc_fail:
@sed -i 's/STUB_MALLOC 1/STUB_MALLOC 0/g' tst/test.h
@gcc src/*.c tst/*.c -Wall -Wextra -Wpedantic -Werror -std=c89 -O0 -o ContainersTest
@sed -i 's/STUB_MALLOC 0/STUB_MALLOC 1/g' tst/test.h
test_optimized_no_malloc_fail:
@sed -i 's/STUB_MALLOC 1/STUB_MALLOC 0/g' tst/test.h
@gcc src/*.c tst/*.c -Wall -Wextra -Wpedantic -Werror -std=c89 -O3 -o ContainersTest
@sed -i 's/STUB_MALLOC 0/STUB_MALLOC 1/g' tst/test.h
test_coverage:
@gcc src/*.c tst/*.c -Wall -Wextra -Wpedantic -Werror -std=c89 -O0 -ldl -g -coverage -o ContainersTestCoverage
test_valgrind:
@sed -i 's/STUB_MALLOC 1/STUB_MALLOC 0/g' tst/test.h
@gcc src/*.c tst/*.c -Wall -Wextra -Wpedantic -Werror -std=c89 -O0 -o ContainersTestValgrind
@sed -i 's/STUB_MALLOC 0/STUB_MALLOC 1/g' tst/test.h
@gcc src/*.c tst/*.c -Wall -Wextra -Wpedantic -Werror -std=c89 -O0 -ldl -g -coverage -o ContainersTest

View File

@@ -638,6 +638,7 @@ static int compare_dummy(const void *const one, const void *const two)
(void) one;
(void) two;
assert(0);
return 5;
}
static void test_big_object(void)

View File

@@ -18,8 +18,9 @@ static unsigned long hash_int(const void *const key)
return hash;
}
static unsigned long bad_hash_int()
static unsigned long bad_hash_int(const void *const key)
{
(void) key;
return 5;
}
@@ -419,9 +420,12 @@ static int compare_big_object(const void *const one, const void *const two)
return a->n - b->n;
}
static int compare_dummy()
static int compare_dummy(const void *const one, const void *const two)
{
(void) one;
(void) two;
assert(0);
return 5;
}
static void test_big_object(void)

View File

@@ -18,8 +18,9 @@ static unsigned long hash_int(const void *const key)
return hash;
}
static unsigned long bad_hash_int()
static unsigned long bad_hash_int(const void *const key)
{
(void) key;
return 5;
}

View File

@@ -18,8 +18,9 @@ static unsigned long hash_int(const void *const key)
return hash;
}
static unsigned long bad_hash_int()
static unsigned long bad_hash_int(const void *const key)
{
(void) key;
return 5;
}