# Copyright (c) 2024 DTB # Copyright (c) 2024 Emma Tebibyte # 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_help dj_full 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 \ | tee /dev/stderr \ | 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 \ | tee /dev/stderr \ | xargs -I out test '0+0 > 0+0; 0 > 0' = out # This test currently fails. This is probably due to dj(1) being stale relative # to the main harakit branch. TODO: Reassess once the testing branch is merged. # .PHONY: dj_skip_stdin # # Test skipping stdin. # dj_skip_stdin: $(BIN)/dj # # Pipe 1024B of '\0' into dj(1); skip the first 24B; expect 1000B written. # dd count=1 bs=1024 /dev/null \ # | $(BIN)/dj -H -s 24 -o /dev/null 2>&1 \ # | tee /dev/stderr \ # | xargs -I out test '1+0 > 1+0; 1024 > 1000' = out