tests: converted to Makefiles
This commit is contained in:
		
							parent
							
								
									94873a2ddc
								
							
						
					
					
						commit
						ce8a0a5be3
					
				
							
								
								
									
										11
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								Makefile
									
									
									
									
									
								
							| @ -31,6 +31,13 @@ RUSTLIBS = --extern getopt=build/o/libgetopt.rlib \ | ||||
| 	--extern strerror=build/o/libstrerror.rlib | ||||
| CFLAGS += -I$(SYSEXITS) | ||||
| 
 | ||||
| # testing requires the absolute path to the bin directory set
 | ||||
| BIN = build/bin | ||||
| include tests/tests.mk | ||||
| 
 | ||||
| .PHONY: default | ||||
| default: all test | ||||
| 
 | ||||
| .PHONY: all | ||||
| all: dj false fop hru intcmp mm npc rpn scrut str strcmp swab true | ||||
| 
 | ||||
| @ -53,8 +60,8 @@ install: dist | ||||
| 	cp -r $(DESTDIR)/* / | ||||
| 
 | ||||
| .PHONY: test | ||||
| test: all build /tmp/getopt | ||||
| 	tests/test.sh | ||||
| test: all $(TESTS) /tmp/getopt | ||||
| 	@echo $(TESTS) | ||||
| 	/tmp/getopt | ||||
| 
 | ||||
| /tmp/getopt: src/libgetopt.rs | ||||
|  | ||||
							
								
								
									
										42
									
								
								tests/bonsai/dj.mk
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										42
									
								
								tests/bonsai/dj.mk
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,42 @@ | ||||
| # Copyright (c) 2024 DTB <trinity@trinity.moe>
 | ||||
| # Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
 | ||||
| # SPDX-License-Identifier: FSFAP
 | ||||
| #
 | ||||
| # Copying and distribution of this file, with or without modification, are
 | ||||
| # permitted in any medium without royalty provided the copyright notice and this
 | ||||
| # notice are preserved.  This file is offered as-is, without any warranty.
 | ||||
| 
 | ||||
| .PRAGMA: command_comment | ||||
| 
 | ||||
| /dev/full: | ||||
| /dev/null: | ||||
| 
 | ||||
| .PHONY: dj_tests | ||||
| dj_tests: dj_full dj_help dj_null # dj_skip_stdin
 | ||||
| 
 | ||||
| .PHONY: dj_full | ||||
| # Linux has a /dev/full pseudodevice useful for testing errors.
 | ||||
| dj_full: $(BIN)/dj /dev/full | ||||
| 	case "$$(uname)" in \
 | ||||
| 	Linux) \
 | ||||
| 		$(BIN)/dj -Hi /dev/zero -o /dev/full 2>&1 \
 | ||||
| 				| xargs -I out test '1+0 > 0+0; 1024 > 0' = out \
 | ||||
| 		;; \
 | ||||
| 	esac | ||||
| 
 | ||||
| .PHONY: dj_help | ||||
| dj_help: $(BIN)/dj | ||||
| 	! $(BIN)/dj -h | ||||
| 
 | ||||
| .PHONY: dj_null | ||||
| # Read nothing from /dev/null, write nothing to /dev/null.
 | ||||
| dj_null: $(BIN)/dj /dev/null | ||||
| 	$(BIN)/dj -Hi /dev/null -o /dev/null 2>&1 \
 | ||||
| 		| xargs -I out test '0+0 > 0+0; 0 > 0' = out | ||||
| 
 | ||||
| # .PHONY: dj_skip_stdin
 | ||||
| # dj_skip_stdin: $(BIN)/dj
 | ||||
| 	# Test skipping stdin. | ||||
| 	#dd count=1 bs=1024 </dev/zero 2>/dev/null \ | ||||
| 	#	| $(BIN)/dj -H -s 24 -o /dev/null 2>&1 \ | ||||
| 	#	| xargs -I out test '1+0 > 1+0; 1024 > 1000' = out | ||||
| @ -1,29 +0,0 @@ | ||||
| #!/bin/sh | ||||
| # Copyright (c) 2024 DTB <trinity@trinity.moe> | ||||
| # Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media> | ||||
| # SPDX-License-Identifier: FSFAP | ||||
| # | ||||
| # Copying and distribution of this file, with or without modification, are | ||||
| # permitted in any medium without royalty provided the copyright notice and this | ||||
| # notice are preserved.  This file is offered as-is, without any warranty. | ||||
| 
 | ||||
| . tests/bonsai/test_env | ||||
| 
 | ||||
| ! dj -h | ||||
| 
 | ||||
| # Linux has a /dev/full pseudodevice useful for testing errors. | ||||
| case "$(uname)" in | ||||
| Linux) | ||||
| 	dj -Hi /dev/zero -o /dev/full 2>&1 \ | ||||
| 			| xargs -I out "$BIN"/strcmp '1+0 > 0+0; 1024 > 0' out | ||||
| 	;; | ||||
| esac | ||||
| 
 | ||||
| # Read nothing from /dev/null, write nothing to /dev/null. | ||||
| dj -Hi /dev/null -o /dev/null 2>&1 \ | ||||
| 	| xargs -I out "$BIN"/strcmp '0+0 > 0+0; 0 > 0' out | ||||
| 
 | ||||
| # Test skipping stdin. | ||||
| #dd count=1 bs=1024 </dev/zero 2>/dev/null \ | ||||
| #	| dj -H -s 24 -o /dev/null 2>&1 \ | ||||
| #	| xargs -I out "$BIN"/strcmp '1+0 > 1+0; 1024 > 1000' out | ||||
| @ -1,4 +1,3 @@ | ||||
| #!/bin/sh
 | ||||
| # Copyright (c) 2024 DTB <trinity@trinity.moe>
 | ||||
| # Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
 | ||||
| # SPDX-License-Identifier: FSFAP
 | ||||
| @ -7,7 +6,13 @@ | ||||
| # permitted in any medium without royalty provided the copyright notice and this
 | ||||
| # notice are preserved.  This file is offered as-is, without any warranty.
 | ||||
| 
 | ||||
| . tests/bonsai/test_env | ||||
| .PHONY: false_tests | ||||
| false_tests: false_test false_help | ||||
| 
 | ||||
| ! false | ||||
| ! false -h | ||||
| .PHONY: false | ||||
| false_test: $(BIN)/false | ||||
| 	! $(BIN)/false | ||||
| 
 | ||||
| .PHONY: false_help | ||||
| false_help: $(BIN)/false | ||||
| 	! $(BIN)/false -h | ||||
							
								
								
									
										31
									
								
								tests/bonsai/fop.mk
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										31
									
								
								tests/bonsai/fop.mk
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,31 @@ | ||||
| # Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
 | ||||
| # SPDX-License-Identifier: FSFAP
 | ||||
| #
 | ||||
| # Copying and distribution of this file, with or without modification, are
 | ||||
| # permitted in any medium without royalty provided the copyright notice and this
 | ||||
| # notice are preserved.  This file is offered as-is, without any warranty.
 | ||||
| 
 | ||||
| .PHONY: fop_tests | ||||
| fop_tests: fop_help fop_functionality fop_delimiter fop_fail | ||||
| 
 | ||||
| .PHONY: fop_delimiter | ||||
| fop_delimiter: $(BIN)/fop | ||||
| 	test "$$(printf 'test0 test1 test2\n' | $(BIN)/fop -d' ' 2 sed 's/2/4/g')" \
 | ||||
| 		= 'test0 test1 test4' | ||||
| 	test "$$(printf 'meowsetwoofsetribbit\n' \
 | ||||
| 		| $(BIN)/fop -d 'set' 1 sed 's/woof/meow/g')" = 'meowsetmeowsetribbit'
 | ||||
| 
 | ||||
| .PHONY: fop_fail | ||||
| fop_fail: $(BIN)/fop | ||||
| 	! printf 'test\n' | $(BIN)/fop 1 cat | ||||
| 	! printf 'test\n' | $(BIN)/fop 'test' cat | ||||
| 	! printf 'test\n' | $(BIN)/fop -d'test' cat | ||||
| 
 | ||||
| .PHONY: fop_functionality | ||||
| fop_functionality: $(BIN)/fop | ||||
| 	test "$$(printf 'test0␞test1␞test2\n' | $(BIN)/fop 1 sed 's/1/4/g')" \
 | ||||
| 		= 'test0␞test4␞test2' | ||||
| 
 | ||||
| .PHONY: fop_help | ||||
| fop_help: $(BIN)/fop | ||||
| 	! $(BIN)/fop -h | ||||
| @ -1,21 +0,0 @@ | ||||
| #!/bin/sh | ||||
| # Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media> | ||||
| # SPDX-License-Identifier: FSFAP | ||||
| # | ||||
| # Copying and distribution of this file, with or without modification, are | ||||
| # permitted in any medium without royalty provided the copyright notice and this | ||||
| # notice are preserved.  This file is offered as-is, without any warranty. | ||||
| 
 | ||||
| . tests/bonsai/test_env | ||||
| 
 | ||||
| ! fop -h | ||||
| 
 | ||||
| "$BIN/strcmp" "$(printf 'test0␞test1␞test2\n' | fop 1 sed 's/1/4/g')" \ | ||||
| 	'test0␞test4␞test2' | ||||
| 
 | ||||
| "$BIN/strcmp" "$(printf 'test0 test1 test2\n' | fop -d' ' 2 sed 's/2/4/g')" \ | ||||
| 	'test0 test1 test4' | ||||
| 
 | ||||
| ! printf 'test\n' | fop 1 cat | ||||
| ! printf 'test\n' | fop 'test' cat | ||||
| ! printf 'test\n' | fop -d'test' cat | ||||
							
								
								
									
										35
									
								
								tests/bonsai/hru.mk
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										35
									
								
								tests/bonsai/hru.mk
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,35 @@ | ||||
| # Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
 | ||||
| # SPDX-License-Identifier: FSFAP
 | ||||
| #
 | ||||
| # Copying and distribution of this file, with or without modification, are
 | ||||
| # permitted in any medium without royalty provided the copyright notice and this
 | ||||
| # notice are preserved.  This file is offered as-is, without any warranty.
 | ||||
| 
 | ||||
| NAME = hru | ||||
| TARGET = $(NAME)_tests | ||||
| BINARY = $(BIN)/$(NAME) | ||||
| 
 | ||||
| .PHONY: hru_tests | ||||
| hru_tests: $(BIN)/hru | ||||
| 
 | ||||
| .PHONY: hru_functionality | ||||
| hru_functionality: $(BIN)/hru | ||||
| 	test "$(printf '1234\n' | $(BIN)/hru)" = '1.2 kB' | ||||
| 	test "$(printf '0\n' | $(BIN)/hru)" = '0 B' | ||||
| 
 | ||||
| .PHONY: $(NAME_help) | ||||
| hru_help: $(BIN)/hru | ||||
| 	! $(BIN)/hru -h | ||||
| 
 | ||||
| .PHONY: hru_negative | ||||
| hru_negative: $(BIN)/hru | ||||
| 	! printf '%s\n' '-1' | $(BIN)/hru | ||||
| 
 | ||||
| .PHONY: hru_regressions | ||||
| hru_regressions: $(BIN)/hru | ||||
| 	n=1; \
 | ||||
| 	while true; \
 | ||||
| 		do n="$$(($$n * 10))"; \
 | ||||
| 		printf '%s\n' "$$n" | $(BIN)/hru || break; \
 | ||||
| 	done; \
 | ||||
| 	printf 'Max float: %s\n' "$$n" | ||||
| @ -1,26 +0,0 @@ | ||||
| #!/bin/sh | ||||
| # Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media> | ||||
| # SPDX-License-Identifier: FSFAP | ||||
| # | ||||
| # Copying and distribution of this file, with or without modification, are | ||||
| # permitted in any medium without royalty provided the copyright notice and this | ||||
| # notice are preserved.  This file is offered as-is, without any warranty. | ||||
| 
 | ||||
| . tests/bonsai/test_env | ||||
| 
 | ||||
| alias strcmp="$BIN/strcmp" | ||||
| alias rpn="$BIN/rpn" | ||||
| 
 | ||||
| strcmp "$(printf '1234\n' | hru)" '1.2 kB' | ||||
| strcmp "$(printf '0\n' | hru)" '0 B' | ||||
| 
 | ||||
| # doesn’t currently work but would be useful for testing for regressions | ||||
| #n=1 | ||||
| #while "$BIN/true"; do | ||||
| #	n="$(rpn "$n" 10 ×)" | ||||
| # | ||||
| #	printf '%s\n' "$n" | hru || break | ||||
| #done | ||||
| #printf 'integer limit: ~%s\n' "$(rpn "$n" 10 ÷)" | ||||
| 
 | ||||
| ! printf '%s\n' '-1' | hru | ||||
							
								
								
									
										36
									
								
								tests/bonsai/intcmp.mk
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										36
									
								
								tests/bonsai/intcmp.mk
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,36 @@ | ||||
| # Copyright (c) 2024 DTB <trinity@trinity.moe>
 | ||||
| # Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
 | ||||
| # SPDX-License-Identifier: FSFAP
 | ||||
| #
 | ||||
| # Copying and distribution of this file, with or without modification, are
 | ||||
| # permitted in any medium without royalty provided the copyright notice and this
 | ||||
| # notice are preserved.  This file is offered as-is, without any warranty.
 | ||||
| 
 | ||||
| .PHONY: intcmp_tests | ||||
| intcmp_tests: intcmp_e intcmp_g intcmp_l | ||||
| 
 | ||||
| .PHONY: intcmp_e | ||||
| intcmp_e: $(BIN)/intcmp | ||||
| 	$(BIN)/intcmp -e     3 3 3 | ||||
| 	! $(BIN)/intcmp -e   1 2 3 | ||||
| 
 | ||||
| .PHONY: intcmp_g | ||||
| intcmp_g: $(BIN)/intcmp | ||||
| 	$(BIN)/intcmp -g     3 2 1 | ||||
| 	! $(BIN)/intcmp -g   1 3 3 | ||||
| 	$(BIN)/intcmp -ge    3 3 1 | ||||
| 	! $(BIN)/intcmp -ge  1 2 3 | ||||
| 
 | ||||
| .PHONY: intcmp_l | ||||
| intcmp_l: $(BIN)/intcmp | ||||
| 	$(BIN)/intcmp -l     1 2 3 | ||||
| 	! $(BIN)/intcmp -l   3 3 1 | ||||
| 	$(BIN)/intcmp -le    1 3 3 | ||||
| 	! $(BIN)/intcmp -le  3 2 1 | ||||
| 
 | ||||
| .PHONY: intcmp_combined | ||||
| intcmp_combined: $(BIN)/intcmp | ||||
| 	$(BINARY) -gl    1 2 3 | ||||
| 	! $(BINARY) -gl  3 3 3 | ||||
| 	$(BINARY) -egl   3 1 1 2 | ||||
| 	! $(BINARY) -egl foo | ||||
| @ -1,25 +0,0 @@ | ||||
| #!/bin/sh | ||||
| # Copyright (c) 2024 DTB <trinity@trinity.moe> | ||||
| # Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media> | ||||
| # SPDX-License-Identifier: FSFAP | ||||
| # | ||||
| # Copying and distribution of this file, with or without modification, are | ||||
| # permitted in any medium without royalty provided the copyright notice and this | ||||
| # notice are preserved.  This file is offered as-is, without any warranty. | ||||
| 
 | ||||
| . tests/bonsai/test_env | ||||
| 
 | ||||
| intcmp -e     3 3 3 | ||||
| intcmp -g     3 2 1 | ||||
| intcmp -l     1 2 3 | ||||
| intcmp -ge    3 3 1 | ||||
| intcmp -le    1 3 3 | ||||
| intcmp -gl    1 2 3 | ||||
| intcmp -egl   3 1 1 2 | ||||
| ! intcmp -e   1 2 3 | ||||
| ! intcmp -g   1 3 3 | ||||
| ! intcmp -l   3 3 1 | ||||
| ! intcmp -ge  1 2 3 | ||||
| ! intcmp -le  3 2 1 | ||||
| ! intcmp -gl  3 3 3 | ||||
| ! intcmp -egl foo | ||||
							
								
								
									
										27
									
								
								tests/bonsai/mm.mk
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										27
									
								
								tests/bonsai/mm.mk
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,27 @@ | ||||
| # Copyright (c) 2024 E$(NAME)a Tebibyte <e$(NAME)a@tebibyte.media>
 | ||||
| # SPDX-License-Identifier: FSFAP
 | ||||
| #
 | ||||
| # Copying and distribution of this file, with or without modification, are
 | ||||
| # permitted in any medium without royalty provided the copyright notice and this
 | ||||
| # notice are preserved.  This file is offered as-is, without any warranty.
 | ||||
| 
 | ||||
| NAME = mm | ||||
| TARGET = $(NAME)_tests | ||||
| BINARY = $(BIN)/$(NAME) | ||||
| 
 | ||||
| .PHONY: mm_tests | ||||
| mm_tests: mm_args mm_help mm_stderr | ||||
| 
 | ||||
| .PHONY: mm_args | ||||
| # mm(1) will error if positional arguments are given without -i or -o
 | ||||
| mm_args: $(BIN)/mm | ||||
| 	! $(BIN)/mm argument | ||||
| 
 | ||||
| .PHONY: mm_help | ||||
| mm_help: $(BIN)/mm | ||||
| 	! $(BIN)/mm -h | ||||
| 
 | ||||
| .PHONY: mm_stderr | ||||
| # check if stderr is empty upon specifying -e
 | ||||
| mm_stderr: $(BIN)/mm | ||||
| 	! test "$$(printf 'test\n' | $(BIN)/mm -i - -e 2>&1 >/dev/null)" = "test" | ||||
| @ -1,20 +1,28 @@ | ||||
| #!/bin/sh
 | ||||
| # Copyright (c) 2024 DTB <trinity@trinity.moe>
 | ||||
| # Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
 | ||||
| # SPDX-License-Identifier: FSFAP
 | ||||
| #
 | ||||
| # Copying and distribution of this file, with or without modification, are
 | ||||
| # permitted in any medium without royalty provided the copyright notice and this
 | ||||
| # notice are preserved.  This file is offered as-is, without any warranty.
 | ||||
| 
 | ||||
| . tests/bonsai/test_env | ||||
| .PRAGMA: command_comment | ||||
| 
 | ||||
| ! npc -h | ||||
| .PHONY: npc_tests | ||||
| npc_tests: npc_args npc_help | ||||
| 
 | ||||
| .PHONY: npc_args | ||||
| # arg parsing
 | ||||
| npc -e </dev/null | ||||
| npc -t </dev/null | ||||
| npc -et </dev/null | ||||
| ! npc -et 5 </dev/null | ||||
| npc_args: | ||||
| 	$(BIN)/npc -e </dev/null | ||||
| 	$(BIN)/npc -t </dev/null | ||||
| 	$(BIN)/npc -et </dev/null | ||||
| 	! $(BIN)/npc -et 5 </dev/null | ||||
| 
 | ||||
| .PHONY: npc_help | ||||
| npc_help: $(BIN)/npc | ||||
| 	! $(BIN)/npc -h | ||||
| 
 | ||||
| #i=0; while "$BIN"/intcmp -l $i 178; do
 | ||||
| #	printf '\\%s\\n' "$i" \
 | ||||
							
								
								
									
										31
									
								
								tests/bonsai/strcmp.mk
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										31
									
								
								tests/bonsai/strcmp.mk
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,31 @@ | ||||
| # Copyright (c) 2024 DTB <trinity@trinity.moe>
 | ||||
| # Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
 | ||||
| # SPDX-License-Identifier: FSFAP
 | ||||
| #
 | ||||
| # Copying and distribution of this file, with or without modification, are
 | ||||
| # permitted in any medium without royalty provided the copyright notice and this
 | ||||
| # notice are preserved.  This file is offered as-is, without any warranty.
 | ||||
| 
 | ||||
| NAME = strcmp | ||||
| TARGET = $(NAME)_tests | ||||
| BINARY = $(BIN)/$(NAME) | ||||
| 
 | ||||
| .PHONY: strcmp_tests | ||||
| strcmp_tests: strcmp_equals strcmp_help strcmp_nocmp strcmp_unequals | ||||
| 
 | ||||
| .PHONY: strcmp_equals | ||||
| strcmp_equals: $(BIN)/strcmp | ||||
| 	$(BIN)/strcmp equals equals | ||||
| 	$(BIN)/strcmp - - | ||||
| 
 | ||||
| .PHONY: strcmp_help | ||||
| strcmp_help: $(BIN)/strcmp | ||||
| 	! $(BIN)/strcmp -h | ||||
| 
 | ||||
| .PHONY: strcmp_nocmp | ||||
| strcmp_nocmp: $(BIN)/strcmp | ||||
| 	! $(BIN)/strcmp nocmp | ||||
| 
 | ||||
| .PHONY: strcmp_unequals | ||||
| strcmp_unequals: $(BIN)/strcmp | ||||
| 	! $(BIN)/strcmp unequals equals | ||||
| @ -1,16 +0,0 @@ | ||||
| #!/bin/sh | ||||
| # Copyright (c) 2024 DTB <trinity@trinity.moe> | ||||
| # Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media> | ||||
| # SPDX-License-Identifier: FSFAP | ||||
| # | ||||
| # Copying and distribution of this file, with or without modification, are | ||||
| # permitted in any medium without royalty provided the copyright notice and this | ||||
| # notice are preserved.  This file is offered as-is, without any warranty. | ||||
| 
 | ||||
| . tests/bonsai/test_env | ||||
| 
 | ||||
| strcmp equals equals | ||||
| ! strcmp inequals equals | ||||
| strcmp - - | ||||
| ! strcmp -h | ||||
| ! strcmp nocmp | ||||
| @ -1,5 +0,0 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| set -ex | ||||
| 
 | ||||
| alias "$UTIL=$BIN/$UTIL" | ||||
| @ -7,7 +7,13 @@ | ||||
| # permitted in any medium without royalty provided the copyright notice and this
 | ||||
| # notice are preserved.  This file is offered as-is, without any warranty.
 | ||||
| 
 | ||||
| . tests/bonsai/test_env | ||||
| .PHONY: true_tests | ||||
| true_tests: true_test | ||||
| 
 | ||||
| true | ||||
| true -h | ||||
| .PHONY: true_help | ||||
| true_help: $(BIN)/true | ||||
| 	$(BIN)/true -h | ||||
| 
 | ||||
| .PHONY: true_test | ||||
| true_test: $(BIN)/true | ||||
| 	$(BIN)/true | ||||
| @ -1,4 +0,0 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| export RUN_ERR='Run this script in the root of the project' | ||||
| export TEST_STR='Testing utility' | ||||
| @ -1,5 +0,0 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| export RUN_ERR="ilo ni li ken ala pali lon ma ni. sina ken kepeken ona lon ma \ | ||||
| sewi" | ||||
| export TEST_STR='ilo pali' | ||||
| @ -1,38 +0,0 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| # Copyright (c) 2023–2024 Emma Tebibyte <emma@tebibyte.media> | ||||
| # SPDX-License-Identifier: FSFAP | ||||
| # | ||||
| # Copying and distribution of this file, with or without modification, are | ||||
| # permitted in any medium without royalty provided the copyright notice and this | ||||
| # notice are preserved.  This file is offered as-is, without any warranty. | ||||
| 
 | ||||
| set -e | ||||
| 
 | ||||
| . "tests/locales/$LANG" | ||||
| 
 | ||||
| export BIN=build/bin | ||||
| 
 | ||||
| if ! ls Makefile >/dev/null 2>&1 | ||||
| then | ||||
| 	printf '%s: %s\n' "$0" "$RUN_ERR" 1>&2  | ||||
| 	exit 1 | ||||
| fi | ||||
| 
 | ||||
| for script in tests/bonsai/*.sh; do | ||||
| 	export UTIL="$(printf '%s\n' "$script" \ | ||||
| 		| sed -e 's/\.sh//g' -e 's;tests\/bonsai\/;;g')" | ||||
| 
 | ||||
| 	printf '%s: %s: %s\n' "$0" "$UTIL" "$TEST_STR" | ||||
| 	"$script" | ||||
| 	printf '\n' | ||||
| done | ||||
| 
 | ||||
| for test_util in tests/posix/*.sh; do | ||||
| 	realutil="$(command -v "$(printf '%s\n' "$test" | sed 's/\.sh$//g')")" | ||||
| 	export realutil | ||||
| 	export PATH="$BIN:$PATH" | ||||
| 	printf '%s: %s: %s\n' "$0" "$test" "$TEST_STR" | ||||
| 	"$test_util" | ||||
| 	printf '\n' | ||||
| done | ||||
							
								
								
									
										16
									
								
								tests/bonsai/mm.sh → tests/tests.mk
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										16
									
								
								tests/bonsai/mm.sh → tests/tests.mk
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							| @ -1,19 +1,15 @@ | ||||
| #!/bin/sh
 | ||||
| # Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
 | ||||
| # SPDX-License-Identifier: FSFAP
 | ||||
| #
 | ||||
| # Copying and distribution of this file, with or without modification, are
 | ||||
| # permitted in any medium without royalty provided the copyright notice and this
 | ||||
| # permitted in any medium without royalty provided the copyright notice and this 
 | ||||
| # notice are preserved.  This file is offered as-is, without any warranty.
 | ||||
| 
 | ||||
| . tests/bonsai/test_env | ||||
| 
 | ||||
| exec 3>&1 | ||||
| #TESTFILES != for file in tests/bonsai/*.mk tests/posix/*.mk; do printf '%s ' "$$file"; done;
 | ||||
| TESTFILES != for file in tests/bonsai/*.mk; do printf '%s ' "$$file"; done; | ||||
| 
 | ||||
| ! mm -h | ||||
| TESTS != printf '%s\n' "$(TESTFILES)" | xargs -n1 basename \
 | ||||
| 	| sed 's/\.mk/_tests/g' | ||||
| 
 | ||||
| # mm(1) will error if positional arguments are given without -i or -o
 | ||||
| ! mm argument | ||||
| 
 | ||||
| # check if stderr is empty upon specifying -e
 | ||||
| ! "$BIN/strcmp" "$(printf 'test\n' | mm -i - -e 2>&1 1>&3)" '' | ||||
| include $(TESTFILES) | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user