2023-08-08 01:40:21 -04:00
|
|
|
# _,.---._ .-._ .--.-. ,--.--------.
|
|
|
|
# _,..---._ ,-.' , - `. /==/ \ .-._/==/ //==/, - , -\
|
|
|
|
# /==/, - \ /==/_, , - \|==|, \/ /, |==\ -\\==\.-. - ,-./
|
|
|
|
# |==| _ _\==| .=. |==|- \| | \==\- \`--`\==\- \
|
|
|
|
# |==| .=. |==|_ : ;=: - |==| , | -| `--`-' \==\_ \
|
|
|
|
# |==|,| | -|==| , '=' |==| - _ | |==|- |
|
|
|
|
# |==| '=' /\==\ - ,_ /|==| /\ , | |==|, |
|
|
|
|
# |==|-, _`/ '.='. - .' /==/, | |- | /==/ -/
|
|
|
|
# `-.`.____.' `--`--'' `--`./ `--` `--`--`
|
|
|
|
# _ __ ,---. .-._ .=-.-. _,.----.
|
|
|
|
# .-`.' ,`..--.' \ /==/ \ .-._ /==/_ /.' .' - \
|
|
|
|
# /==/, - \==\-/\ \ |==|, \/ /, /==|, |/==/ , ,-'
|
|
|
|
# |==| _ .=. /==/-|_\ | |==|- \| ||==| ||==|- | .
|
|
|
|
# |==| , '=',\==\, - \ |==| , | -||==|- ||==|_ `-' \
|
|
|
|
# |==|- '..'/==/ - ,| |==| - _ ||==| ,||==| _ , |
|
|
|
|
# |==|, | /==/- /\ - \|==| /\ , ||==|- |\==\. /
|
|
|
|
# /==/ - | \==\ _.\=\.-'/==/, | |- |/==/. / `-.`.___.-'
|
|
|
|
# `--`---' `--` `--`./ `--``--`-`
|
|
|
|
#
|
|
|
|
# @(#)Copyright (c) 2023, Nathan D. Fisher.
|
|
|
|
#
|
|
|
|
# This is free software. It comes with NO WARRANTY.
|
|
|
|
# Permission to use, modify and distribute this source code
|
|
|
|
# is granted subject to the following conditions.
|
|
|
|
# 1/ that the above copyright notice and this notice
|
|
|
|
# are preserved in all copies and that due credit be given
|
|
|
|
# to the author.
|
|
|
|
# 2/ that any changes to this code are clearly commented
|
|
|
|
# as such so that the author does not get blamed for bugs
|
|
|
|
# other than his own.
|
|
|
|
#
|
|
|
|
|
2023-08-22 22:47:15 -04:00
|
|
|
include ../config.mk
|
|
|
|
|
2023-08-09 11:41:06 -04:00
|
|
|
CFLAGS += -I../include
|
2023-08-10 22:42:43 -04:00
|
|
|
LDLIBS += ../libhaggis.a
|
2023-08-22 22:47:15 -04:00
|
|
|
LDLIBS += $(LIBS)
|
2023-08-08 01:40:21 -04:00
|
|
|
|
2023-08-09 23:02:37 -04:00
|
|
|
tests += store_u16
|
|
|
|
tests += load_u16
|
2023-08-09 23:56:59 -04:00
|
|
|
tests += store_u32
|
|
|
|
tests += load_u32
|
|
|
|
tests += store_u64
|
|
|
|
tests += load_u64
|
2023-08-09 15:28:02 -04:00
|
|
|
tests += store_header
|
|
|
|
tests += check_header
|
2023-08-09 11:41:06 -04:00
|
|
|
tests += store_device
|
|
|
|
tests += load_device
|
2023-08-09 12:02:37 -04:00
|
|
|
tests += store_md5
|
|
|
|
tests += load_md5
|
|
|
|
tests += store_sha1
|
|
|
|
tests += load_sha1
|
2023-08-09 13:11:46 -04:00
|
|
|
tests += store_sha256
|
|
|
|
tests += load_sha256
|
2023-08-09 15:28:02 -04:00
|
|
|
tests += init_file_md5
|
|
|
|
tests += init_file_sha1
|
2023-08-09 23:02:37 -04:00
|
|
|
tests += init_file_sha256
|
|
|
|
tests += store_file_md5
|
2023-08-09 23:56:59 -04:00
|
|
|
tests += load_file_md5
|
2023-08-10 09:48:10 -04:00
|
|
|
tests += store_file_sha1
|
|
|
|
tests += load_file_sha1
|
|
|
|
tests += store_file_sha256
|
|
|
|
tests += load_file_sha256
|
2023-08-13 22:57:15 -04:00
|
|
|
tests += fnv1a_hash_inode
|
|
|
|
tests += fnv1a_hash_str
|
2023-08-19 19:42:00 -04:00
|
|
|
tests += linkmap_init
|
2023-08-22 22:37:59 -04:00
|
|
|
tests += linkmap_put
|
2023-09-13 16:41:59 -04:00
|
|
|
tests += create_dir_node
|
2023-09-15 01:49:16 -04:00
|
|
|
tests += create_symlink_node
|
2023-09-15 19:15:01 -04:00
|
|
|
tests += create_fifo_node
|
|
|
|
tests += create_dev_node
|
2023-09-16 18:58:41 -04:00
|
|
|
tests += create_file_node
|
2023-09-18 18:28:40 -04:00
|
|
|
tests += mq_push_pop
|
2023-10-03 01:53:59 -04:00
|
|
|
tests += extract_dev_node
|
2023-10-04 10:48:40 -04:00
|
|
|
tests += extract_dir_node
|
2023-10-05 10:40:12 -04:00
|
|
|
tests += extract_fifo_node
|
2023-11-12 19:04:40 -05:00
|
|
|
tests += extract_file_node
|
2023-11-20 19:05:11 -05:00
|
|
|
tests += extract_symlink_node
|
2023-12-01 16:03:31 -05:00
|
|
|
tests += extract_hardlink_node
|
2023-08-13 22:57:15 -04:00
|
|
|
|
2023-08-09 13:11:46 -04:00
|
|
|
total != echo $(tests) | wc -w | awk '{ print $$1 }'
|
2023-08-09 11:41:06 -04:00
|
|
|
|
|
|
|
.PHONY: test
|
2023-08-10 22:42:43 -04:00
|
|
|
test: $(tests) output
|
2023-08-10 09:48:10 -04:00
|
|
|
@echo -e "\n\t=== \e[0;33mRunning $(total) tests\e[0m ===\n"
|
2023-10-03 01:53:59 -04:00
|
|
|
@idx=1 ; success=0 ; fail=0; skip=0; for t in $(tests) ; \
|
2023-08-10 22:42:43 -04:00
|
|
|
do printf "[%02i/$(total)] %-25s" $${idx} $${t} ; \
|
2023-08-09 11:41:06 -04:00
|
|
|
idx=$$(expr $${idx} + 1) ; \
|
|
|
|
./$${t} ; \
|
2023-10-03 01:53:59 -04:00
|
|
|
retval=$$? ; \
|
|
|
|
if [ $${retval} -eq 0 ] ; \
|
2023-08-09 11:41:06 -04:00
|
|
|
then echo -e '\e[0;32mSuccess\e[0m' ; \
|
|
|
|
success=$$(expr $${success} + 1) ; \
|
2023-10-03 01:53:59 -04:00
|
|
|
elif [ $${retval} -eq 255 ] ; \
|
|
|
|
then echo Skipped ; \
|
|
|
|
skip=$$(expr $${skip} + 1) ; \
|
2023-08-09 11:41:06 -04:00
|
|
|
else echo -e '\e[0;31mFailure\e[0m' ; \
|
|
|
|
fail=$$(expr $${fail} + 1) ; \
|
2023-08-10 22:49:05 -04:00
|
|
|
fi ; done || true ; \
|
2023-08-28 22:44:35 -04:00
|
|
|
if [ $${fail} == 0 ] ; \
|
2023-10-03 01:53:59 -04:00
|
|
|
then echo -e '\nResults: \e[0;32mOk\e[0m.' "$${success} succeeded; $${fail} failed; $${skip} skipped" ; \
|
|
|
|
else echo -e '\nResults: \e[0;31mFAILED\e[0m.' "$${success} succeeded; $${fail} failed; $${skip} skipped" ; \
|
2023-08-28 22:44:35 -04:00
|
|
|
fi
|
2023-08-09 11:41:06 -04:00
|
|
|
|
|
|
|
output:
|
|
|
|
@ [-d $@ ] 2>/dev/null || install -d $@
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -rf $(tests) output/*
|