xref: /aosp_15_r20/external/toybox/tests/top.test (revision cf5a6c84e2b8763fc1a7db14496fd4742913b199)
1*cf5a6c84SAndroid Build Coastguard Worker#!/bin/bash
2*cf5a6c84SAndroid Build Coastguard Worker
3*cf5a6c84SAndroid Build Coastguard Worker[ -f testing.sh ] && . testing.sh
4*cf5a6c84SAndroid Build Coastguard Worker
5*cf5a6c84SAndroid Build Coastguard Worker#testing "name" "command" "result" "infile" "stdin"
6*cf5a6c84SAndroid Build Coastguard Worker
7*cf5a6c84SAndroid Build Coastguard Workertesting "batch termination" "top -b -n1 | tail -c 1" "\n" "" ""
8*cf5a6c84SAndroid Build Coastguard Workertesting "fractional seconds" "top -b -d 8.5 -n1 | tail -c 1" "\n" "" ""
9*cf5a6c84SAndroid Build Coastguard Worker
10*cf5a6c84SAndroid Build Coastguard Worker# These are unit tests of xparsetime.
11*cf5a6c84SAndroid Build Coastguard Workertesting "-d invalid input" "top -b -d monkey -n1 2>&1 >/dev/null" "top: Not a number 'monkey'\n" "" ""
12*cf5a6c84SAndroid Build Coastguard Workertesting "-d unknown suffix" "top -b -d 1u -n1 2>&1 >/dev/null" "top: Unknown suffix 'u'\n" "" ""
13*cf5a6c84SAndroid Build Coastguard Workertesting "-d suffix trailing junk" "top -b -d 1monkey -n1 2>&1 >/dev/null" "top: Unknown suffix 'monkey'\n" "" ""
14