-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from ScriptRock/sftpserver
sftp server implementation
- Loading branch information
Showing
13 changed files
with
2,437 additions
and
14 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.*.swo | ||
.*.swp | ||
|
||
server_standalone/server_standalone | ||
|
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
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,41 @@ | ||
package sftp | ||
|
||
import ( | ||
"syscall" | ||
"testing" | ||
) | ||
|
||
func TestClientStatVFS(t *testing.T) { | ||
sftp, cmd := testClient(t, READWRITE, NO_DELAY) | ||
defer cmd.Wait() | ||
defer sftp.Close() | ||
|
||
vfs, err := sftp.StatVFS("/") | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
// get system stats | ||
s := syscall.Statfs_t{} | ||
err = syscall.Statfs("/", &s) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
// check some stats | ||
if vfs.Files != uint64(s.Files) { | ||
t.Fatal("fr_size does not match") | ||
} | ||
|
||
if vfs.Bfree != uint64(s.Bfree) { | ||
t.Fatal("f_bsize does not match") | ||
} | ||
|
||
if vfs.Favail != uint64(s.Ffree) { | ||
t.Fatal("f_namemax does not match") | ||
} | ||
|
||
if vfs.Bavail != s.Bavail { | ||
t.Fatal("f_bavail does not match") | ||
} | ||
} |
Oops, something went wrong.