Index

lognestmonster / bdcc00b

A general-purpose single-header C logging library and parser for event-based logs. (Incomplete)

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
17629 Jan 2020 22:4222a7c5dAdd test to check executable size for each optimization levelJosh Stockin1121G

Blob @ lognestmonster / test

text/x-shellscript984 bytesdownload raw
1#!/usr/bin/env bash
2
3success() {
4 echo -e "\033[92m\033[1m\033[7m${@}\033[0m"
5}
6
7success_lite() {
8 echo -e "\033[92m${@}\033[0m"
9}
10
11error() {
12 echo -e "\033[91m\033[7m\033[1m${@}\033[0m"
13}
14
15warn() {
16 echo -e "\033[93m\033[1m\033[7m${@}\033[0m"
17}
18
19warn_lite() {
20 echo -e "\033[93m${@}\033[0m"
21}
22
23exit_on_error() {
24 if [ $1 -ne 0 ]
25 then
26 error "Error in test. Exiting..."
27 exit $1
28 else
29 success_lite "Success in test."
30 fi
31}
32
33handle() {
34 $1
35 exit_on_error $?
36}
37
38help() {
39 echo "Usage: ./test [help] [c_unit] [size]"
40}
41
42c_unit() {
43 warn "Running C unit test chain"
44 echo
45
46 # Compile C unit tests
47 warn_lite "Making C header unit test"
48 handle make c_unit
49 echo
50
51 warn_lite "Running C header unit test"
52 handle bin/c
53 echo
54
55 success "Finished"
56}
57
58size() {
59 warn "Running size test on optimization levels"
60 echo
61
62 warn_lite "Compiling and getting file sizes"
63 handle tests/size.py
64 echo
65
66 success "Finished"
67}
68
69for test in "$@"
70do
71 $test
72done
73
74echo -e "finished: ${SECONDS} seconds"
75