add regression testing tasks (#664)

This commit is contained in:
bmc-msft
2021-03-18 15:37:19 -04:00
committed by GitHub
parent 34b2a739cb
commit 6e60a8cf10
50 changed files with 2141 additions and 203 deletions

View File

@ -0,0 +1,16 @@
CC=clang
CFLAGS=-g3 -fsanitize=fuzzer -fsanitize=address
all: broken.exe fixed.exe
broken.exe: simple.c
$(CC) $(CFLAGS) simple.c -o broken.exe
fixed.exe: simple.c
$(CC) $(CFLAGS) simple.c -o fixed.exe -DFIXED
.PHONY: clean
clean:
rm -f broken.exe fixed.exe

View File

@ -0,0 +1 @@
good

View File

@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include <stdint.h>
#include <stdlib.h>
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t len) {
int cnt = 0;
if (len < 3) {
return 0;
}
if (data[0] == 'x') { cnt++; }
if (data[1] == 'y') { cnt++; }
if (data[2] == 'z') { cnt++; }
#ifndef FIXED
if (cnt >= 3) {
abort();
}
#endif
return 0;
}