File: test-cmd

package info (click to toggle)
cramfsswap 1.4.5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 80 kB
  • sloc: ansic: 252; sh: 27; makefile: 16
file content (58 lines) | stat: -rwxr-xr-x 860 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh

DIR="$AUTOPKGTEST_TMP/sample"
ORG_FS=sample.cramfs
SWP_1_FS=sample_swp_1.cramfs
SWP_2_FS=sample_swp_2.cramfs

# create directory
mkdir -p $DIR

# create file system image
/usr/sbin/mkfs.cramfs -E $DIR $ORG_FS

# show file details
file $ORG_FS

# swap
cramfsswap $ORG_FS $SWP_1_FS

# show swapped file details
file $SWP_1_FS

# compare first endian swap with original
diff $ORG_FS $SWP_1_FS

# save result
RESULT=$?

# check result
if [ $RESULT -eq 0 ]; then
    # file not swapped
    rm -rf $DIR
    rm *.cramfs
    exit 1
fi

# swap second time to revert back to original
cramfsswap $SWP_1_FS $SWP_2_FS

# show swapped file details
file $SWP_2_FS

# compare second endian swap with original
diff $ORG_FS $SWP_2_FS

# save result
RESULT=$?

# cleanup
rm -rf $DIR
rm *.cramfs

# check result
if [ $RESULT -eq 0 ]; then
    exit 0
else
    exit 1
fi