author | Alberto Bertogli
<albertito@blitiri.com.ar> 2009-07-04 01:25:48 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2009-07-04 01:25:48 UTC |
parent | 39fd3986f51f289c4cc57ccecfee15d15bebf484 |
tests/behaviour/t_corruption.py | +16 | -0 |
tests/behaviour/t_normal.py | +63 | -0 |
diff --git a/tests/behaviour/t_corruption.py b/tests/behaviour/t_corruption.py index 35a1998..76a50a5 100644 --- a/tests/behaviour/t_corruption.py +++ b/tests/behaviour/t_corruption.py @@ -86,4 +86,20 @@ def test_c04(): assert content(n) == '' cleanup(n) +def test_c05(): + "truncate trans (tiny)" + c = gencontent() + + def f1(f, jf): + fiu.enable("jio/commit/tf_sync") + jf.write(c) + + n = run_with_tmp(f1) + assert content(n) == '' + tp = transpath(n, 1) + open(tp, 'r+').truncate(2) + fsck_verify(n, broken = 1) + assert content(n) == '' + cleanup(n) + diff --git a/tests/behaviour/t_normal.py b/tests/behaviour/t_normal.py index 520d3a4..942bffc 100644 --- a/tests/behaviour/t_normal.py +++ b/tests/behaviour/t_normal.py @@ -170,4 +170,67 @@ def test_n10(): fsck_verify(n) cleanup(n) +def test_n11(): + "jfsck a nonexisting file" + try: + libjio.jfsck('this file does not exist') + except IOError: + return + raise + +def test_n12(): + "jfsck with a nonexisting dir" + f, jf = bitmp() + try: + libjio.jfsck(f.name, 'this directory does not exist') + except IOError: + cleanup(f.name) + return + raise + +def test_n13(): + "move journal to a nonexisting dir" + import os + + f, jf = bitmp() + n = f.name + p = tmppath() + + jf.write('x') + jf.jmove_journal(p) + jf.write('y') + del jf + + assert libjio.jfsck(n, p)['total'] == 0 + os.unlink(n) + +def test_n14(): + "autosync" + f, jf = bitmp(jflags = libjio.J_LINGER) + n = f.name + + jf.autosync_start(1, 10) + jf.write('x' * 200) + jf.write('x' * 200) + jf.autosync_stop() + del jf + + fsck_verify(n) + cleanup(n) + +def test_n15(): + "jpread/jpwrite" + c = gencontent() + + f, jf = bitmp(jflags = libjio.J_LINGER) + n = f.name + + jf.pwrite(c, 2000) + assert content(n) == '\0' * 2000 + c + assert jf.pread(len(c), 2000) == c + del jf + + fsck_verify(n) + cleanup(n) +