diff options
author | Christopher Haster <chaster@utexas.edu> | 2018-08-05 02:55:04 +0300 |
---|---|---|
committer | Christopher Haster <chaster@utexas.edu> | 2018-10-16 17:18:18 +0300 |
commit | f369f80540193f28103a73b30acbc2063768c98a (patch) | |
tree | 1f168ac90b608e0a4f178be8891bc914713971ca /tests | |
parent | 1941bbda768bade0cc0a1031fddce0f9749fe13e (diff) |
Added tests for global state stealing
State stealing is a tricky part of managing the xored-globals. When
removing a metadata-pair from the metadata chain, whichever
metadata-pair does the removing is also responsible for stealing the
removed metadata-pair's global delta and incorporating it into it's own
global delta. Otherwise the global state would become corrupted.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_move.sh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/test_move.sh b/tests/test_move.sh index bea618c..a36d058 100755 --- a/tests/test_move.sh +++ b/tests/test_move.sh @@ -283,6 +283,52 @@ tests/test.py << TEST lfs_unmount(&lfs) => 0; TEST +echo "--- Move state stealing ---" +tests/test.py << TEST + lfs_mount(&lfs, &cfg) => 0; + + lfs_remove(&lfs, "b") => 0; + lfs_remove(&lfs, "c") => 0; + + lfs_unmount(&lfs) => 0; +TEST +tests/test.py << TEST + lfs_mount(&lfs, &cfg) => 0; + + lfs_dir_open(&lfs, &dir[0], "a/hi") => LFS_ERR_NOENT; + lfs_dir_open(&lfs, &dir[0], "b") => LFS_ERR_NOENT; + lfs_dir_open(&lfs, &dir[0], "c") => LFS_ERR_NOENT; + + lfs_dir_open(&lfs, &dir[0], "d/hi") => 0; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, ".") => 0; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "..") => 0; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "hola") => 0; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "bonjour") => 0; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "ohayo") => 0; + lfs_dir_read(&lfs, &dir[0], &info) => 0; + lfs_dir_close(&lfs, &dir[0]) => 0; + + lfs_dir_open(&lfs, &dir[0], "a/hello") => LFS_ERR_NOENT; + lfs_dir_open(&lfs, &dir[0], "b") => LFS_ERR_NOENT; + lfs_dir_open(&lfs, &dir[0], "c") => LFS_ERR_NOENT; + + lfs_file_open(&lfs, &file[0], "d/hello", LFS_O_RDONLY) => 0; + lfs_file_read(&lfs, &file[0], buffer, 5) => 5; + memcmp(buffer, "hola\n", 5) => 0; + lfs_file_read(&lfs, &file[0], buffer, 8) => 8; + memcmp(buffer, "bonjour\n", 8) => 0; + lfs_file_read(&lfs, &file[0], buffer, 6) => 6; + memcmp(buffer, "ohayo\n", 6) => 0; + lfs_file_close(&lfs, &file[0]) => 0; + + lfs_unmount(&lfs) => 0; +TEST + echo "--- Results ---" tests/stats.py |