Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 59 lines (47 sloc) 1.507 kb
c881002 @hanwen Add test file.
authored
1 #!/bin/sh
2
3 set -eux
087265e @hanwen Renaming.
authored
4 storage="Internal Storage"
c881002 @hanwen Add test file.
authored
5 mount=$(mktemp -d)
821641b @hanwen Store file ID in only one place.
authored
6 localfile=$(mktemp)
087265e @hanwen Renaming.
authored
7 root="$mount/$storage"
8 delay="sleep 2"
9 ./go-mtpfs -fs-debug $mount &
10 $delay
c881002 @hanwen Add test file.
authored
11
087265e @hanwen Renaming.
authored
12 test -d "$root"
c881002 @hanwen Add test file.
authored
13 rm -rf "$root/mtpfs-test"
14 mkdir "$root/mtpfs-test"
087265e @hanwen Renaming.
authored
15 mkdir "$root/mtpfs-test/create"
16 mkdir "$root/mtpfs-test/delete"
17 rmdir "$root/mtpfs-test/delete"
c881002 @hanwen Add test file.
authored
18 echo -n hello > "$root/mtpfs-test/test.txt"
19 ls -l "$root/mtpfs-test/test.txt"
20 test $(cat "$root/mtpfs-test/test.txt") == "hello"
21 touch "$root/mtpfs-test/test.txt"
22 echo something else > "$root/mtpfs-test/test.txt"
23
3e0dc97 @hanwen Handle zero bytes files (we can't send them)
authored
24 # can't send zero bytes file.
25 ! touch "$root/mtpfs-test/zerobytes.txt"
26 rm "$root/mtpfs-test/zerobytes.txt"
27
087265e @hanwen Renaming.
authored
28 mv "$root/mtpfs-test/test.txt" "$root/mtpfs-test/test2.txt"
29 ! test -f "$root/mtpfs-test/test.txt"
30 test -f "$root/mtpfs-test/test2.txt"
31
32 echo hoi > "$root/mtpfs-test/dest.txt"
33 echo hoi > "$root/mtpfs-test/src.txt"
34 mv "$root/mtpfs-test/src.txt" "$root/mtpfs-test/dest.txt"
35 test -f "$root/mtpfs-test/dest.txt"
36 ! test -f "$root/mtpfs-test/src.txt"
37
821641b @hanwen Store file ID in only one place.
authored
38 echo hoi > $localfile
39 cp $localfile "$root/mtpfs-test/double-copy.txt"
40 cp $localfile "$root/mtpfs-test/double-copy.txt"
41
087265e @hanwen Renaming.
authored
42 fusermount -u $mount
43
44 ./go-mtpfs $mount &
45 $delay
46
47 test -d "$root/mtpfs-test/create"
48 ! test -d "$root/mtpfs-test/delete"
49 ! test -f "$root/mtpfs-test/test.txt"
50 test -f "$root/mtpfs-test/test2.txt"
51 test -f "$root/mtpfs-test/dest.txt"
52 ! test -f "$root/mtpfs-test/src.txt"
3e0dc97 @hanwen Handle zero bytes files (we can't send them)
authored
53 ! test -f "$root/mtpfs-test/zerobytes.txt"
821641b @hanwen Store file ID in only one place.
authored
54 rm "$root/mtpfs-test/double-copy.txt"
55
c881002 @hanwen Add test file.
authored
56 fusermount -u $mount
821641b @hanwen Store file ID in only one place.
authored
57
58 echo PASS
Something went wrong with that request. Please try again.