-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
74 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
echo 'set -euo pipefail' > test.sh | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
cd -P -- "$(dirname -- "$0")" | ||
ROOT=../../ | ||
|
||
if mountpoint -q f2fs/; then | ||
sudo umount f2fs/ | ||
fi | ||
|
||
mkdir -p f2fs/ | ||
gunzip -c f2fs.img.gz > f2fs.img | ||
sudo mount -nv -o loop f2fs.img f2fs/ | ||
mkdir -p f2fs/tmp/ | ||
|
||
go test -c "$ROOT/tests" -coverpkg github.com/ncruces/go-sqlite3/... | ||
TMPDIR=f2fs/tmp/ ./tests.test -test.v -test.short -test.coverprofile cover.out | ||
go tool cover -html cover.out | ||
|
||
sudo umount f2fs/ | ||
rm -r f2fs/ f2fs.img cover.out *.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//go:build (amd64 || arm64) && !sqlite3_nosys | ||
|
||
package vfs | ||
|
||
import ( | ||
"os" | ||
|
||
"golang.org/x/sys/unix" | ||
) | ||
|
||
const ( | ||
_F2FS_IOC_START_ATOMIC_WRITE = 62721 | ||
_F2FS_IOC_COMMIT_ATOMIC_WRITE = 62722 | ||
_F2FS_IOC_ABORT_ATOMIC_WRITE = 62725 | ||
_F2FS_IOC_GET_FEATURES = 2147808524 | ||
_F2FS_FEATURE_ATOMIC_WRITE = 4 | ||
) | ||
|
||
func osBatchAtomic(file *os.File) bool { | ||
flags, err := unix.IoctlGetInt(int(file.Fd()), _F2FS_IOC_GET_FEATURES) | ||
return err == nil && flags&_F2FS_FEATURE_ATOMIC_WRITE != 0 | ||
} | ||
|
||
func (f *vfsFile) BeginAtomicWrite() error { | ||
return unix.IoctlSetInt(int(f.Fd()), _F2FS_IOC_START_ATOMIC_WRITE, 0) | ||
} | ||
|
||
func (f *vfsFile) CommitAtomicWrite() error { | ||
return unix.IoctlSetInt(int(f.Fd()), _F2FS_IOC_COMMIT_ATOMIC_WRITE, 0) | ||
} | ||
|
||
func (f *vfsFile) RollbackAtomicWrite() error { | ||
return unix.IoctlSetInt(int(f.Fd()), _F2FS_IOC_ABORT_ATOMIC_WRITE, 0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//go:build !linux || !(amd64 || arm64) || sqlite3_nosys | ||
|
||
package vfs | ||
|
||
import "os" | ||
|
||
func osBatchAtomic(*os.File) bool { | ||
return false | ||
} |