xref: /aosp_15_r20/external/toybox/tests/install.test (revision cf5a6c84e2b8763fc1a7db14496fd4742913b199)
1#!/bin/bash
2
3# TODO: fill this out.
4# TODO: "make install" means something else, so no test_install, only callable
5# from "make tests"...
6
7[ -f testing.sh ] && . testing.sh
8
9#testing "name" "command" "result" "infile" "stdin"
10
11dd if=/dev/urandom of=random bs=64 count=1 2> /dev/null
12testing "install -D exists" \
13  "mkdir -p a; touch a/b; install -D random a/b && cmp random a/b && echo yes" \
14  "yes\n" "" ""
15rm -rf a random
16testing "install -D -t creates directory" \
17  "touch a; install -Dt b a && echo yes" \
18  "yes\n" "" ""
19rm -rf a b
20
21testing "install -d" "umask 0 && install -d potato && stat -c%a potato" \
22  "755\n" "" ""
23rmdir potato
24testcmd "-dm" "-dm 02750 potato && stat -c%a potato" "2750\n" "" ""
25rmdir potato
26testcmd '' '-dm +x potato && stat -c%a potato' '111\n' '' ''
27