Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jacobsa-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
jacobsa-fuse
Commits
be680e18
Commit
be680e18
authored
Sep 09, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed StatFSTest.CapacityAndFreeSpace on Linux.
parent
ca114f29
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
9 deletions
+17
-9
samples/statfs/statfs_darwin_test.go
samples/statfs/statfs_darwin_test.go
+8
-0
samples/statfs/statfs_linux_test.go
samples/statfs/statfs_linux_test.go
+8
-0
samples/statfs/statfs_test.go
samples/statfs/statfs_test.go
+1
-9
No files found.
samples/statfs/statfs_darwin_test.go
View file @
be680e18
...
...
@@ -16,6 +16,7 @@ package statfs_test
import
(
"fmt"
"regexp"
"syscall"
"github.com/jacobsa/fuse/fuseops"
...
...
@@ -23,6 +24,13 @@ import (
.
"github.com/jacobsa/ogletest"
)
// Sample output:
//
// Filesystem 1024-blocks Used Available Capacity iused ifree %iused Mounted on
// fake@bucket 32 16 16 50% 0 0 100% /Users/jacobsa/tmp/mp
//
var
gDfOutputRegexp
=
regexp
.
MustCompile
(
`^\S+\s+(\d+)\s+(\d+)\s+(\d+)\s+\d+%\s+\d+\s+\d+\s+\d+%.*$`
)
////////////////////////////////////////////////////////////////////////
// Helpers
////////////////////////////////////////////////////////////////////////
...
...
samples/statfs/statfs_linux_test.go
View file @
be680e18
...
...
@@ -17,12 +17,20 @@ package statfs_test
import
(
"fmt"
"math"
"regexp"
"syscall"
"github.com/jacobsa/fuse/fuseops"
.
"github.com/jacobsa/ogletest"
)
// Sample output:
//
// Filesystem 1K-blocks Used Available Use% Mounted on
// some_fuse_file_system 512 64 384 15% /tmp/sample_test001288095
//
var
gDfOutputRegexp
=
regexp
.
MustCompile
(
`^\S+\s+(\d+)\s+(\d+)\s+(\d+)\s+\d+%.*$`
)
////////////////////////////////////////////////////////////////////////
// Tests
////////////////////////////////////////////////////////////////////////
...
...
samples/statfs/statfs_test.go
View file @
be680e18
...
...
@@ -21,7 +21,6 @@ import (
"os/exec"
"path"
"path/filepath"
"regexp"
"runtime"
"strconv"
"testing"
...
...
@@ -44,13 +43,6 @@ func TestStatFS(t *testing.T) { RunTests(t) }
// system's. The output is not guaranteed to have resolution greater than 2^10
// (1 KiB).
func
df
(
dir
string
)
(
capacity
,
used
,
available
uint64
,
err
error
)
{
// Sample output:
//
// Filesystem 1024-blocks Used Available Capacity iused ifree %iused Mounted on
// fake@bucket 32 16 16 50% 0 0 100% /Users/jacobsa/tmp/mp
//
re
:=
regexp
.
MustCompile
(
`^\S+\s+(\d+)\s+(\d+)\s+(\d+)\s+\d+%\s+\d+\s+\d+\s+\d+%.*$`
)
// Call df with a block size of 1024 and capture its output.
cmd
:=
exec
.
Command
(
"df"
,
dir
)
cmd
.
Env
=
[]
string
{
"BLOCKSIZE=1024"
}
...
...
@@ -67,7 +59,7 @@ func df(dir string) (capacity, used, available uint64, err error) {
continue
}
submatches
:=
re
.
FindSubmatch
(
line
)
submatches
:=
gDfOutputRegexp
.
FindSubmatch
(
line
)
if
submatches
==
nil
{
err
=
fmt
.
Errorf
(
"Unable to parse line: %q"
,
line
)
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment