1#!/bin/sh 2 3# Tests for busybox applet itself. 4# Copyright 2005 by Rob Landley <rob@landley.net> 5# Licensed under GPL v2, see file LICENSE for details. 6 7. ./testing.sh 8 9HELPDUMP=`true | busybox 2>&1 | cat` 10 11# We need to test under calling the binary under other names. 12 13optional FEATURE_VERBOSE_USAGE 14testing "busybox --help busybox" "true | busybox --help busybox 2>&1 | cat" "$HELPDUMP\n\n" "" "" 15SKIP= 16 17ln -s `which busybox` busybox-suffix 18for i in busybox ./busybox-suffix 19do 20 # The gratuitous "\n"s are due to a shell idiosyncrasy: 21 # environment variables seem to strip trailing whitespace. 22 23 testing "" "$i" "$HELPDUMP\n\n" "" "" 24 25 testing "$i unknown" "$i unknown 2>&1" \ 26 "unknown: applet not found\n" "" "" 27 28 testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n\n" "" "" 29 30 optional FEATURE_VERBOSE_USAGE CAT 31 testing "" "$i cat" "moo" "" "moo" 32 testing "$i --help cat" "$i --help cat 2>&1 | grep print" \ 33 "Concatenate FILEs and print them to stdout\n" "" "" 34 SKIP= 35 36 testing "$i --help unknown" "$i --help unknown 2>&1" \ 37 "unknown: applet not found\n" "" "" 38done 39rm busybox-suffix 40 41ln -s `which busybox` unknown 42 43testing "busybox as unknown name" "./unknown 2>&1" \ 44 "unknown: applet not found\n" "" "" 45rm unknown 46 47exit $FAILCOUNT 48