diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 89e97bc..feedc9f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/LICENSE b/LICENSE index b9b5272..d95b5af 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/Makefile b/Makefile index 4afaa4f..1f4b33b 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/tst/test_multimap.c b/tst/test_multimap.c index b793d6b..fa82a91 100644 --- a/tst/test_multimap.c +++ b/tst/test_multimap.c @@ -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) diff --git a/tst/test_unordered_multimap.c b/tst/test_unordered_multimap.c index c62387c..d21a14b 100644 --- a/tst/test_unordered_multimap.c +++ b/tst/test_unordered_multimap.c @@ -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) diff --git a/tst/test_unordered_multiset.c b/tst/test_unordered_multiset.c index 3cf52ca..0f22677 100644 --- a/tst/test_unordered_multiset.c +++ b/tst/test_unordered_multiset.c @@ -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; } diff --git a/tst/test_unordered_set.c b/tst/test_unordered_set.c index 57b7c0d..ad4e3d2 100644 --- a/tst/test_unordered_set.c +++ b/tst/test_unordered_set.c @@ -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; }