Skip to content

Commit 352b999

Browse files
committed
Add tests and fix sparse volumes
1 parent 512d41f commit 352b999

File tree

9 files changed

+1441
-7
lines changed

9 files changed

+1441
-7
lines changed

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ https://kernelnewbies.org/Linux_4.4#Faster_and_leaner_loop_device_with_Direct_I.
44

55
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bc07c10a3603a5ab3ef01ba42b3d41f9ac63d1b6
66

7-
```
8-
chown -1:-1
9-
10-
```
117

128
### Sparse
139

@@ -25,6 +21,5 @@ go mod tidy
2521
```
2622

2723
## Test
28-
ext4/xfs - sparse/regular
2924
on ext4/xfs vs ext3
3025
not enough space

driver/driver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (d Driver) Create(req *v.CreateRequest) error {
8181
}
8282

8383
sparse := false
84-
sparseStr, sparsePresent := req.Options["sparsePresent"]
84+
sparseStr, sparsePresent := req.Options["sparse"]
8585
if sparsePresent {
8686
sparse, err = strconv.ParseBool(sparseStr)
8787
if err != nil {

manager/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func (m Manager) Create(name string, sizeInBytes int64, sparse bool, fs string,
160160
if err != nil {
161161
_ = os.Remove(dataFilePath) // attempt to cleanup
162162
return errors.Wrapf(err,
163-
"Error creating volume '%s' - cannot allocate '%s' bytes",
163+
"Error creating volume '%s' - error creating data file",
164164
name, sizeInBytes)
165165
}
166166
} else {

tests/run.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
result=0
4+
5+
for suite in $(dirname ${0})/test_*; do
6+
echo "--- Executing '$(basename ${suite} .sh)' ---"
7+
8+
( cd $(dirname "${suite}"); ./"$(basename ${suite})" 2>&1; )
9+
10+
test "${result}" -eq 0 -a $? -eq 0
11+
result=$?
12+
13+
echo
14+
done
15+
16+
echo -n "$(tput bold) ---> "
17+
18+
if [[ ${result} -eq 0 ]]; then
19+
echo "$(tput setaf 2)ALL TESTS PASSED"
20+
else
21+
echo "$(tput setaf 1)SOME TESTS FAILED"
22+
fi
23+
24+
exit ${result}

0 commit comments

Comments
 (0)