blob: beb17440ceb2e9fa83e6251b82536ffb79f4b24a [file] [log] [blame]
Rob Landleyb766c392005-09-04 11:10:37 +00001#!/bin/sh
2
3# Tests for busybox applet itself.
4# Copyright 2005 by Rob Landley <rob@landley.net>
Denys Vlasenko0ef64bd2010-08-16 20:14:46 +02005# Licensed under GPLv2, see file LICENSE in this source tree.
Rob Landleyb766c392005-09-04 11:10:37 +00006
Mike Frysingercaa79402009-11-04 18:41:22 -05007. ./testing.sh
Ron Yorstonecaec1d2018-02-09 09:01:19 +00008test -f "$bindir/.config" && . "$bindir/.config"
Rob Landleyb766c392005-09-04 11:10:37 +00009
Denys Vlasenko015db582016-06-19 18:15:33 +020010ln -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
Denys Vlasenkoe2082792010-01-16 02:49:40 +010020HELPDUMP=`true | busybox 2>&1 | cat`
Rob Landleyb766c392005-09-04 11:10:37 +000021
Denys Vlasenkoc0211e92010-05-11 04:32:04 +020022optional FEATURE_VERBOSE_USAGE
Ron Yorstonecaec1d2018-02-09 09:01:19 +000023testing "busybox --help busybox" "true | busybox --help busybox 2>&1 | cat" "$HELPDUMP\n" "" ""
Denys Vlasenkobfa1b2e2010-05-11 03:53:57 +020024SKIP=
Rob Landleyf6acb662005-09-05 16:27:19 +000025
Rob Landley4bb1b042006-03-16 15:20:45 +000026ln -s `which busybox` busybox-suffix
27for i in busybox ./busybox-suffix
Rob Landleyb766c392005-09-04 11:10:37 +000028do
Ron Yorstonecaec1d2018-02-09 09:01:19 +000029 testing "$i" "$i 2>&1 | cat" "$HELPDUMP\n" "" ""
Rob Landleyb766c392005-09-04 11:10:37 +000030
Rob Landley4bb1b042006-03-16 15:20:45 +000031 testing "$i unknown" "$i unknown 2>&1" \
Rob Landleyb766c392005-09-04 11:10:37 +000032 "unknown: applet not found\n" "" ""
33
Ron Yorstonecaec1d2018-02-09 09:01:19 +000034 testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n" "" ""
Rob Landleyb766c392005-09-04 11:10:37 +000035
Denys Vlasenkoc0211e92010-05-11 04:32:04 +020036 optional FEATURE_VERBOSE_USAGE CAT
Rob Landley4bb1b042006-03-16 15:20:45 +000037 testing "" "$i cat" "moo" "" "moo"
Ron Yorstonecaec1d2018-02-09 09:01:19 +000038 testing "$i --help cat" "$i --help cat 2>&1 | grep Print" \
39 "Print FILEs to stdout\n" "" ""
Denys Vlasenkobfa1b2e2010-05-11 03:53:57 +020040 SKIP=
Rob Landleyb766c392005-09-04 11:10:37 +000041
Rob Landley4bb1b042006-03-16 15:20:45 +000042 testing "$i --help unknown" "$i --help unknown 2>&1" \
Rob Landleyb766c392005-09-04 11:10:37 +000043 "unknown: applet not found\n" "" ""
Rob Landleyb766c392005-09-04 11:10:37 +000044done
Rob Landley4bb1b042006-03-16 15:20:45 +000045rm busybox-suffix
Rob Landleyb766c392005-09-04 11:10:37 +000046
Rob Landleyb766c392005-09-04 11:10:37 +000047exit $FAILCOUNT