Mercurial > hg > toybox
annotate tests/ln.test @ 1499:319e79bab052 draft
Separate more commands so single.sh can build them standalone.
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 26 Sep 2014 18:42:23 -0500 |
parents | 8700cbe1cb29 |
children |
rev | line source |
---|---|
1364
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
1 #!/bin/bash |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
2 |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
3 # Copyright 2013 Robin Mittal <robinmittal.it@gmail.com> |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
4 # Copyright 2013 Divya Kothari <divya.s.kothari@gmail.com> |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
5 |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
6 [ -f testing.sh ] && . testing.sh |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
7 |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
8 #testing "name" "command" "result" "infile" "stdin" |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
9 #set -x |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
10 |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
11 echo file1 > file |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
12 testing "ln create_hardlink" "ln file hlink && [ file -ef hlink ] && |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
13 echo 'yes'" "yes\n" "" "" |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
14 testing "ln create_softlink" "ln -s file slink && [ -L slink ] && |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
15 readlink slink" "file\n" "" "" |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
16 rm slink hlink |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
17 |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
18 echo hlink1 > hlink |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
19 testing "ln force_create_hardlink" "ln -f file hlink && |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
20 [ file -ef hlink ] && cat hlink 2>/dev/null" "file1\n" "" "" |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
21 |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
22 echo slink1 > slink |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
23 testing "ln force_create_softlink" "ln -f -s file slink && |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
24 [ -L slink ] && readlink slink" "file\n" "" "" |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
25 rm slink hlink |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
26 |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
27 echo hlink1 > hlink |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
28 set +e |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
29 testing "ln preserves_hardlinks" "ln file hlink 2>/dev/null || echo 'yes'" \ |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
30 "yes\n" "" "" |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
31 |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
32 echo slink1 > slink |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
33 set +e |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
34 testing "ln preserves_softlinks" "ln -s file slink 2>/dev/null || echo 'yes'" \ |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
35 "yes\n" "" "" |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
36 rm slink hlink |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
37 |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
38 mkdir dir |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
39 testing "ln multilevel_symbolic_links" "ln -s dir slink && |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
40 ln -s file slink && [ -L slink -a -L slink/file ] && |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
41 readlink slink && readlink slink/file" "dir\nfile\n" "" "" |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
42 rm slink |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
43 |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
44 testing "ln no_dereference" "ln -s dir slink && |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
45 ln -n -s file slink 2>/dev/null || [ -L slink ] && readlink slink" \ |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
46 "dir\n" "" "" |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
47 rm -rf file dir slink |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
48 |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
49 touch file1 file2 && mkdir dir |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
50 testing "ln create_multiple_hardlinks" "ln file* dir/ && |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
51 [ file1 -ef dir/file1 -a file2 -ef dir/file2 ] && echo 'yes'" "yes\n" "" "" |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
52 rm -rf file* dir |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
53 |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
54 touch file1 file2 && mkdir dir |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
55 testing "ln create_multiple_softlinks" "ln -s file* dir/ && |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
56 [ -L dir/file1 -a -L dir/file2 ] && readlink dir/file1 && |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
57 readlink dir/file2" "file1\nfile2\n" "" "" |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
58 rm -rf file* dir |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
59 |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
60 echo file1 > file |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
61 testing "ln create_softlink_and_remove_sourcefile" "ln -s file slink && |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
62 [ -L slink ] && rm file && cat slink 2>/dev/null || echo 'yes' " \ |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
63 "yes\n" "" "" |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
64 rm -f file slink |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
65 |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
66 echo file1 > file |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
67 testing "ln create_hardlink_and_remove_sourcefile" "ln file hlink && |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
68 [ file -ef hlink ] && rm file && [ -f hlink ] && echo 'yes'" \ |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
69 "yes\n" "" "" |
94677e7b6d97
I have developed few testsuite for toybox commands - ls, ln, rm, mv, printf, dd, renice.
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff
changeset
|
70 rm -f file hlink |