Skip to content
Merged
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
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: make all
- name: Run tests
run: make test
- name: Create Release
Expand Down
22 changes: 14 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
CC=cc
CFLAGS=-O2 -pipe -Wshadow -Werror -I./include
CC ?= cc
CFLAGS ?= -O2 -pipe -Wall -Wextra -Wshadow -Werror -std=c99 -I./include

SRC = src/main.c src/validation_utils.c
TEST_SRC = tests/unit/test_validation.c src/validation_utils.c
TEST_BIN = tests/unit/test_validation

all: checkrc

checkrc:
$(CC) $(CFLAGS) src/main.c src/validation_utils.c -o checkrc
checkrc: $(SRC)
$(CC) $(CFLAGS) $^ -o $@

$(TEST_BIN): $(TEST_SRC)
$(CC) $(CFLAGS) $^ -o $@

test: checkrc
$(CC) $(CFLAGS) -o tests/unit/test_validation tests/unit/test_validation.c src/validation_utils.c
./tests/unit/test_validation
test: checkrc $(TEST_BIN)
./$(TEST_BIN)
sh tests/integration/test_checkrc.sh

clean:
rm -f checkrc tests/unit/test_validation
rm -f checkrc $(TEST_BIN)

.PHONY: all test clean
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ This command compiles and builds the entire project using FreeBSD `make`.

Don't worry if you're new to this or even if you’re facing some issues along the way; we're here to help! If you have any questions or need a bit of guidance, feel free to reach out by creating an issue in the repository or dropping us a message. Let’s make `checkrc` even better, together!

Thanks for being a part of our community!
Thanks for being a part of our community!
1 change: 1 addition & 0 deletions src/validation_utils.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>

#include "validation_utils.h"
#include <arpa/inet.h>
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_checkrc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ if [ $? -eq 0 ]; then
fi

echo "All integration tests passed successfully"
exit 0
exit 0
2 changes: 1 addition & 1 deletion tests/integration/test_files/invalid_rc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ defaultrouter="bad host!" # Invalid hostname
ipv6_defaultrouter="2001:db8::g" # Invalid IPv6
sshd_enable="enabled" # Invalid boolean
ntpd_enable="1" # Invalid boolean
rcshutdown_timeout="fast" # Invalid integer
rcshutdown_timeout="fast" # Invalid integer
2 changes: 1 addition & 1 deletion tests/integration/test_files/valid_rc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ defaultrouter="router.example.com"
ipv6_defaultrouter="fe80::1%em0"
sshd_enable="YES"
ntpd_enable="NO"
rcshutdown_timeout="30"
rcshutdown_timeout="30"
2 changes: 1 addition & 1 deletion tests/unit/minunit.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ static int tests_failed = 0;
printf("Tests failed: %d\n", tests_failed), \
tests_failed ? EXIT_FAILURE : EXIT_SUCCESS)

#endif
#endif
1 change: 1 addition & 0 deletions tests/unit/test_validation.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ MU_TEST_SUITE(test_suite) {
MU_RUN_TEST(test_boolean_validation);
MU_RUN_TEST(test_integer_validation);
MU_RUN_TEST(test_string_validation);
return NULL;
}

int main() {
Expand Down