2024-08-02 17:29:30 -06:00
|
|
|
# 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
|
2024-08-02 18:22:45 -06:00
|
|
|
dj_tests: dj_help dj_full dj_null # dj_skip_stdin
|
2024-08-02 17:29:30 -06:00
|
|
|
|
|
|
|
.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 \
|
2024-08-03 07:33:46 -06:00
|
|
|
| tee /dev/stderr \
|
2024-08-02 18:22:45 -06:00
|
|
|
| xargs -I out test '1+0 > 0+0; 1024 > 0' = out \
|
2024-08-02 17:29:30 -06:00
|
|
|
;; \
|
|
|
|
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 \
|
2024-08-03 07:33:46 -06:00
|
|
|
| tee /dev/stderr \
|
2024-08-02 17:29:30 -06:00
|
|
|
| xargs -I out test '0+0 > 0+0; 0 > 0' = out
|
|
|
|
|
2024-08-02 18:22:45 -06:00
|
|
|
# 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.
|
2024-08-02 17:29:30 -06:00
|
|
|
# .PHONY: dj_skip_stdin
|
2024-08-02 18:22:45 -06:00
|
|
|
# # Test skipping stdin.
|
2024-08-02 17:29:30 -06:00
|
|
|
# dj_skip_stdin: $(BIN)/dj
|
2024-08-02 18:22:45 -06:00
|
|
|
# # Pipe 1024B of '\0' into dj(1); skip the first 24B; expect 1000B written.
|
|
|
|
# dd count=1 bs=1024 </dev/zero 2>/dev/null \
|
|
|
|
# | $(BIN)/dj -H -s 24 -o /dev/null 2>&1 \
|
2024-08-03 07:33:46 -06:00
|
|
|
# | tee /dev/stderr \
|
2024-08-02 18:22:45 -06:00
|
|
|
# | xargs -I out test '1+0 > 1+0; 1024 > 1000' = out
|