busybox/testsuite/busybox.tests
<<
>>
Prefs
   1#!/bin/sh
   2
   3# Tests for busybox applet itself.
   4# Copyright 2005 by Rob Landley <rob@landley.net>
   5# Licensed under GPLv2, see file LICENSE in this source tree.
   6
   7. ./testing.sh
   8test -f "$bindir/.config" && . "$bindir/.config"
   9
  10ln -s `which busybox` unknown
  11
  12testing "busybox as unknown name" "./unknown 2>&1" \
  13        "unknown: applet not found\n" "" ""
  14rm unknown
  15
  16# We need busybox --help to be enabled for the rest of tests
  17test x"$CONFIG_BUSYBOX" = x"y" \
  18|| { echo "SKIPPED: busybox --help"; exit 0; }
  19
  20HELPDUMP=`true | busybox 2>&1 | cat`
  21
  22optional FEATURE_VERBOSE_USAGE
  23testing "busybox --help busybox" "true | busybox --help busybox 2>&1 | cat" "$HELPDUMP\n" "" ""
  24SKIP=
  25
  26ln -s `which busybox` busybox-suffix
  27for i in busybox ./busybox-suffix
  28do
  29        testing "$i" "$i 2>&1 | cat" "$HELPDUMP\n" "" ""
  30
  31        testing "$i unknown" "$i unknown 2>&1" \
  32                "unknown: applet not found\n" "" ""
  33
  34        testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n" "" ""
  35
  36        optional FEATURE_VERBOSE_USAGE CAT
  37        testing "" "$i cat" "moo" "" "moo"
  38        testing "$i --help cat" "$i --help cat 2>&1 | grep Print" \
  39                "Print FILEs to stdout\n" "" ""
  40        SKIP=
  41
  42        testing "$i --help unknown" "$i --help unknown 2>&1" \
  43                "unknown: applet not found\n" "" ""
  44done
  45rm busybox-suffix
  46
  47exit $FAILCOUNT
  48