aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-11-25 17:16:27 +0200
committerkaotisk <kaotisk@arching-kaos.org>2024-11-25 17:16:27 +0200
commit5402530100772eb3a8db649a52ee454145ae54dc (patch)
tree9758b68b285281dad08b54e43cf28550bc7626ab
parent8d3b10983b3bd886ce6cb379bdeee9358bd52e03 (diff)
downloadarching-kaos-tools-5402530100772eb3a8db649a52ee454145ae54dc.tar.gz
arching-kaos-tools-5402530100772eb3a8db649a52ee454145ae54dc.tar.bz2
arching-kaos-tools-5402530100772eb3a8db649a52ee454145ae54dc.zip
Test for aklog.c and build systemHEADorigin/masterorigin/HEADmaster
-rwxr-xr-xsrc/build.sh8
-rw-r--r--src/tests/test_aklog.c66
2 files changed, 74 insertions, 0 deletions
diff --git a/src/build.sh b/src/build.sh
index 440bca6..3ad716e 100755
--- a/src/build.sh
+++ b/src/build.sh
@@ -17,3 +17,11 @@ gcc -Wextra -Wall -Werror -pedantic -ggdb -Wl,-rpath=lib -I./include tests/test_
echo "Running test_akfs_mkdir" && \
time ./tests/test_akfs_mkdir
rm ./tests/test_akfs_mkdir
+
+echo "Building lib/aklog.so" && \
+gcc -c -shared -Wextra -Wall -Werror -pedantic -ggdb -fPIC -I./include aklog.c -o lib/aklog.so && \
+echo "Building tests/test_aklog" && \
+gcc -Wextra -Wall -Werror -pedantic -ggdb -Wl,-rpath=lib -I./include tests/test_aklog.c lib/aklog.so -o tests/test_aklog && \
+echo "Running test_aklog" && \
+time ./tests/test_aklog
+rm ./tests/test_aklog
diff --git a/src/tests/test_aklog.c b/src/tests/test_aklog.c
new file mode 100644
index 0000000..934124d
--- /dev/null
+++ b/src/tests/test_aklog.c
@@ -0,0 +1,66 @@
+#include <aklog.h>
+
+void test_message_output()
+{
+ ak_log_print_log_line("1731664790 <TEST> [INFO] test message info");
+}
+
+void test_follow()
+{
+ ak_log_follow();
+}
+
+void test_grep()
+{
+ ak_log_grep("-h");
+}
+
+void test_rotate()
+{
+ ak_log_rotate();
+}
+
+void test_log_message()
+{
+ ak_log_message("TEST", "TEST", "test message info");
+}
+
+void test_exit()
+{
+ ak_log_exit("TEST", "test message info");
+}
+
+void test_warning()
+{
+ ak_log_warning("TEST", "test message info");
+}
+
+void test_debug()
+{
+ ak_log_debug("TEST", "test message info");
+}
+
+void test_error()
+{
+ ak_log_error("TEST", "test message info");
+}
+
+void test_info()
+{
+ ak_log_info("TEST", "test message info");
+}
+
+int main (void)
+{
+ test_follow();
+ test_message_output();
+ test_info();
+ test_exit();
+ test_error();
+ test_debug();
+ test_warning();
+ test_log_message();
+ test_rotate();
+ test_grep();
+ return 0;
+}