Skip to content

Commit e4bc215

Browse files
Set optimization flag to -O3 and error on warninings (#42)
* add opt flags and error flags Signed-off-by: Matthias J. Kannwischer <[email protected]> * failed ci if there is any error for running the tests Signed-off-by: Thing-han, Lim <[email protected]> * failed tests script if make failed Signed-off-by: Thing-han, Lim <[email protected]> * fix array boundary check in nistkat test Signed-off-by: Thing-han, Lim <[email protected]> * remove pedantic flag Signed-off-by: Thing-han, Lim <[email protected]> --------- Signed-off-by: Matthias J. Kannwischer <[email protected]> Signed-off-by: Thing-han, Lim <[email protected]> Co-authored-by: Thing-han, Lim <[email protected]>
1 parent 77e957b commit e4bc215

File tree

5 files changed

+24
-13
lines changed

5 files changed

+24
-13
lines changed

.github/workflows/build.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,21 @@ jobs:
2626
shell: nix develop .#ci -c bash -e {0}
2727
run: |
2828
make_platform() {
29-
echo "::group::make platform $1"
30-
make PLATFORM="$1"
31-
echo "::endgroup::"
29+
echo "::group::make platform $1"
30+
make PLATFORM="$1"
31+
code1=$?
32+
echo "::endgroup::"
3233
33-
echo "::group::make platform $1 nistkat"
34-
make PLATFORM="$1" RNG=NISTKAT nistkat
35-
echo "::endgroup::"
34+
echo "::group::make platform $1 nistkat"
35+
make PLATFORM="$1" RNG=NISTKAT nistkat
36+
code2=$?
37+
echo "::endgroup::"
38+
39+
return $(( code1 || code2 ))
3640
}
3741
3842
export -f make_platform
39-
tests --list-platforms | grep -v "mps2" | xargs -I {} bash -c 'make_platform "$@"' _ {}
43+
tests --list-platforms | grep -v "mps2" | xargs -I {} bash -c 'make_platform "$@" || exit 1' _ {}
4044
4145
- name: Functional test
4246
id: func_test

mk/config.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ LIBDEPS += obj/libhal.a
6060
include mk/$(PLATFORM).mk
6161

6262
CFLAGS += \
63+
-O3 \
6364
-std=gnu99 \
6465
--sysroot=$(SYSROOT) \
65-
-Wall -Wextra -Wshadow \
66+
-Wall -Wextra -Wshadow -Werror \
6667
-MMD \
6768
-fno-common \
6869
-Imlkem -Ifips202 -Ihal \

scripts/ci/tests-qemu

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,31 @@ _run()
1212
local platform="$2"
1313
echo "::group:: $test_type test for $platform"
1414
tests "$test_type" "$platform" -v
15+
code=$?
1516
echo "::endgroup::"
17+
return $code
1618
}
1719

1820
export -f _run
1921

2022
func()
2123
{
22-
tests --list-platforms | grep "mps2" | xargs -I {} bash -c '_run func "$@"' _ {}
24+
tests --list-platforms | grep "mps2" | xargs -I {} bash -c '_run func "$@" || exit 1' _ {}
2325
}
2426

2527
speed()
2628
{
27-
tests --list-platforms | grep "mps2" | xargs -I {} bash -c '_run speed "$@"' _ {}
29+
tests --list-platforms | grep "mps2" | xargs -I {} bash -c '_run speed "$@" || exit 1' _ {}
2830
}
2931

3032
stack()
3133
{
32-
tests --list-platforms | grep "mps2" | xargs -I {} bash -c '_run stack "$@"' _ {}
34+
tests --list-platforms | grep "mps2" | xargs -I {} bash -c '_run stack "$@" || exit 1' _ {}
3335
}
3436

3537
nistkat()
3638
{
37-
tests --list-platforms | grep "mps2" | xargs -I {} bash -c '_run nistkat "$@"' _ {}
39+
tests --list-platforms | grep "mps2" | xargs -I {} bash -c '_run nistkat "$@" || exit 1' _ {}
3840
}
3941

4042
declare -f -F "$1" && true >/dev/null

scripts/tests

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ def base_test(
202202
)
203203
logging.info(format(subprocess.list2cmdline(p.args)))
204204

205+
if p.returncode != 0:
206+
logging.error("make failed")
207+
sys.exit(1)
208+
205209
def check(file, expect, actual):
206210
if actual != expect:
207211
logging.error(

test/nistkat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ size_t format_bstr(char *buf, const char *S, const uint8_t *A, size_t L) {
3737

3838
void inc_hash_bstr(shake256incctx *state, const char *S, const uint8_t *A, size_t L) {
3939
size_t len;
40-
char buf[strlen(S) + 2 * L + 1];
40+
char buf[strlen(S) + 2 * L + 2];
4141

4242
len = format_bstr(buf, S, A, L);
4343
len += snprintf(buf + strlen(S) + 2 * L, 2, "\n");

0 commit comments

Comments
 (0)