-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 #3285 from ngoozeff/bug3044
Fix for issue #3044 - mounted timestamps incorrect with windows host
- Loading branch information
Showing
5 changed files
with
105 additions
and
4 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
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
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,53 @@ | ||
package go9p | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"testing" | ||
) | ||
|
||
func assert_NotNil(t *testing.T, i interface{}) { | ||
if i == nil { | ||
t.Error("Value should not be nil") | ||
} | ||
} | ||
|
||
func assert_NotEqual(t *testing.T, lhs uint32, rhs uint32, message string) { | ||
if lhs == rhs { | ||
t.Errorf("Value %d should not be %d. %s", lhs, rhs, message) | ||
} | ||
} | ||
|
||
func TestDir2DirTimestamp(t *testing.T) { | ||
fi, err := os.Stat(".") | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
var st *Dir | ||
st, _ = dir2Dir(".", fi, false, nil) | ||
assert_NotNil(t, st) | ||
|
||
if testing.Verbose() { | ||
fmt.Printf("%s %d %d\n", st.Name, st.Mtime, st.Atime) | ||
} | ||
|
||
assert_NotEqual(t, st.Mtime, uint32(0), "Mtime should be set") | ||
assert_NotEqual(t, st.Atime, uint32(0), "Atime should be set") | ||
} | ||
|
||
func TestDir2DirTimestampDotu(t *testing.T) { | ||
fi, err := os.Stat(".") | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
var st *Dir | ||
st, _ = dir2Dir(".", fi, true, nil) | ||
assert_NotNil(t, st) | ||
|
||
if testing.Verbose() { | ||
fmt.Printf("%s %d %d\n", st.Name, st.Mtime, st.Atime) | ||
} | ||
|
||
assert_NotEqual(t, st.Mtime, uint32(0), "Mtime should be set") | ||
assert_NotEqual(t, st.Atime, uint32(0), "Atime should be set") | ||
} |