Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add a basic CI #15

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
# vi: ts=2 sw=2 et:

name: Build test
on: [pull_request]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-20.04
concurrency:
group: ${{ github.workflow }}-${{ toJSON(matrix.env) }}-${{ github.ref }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
env:
- {
TYPE: "default",
CFLAGS: "-Werror -Wextra"
}
- {
TYPE: "asan+ubsan",
CFLAGS: "-Werror -Wextra -fsanitize=address,undefined",
ASAN_OPTIONS: "strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:abort_on_error=1",
UBSAN_OPTIONS: "print_stacktrace=1:print_summary=1:halt_on_error=1"
}
env: ${{ matrix.env }}
name: ${{ matrix.env.TYPE }}
steps:
- name: Repository checkout
uses: actions/checkout@v2

- name: Install dependencies
run: |
sudo apt -y update
sudo apt -y install gcc libglib2.0-dev libffi-dev make

- name: Build
run: |
make -C src
./src/dfuzzer -V
./src/dfuzzer -s -l
sudo make -C src install

- name: Test
run: |
# Test as an unprivileged user
dfuzzer -v -n org.freedesktop.systemd1
# Test as root
sudo dfuzzer -v -n org.freedesktop.systemd1
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.sw*
*.o
tags
src/dfuzzer
src/makefile.dep
3 changes: 3 additions & 0 deletions .vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set noet
set tabstop=4
set shiftwidth=4
15 changes: 10 additions & 5 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@
# Copyright(C) 2014, 2015, Red Hat, Inc., Matus Marhefka <[email protected]>
#==============================================================================

CC=gcc
CFLAGS=-Wall -w -O2 -D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 `pkg-config --cflags --libs gio-2.0 libffi` -g
OBJ=dfuzzer.o introspection.o fuzz.o rand.o
TARGET=dfuzzer
CC ?= gcc
CFLAGS += -Wall -w -O2 -D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 `pkg-config --cflags --libs gio-2.0 libffi` -g
OBJ = dfuzzer.o introspection.o fuzz.o rand.o
TARGET = dfuzzer
all: dfuzzer
.PHONY: doc man clean
.PHONY: doc man clean install


makefile.dep:
$(CC) -MM *.c >makefile.dep
$(TARGET): $(OBJ)
$(CC) $(OBJ) $(CFLAGS) -o $(TARGET)

install: $(TARGET) man
install -pm 0755 $(TARGET) /usr/bin/$(TARGET)
install -pm 0644 dfuzzer.conf /etc/dfuzzer.conf
install -pm 0644 ../man/dfuzzer.1.gz /usr/share/man/man1/dfuzzer.1.gz

doc:
doxygen doxyfile

Expand Down