mirror of
https://gitee.com/openharmony/third_party_littlefs
synced 2024-11-23 06:50:37 +00:00
Minor improvements to testing framework
- Moved scripts into scripts folder - Removed what have been relatively unhelpful assert printing
This commit is contained in:
parent
52a90b8dcc
commit
1aaf1cb6c0
17
Makefile
17
Makefile
@ -42,9 +42,20 @@ size: $(OBJ)
|
||||
$(SIZE) -t $^
|
||||
|
||||
.SUFFIXES:
|
||||
test: test_format test_dirs test_files test_seek test_truncate \
|
||||
test_entries test_interspersed test_alloc test_paths test_attrs \
|
||||
test_move test_orphan test_corrupt
|
||||
test: \
|
||||
test_format \
|
||||
test_dirs \
|
||||
test_files \
|
||||
test_seek \
|
||||
test_truncate \
|
||||
test_entries \
|
||||
test_interspersed \
|
||||
test_alloc \
|
||||
test_paths \
|
||||
test_attrs \
|
||||
test_move \
|
||||
test_orphan \
|
||||
test_corrupt
|
||||
@rm test.c
|
||||
test_%: tests/test_%.sh
|
||||
|
||||
|
@ -7,25 +7,8 @@
|
||||
|
||||
|
||||
// test stuff
|
||||
static void test_log(const char *s, uintmax_t v) {{
|
||||
printf("%s: %jd\n", s, v);
|
||||
}}
|
||||
|
||||
static void test_assert(const char *file, unsigned line,
|
||||
const char *s, uintmax_t v, uintmax_t e) {{
|
||||
static const char *last[6] = {{0, 0}};
|
||||
if (v != e || !(last[0] == s || last[1] == s ||
|
||||
last[2] == s || last[3] == s ||
|
||||
last[4] == s || last[5] == s)) {{
|
||||
test_log(s, v);
|
||||
last[0] = last[1];
|
||||
last[1] = last[2];
|
||||
last[2] = last[3];
|
||||
last[3] = last[4];
|
||||
last[4] = last[5];
|
||||
last[5] = s;
|
||||
}}
|
||||
|
||||
if (v != e) {{
|
||||
fprintf(stderr, "\033[31m%s:%u: assert %s failed with %jd, "
|
||||
"expected %jd\033[0m\n", file, line, s, v, e);
|
@ -6,7 +6,7 @@ import subprocess
|
||||
import os
|
||||
|
||||
def generate(test):
|
||||
with open("tests/template.fmt") as file:
|
||||
with open("scripts/template.fmt") as file:
|
||||
template = file.read()
|
||||
|
||||
lines = []
|
@ -3,14 +3,14 @@ set -eu
|
||||
|
||||
echo "=== Allocator tests ==="
|
||||
rm -rf blocks
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
TEST
|
||||
|
||||
SIZE=15000
|
||||
|
||||
lfs_mkdir() {
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_mkdir(&lfs, "$1") => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
@ -18,7 +18,7 @@ TEST
|
||||
}
|
||||
|
||||
lfs_remove() {
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_remove(&lfs, "$1/eggs") => 0;
|
||||
lfs_remove(&lfs, "$1/bacon") => 0;
|
||||
@ -29,7 +29,7 @@ TEST
|
||||
}
|
||||
|
||||
lfs_alloc_singleproc() {
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
const char *names[] = {"bacon", "eggs", "pancakes"};
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
for (unsigned n = 0; n < sizeof(names)/sizeof(names[0]); n++) {
|
||||
@ -53,7 +53,7 @@ TEST
|
||||
lfs_alloc_multiproc() {
|
||||
for name in bacon eggs pancakes
|
||||
do
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "$1/$name",
|
||||
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_APPEND) => 0;
|
||||
@ -71,7 +71,7 @@ done
|
||||
lfs_verify() {
|
||||
for name in bacon eggs pancakes
|
||||
do
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "$1/$name", LFS_O_RDONLY) => 0;
|
||||
size = strlen("$name");
|
||||
@ -115,7 +115,7 @@ lfs_remove multiprocreuse
|
||||
lfs_remove singleprocreuse
|
||||
|
||||
echo "--- Exhaustion test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "exhaustion", LFS_O_WRONLY | LFS_O_CREAT);
|
||||
size = strlen("exhaustion");
|
||||
@ -139,7 +139,7 @@ tests/test.py << TEST
|
||||
lfs_file_close(&lfs, &file[0]) => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "exhaustion", LFS_O_RDONLY);
|
||||
size = strlen("exhaustion");
|
||||
@ -151,7 +151,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Exhaustion wraparound test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_remove(&lfs, "exhaustion") => 0;
|
||||
|
||||
@ -186,7 +186,7 @@ tests/test.py << TEST
|
||||
lfs_file_close(&lfs, &file[0]) => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "exhaustion", LFS_O_RDONLY);
|
||||
size = strlen("exhaustion");
|
||||
@ -199,7 +199,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Dir exhaustion test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
|
||||
// find out max file size
|
||||
@ -248,7 +248,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Chained dir exhaustion test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
|
||||
// find out max file size
|
||||
@ -317,10 +317,10 @@ TEST
|
||||
|
||||
echo "--- Split dir test ---"
|
||||
rm -rf blocks
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
|
||||
// create one block hole for half a directory
|
||||
@ -362,7 +362,7 @@ TEST
|
||||
|
||||
echo "--- Outdated lookahead test ---"
|
||||
rm -rf blocks
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
@ -424,7 +424,7 @@ TEST
|
||||
|
||||
echo "--- Outdated lookahead and split dir test ---"
|
||||
rm -rf blocks
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
@ -482,4 +482,4 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Results ---"
|
||||
tests/stats.py
|
||||
scripts/stats.py
|
||||
|
@ -3,7 +3,7 @@ set -eu
|
||||
|
||||
echo "=== Attr tests ==="
|
||||
rm -rf blocks
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
@ -17,7 +17,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Set/get attribute ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_setattr(&lfs, "hello", 'A', "aaaa", 4) => 0;
|
||||
lfs_setattr(&lfs, "hello", 'B', "bbbbbb", 6) => 0;
|
||||
@ -69,7 +69,7 @@ tests/test.py << TEST
|
||||
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_getattr(&lfs, "hello", 'A', buffer, 4) => 4;
|
||||
lfs_getattr(&lfs, "hello", 'B', buffer+4, 9) => 9;
|
||||
@ -86,7 +86,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Set/get root attribute ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_setattr(&lfs, "/", 'A', "aaaa", 4) => 0;
|
||||
lfs_setattr(&lfs, "/", 'B', "bbbbbb", 6) => 0;
|
||||
@ -137,7 +137,7 @@ tests/test.py << TEST
|
||||
lfs_getattr(&lfs, "/", 'C', buffer+10, 5) => 5;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_getattr(&lfs, "/", 'A', buffer, 4) => 4;
|
||||
lfs_getattr(&lfs, "/", 'B', buffer+4, 9) => 9;
|
||||
@ -154,7 +154,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Set/get file attribute ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
struct lfs_attr attrs1[] = {
|
||||
{'A', buffer, 4},
|
||||
@ -229,7 +229,7 @@ tests/test.py << TEST
|
||||
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
struct lfs_attr attrs2[] = {
|
||||
{'A', buffer, 4},
|
||||
@ -252,7 +252,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Deferred file attributes ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
struct lfs_attr attrs1[] = {
|
||||
{'B', "gggg", 4},
|
||||
@ -283,4 +283,4 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Results ---"
|
||||
tests/stats.py
|
||||
scripts/stats.py
|
||||
|
@ -7,7 +7,7 @@ NAMEMULT=64
|
||||
FILEMULT=1
|
||||
|
||||
lfs_mktree() {
|
||||
tests/test.py ${1:-} << TEST
|
||||
scripts/test.py ${1:-} << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
@ -38,7 +38,7 @@ TEST
|
||||
}
|
||||
|
||||
lfs_chktree() {
|
||||
tests/test.py ${1:-} << TEST
|
||||
scripts/test.py ${1:-} << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
for (int i = 1; i < 10; i++) {
|
||||
for (int j = 0; j < $NAMEMULT; j++) {
|
||||
@ -115,4 +115,4 @@ lfs_mktree
|
||||
lfs_chktree
|
||||
|
||||
echo "--- Results ---"
|
||||
tests/stats.py
|
||||
scripts/stats.py
|
||||
|
@ -5,12 +5,12 @@ LARGESIZE=128
|
||||
|
||||
echo "=== Directory tests ==="
|
||||
rm -rf blocks
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
TEST
|
||||
|
||||
echo "--- Root directory ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "/") => 0;
|
||||
lfs_dir_close(&lfs, &dir[0]) => 0;
|
||||
@ -18,14 +18,14 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Directory creation ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_mkdir(&lfs, "potato") => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
|
||||
echo "--- File creation ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "burito", LFS_O_CREAT | LFS_O_WRONLY) => 0;
|
||||
lfs_file_close(&lfs, &file[0]) => 0;
|
||||
@ -33,7 +33,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Directory iteration ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "/") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -54,7 +54,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Directory failures ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_mkdir(&lfs, "potato") => LFS_ERR_EXIST;
|
||||
lfs_dir_open(&lfs, &dir[0], "tomato") => LFS_ERR_NOENT;
|
||||
@ -65,14 +65,14 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Nested directories ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_mkdir(&lfs, "potato/baked") => 0;
|
||||
lfs_mkdir(&lfs, "potato/sweet") => 0;
|
||||
lfs_mkdir(&lfs, "potato/fried") => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "potato") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -96,7 +96,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Multi-block directory ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_mkdir(&lfs, "cactus") => 0;
|
||||
for (int i = 0; i < $LARGESIZE; i++) {
|
||||
@ -105,7 +105,7 @@ tests/test.py << TEST
|
||||
}
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "cactus") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -125,7 +125,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Directory remove ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_remove(&lfs, "potato") => LFS_ERR_NOTEMPTY;
|
||||
lfs_remove(&lfs, "potato/sweet") => 0;
|
||||
@ -161,7 +161,7 @@ tests/test.py << TEST
|
||||
lfs_dir_close(&lfs, &dir[0]) => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "/") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -182,7 +182,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Directory rename ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_mkdir(&lfs, "coldpotato") => 0;
|
||||
lfs_mkdir(&lfs, "coldpotato/baked") => 0;
|
||||
@ -190,12 +190,12 @@ tests/test.py << TEST
|
||||
lfs_mkdir(&lfs, "coldpotato/fried") => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_rename(&lfs, "coldpotato", "hotpotato") => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "hotpotato") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -217,7 +217,7 @@ tests/test.py << TEST
|
||||
lfs_dir_close(&lfs, &dir[0]) => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_mkdir(&lfs, "warmpotato") => 0;
|
||||
lfs_mkdir(&lfs, "warmpotato/mushy") => 0;
|
||||
@ -228,7 +228,7 @@ tests/test.py << TEST
|
||||
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "warmpotato") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -250,7 +250,7 @@ tests/test.py << TEST
|
||||
lfs_dir_close(&lfs, &dir[0]) => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_mkdir(&lfs, "coldpotato") => 0;
|
||||
lfs_rename(&lfs, "warmpotato/baked", "coldpotato/baked") => 0;
|
||||
@ -260,7 +260,7 @@ tests/test.py << TEST
|
||||
lfs_remove(&lfs, "warmpotato") => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "coldpotato") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -284,7 +284,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Recursive remove ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_remove(&lfs, "coldpotato") => LFS_ERR_NOTEMPTY;
|
||||
|
||||
@ -306,7 +306,7 @@ tests/test.py << TEST
|
||||
|
||||
lfs_remove(&lfs, "coldpotato") => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "/") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -327,7 +327,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Multi-block rename ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
for (int i = 0; i < $LARGESIZE; i++) {
|
||||
sprintf((char*)buffer, "cactus/test%03d", i);
|
||||
@ -336,7 +336,7 @@ tests/test.py << TEST
|
||||
}
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "cactus") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -356,7 +356,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Multi-block remove ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_remove(&lfs, "cactus") => LFS_ERR_NOTEMPTY;
|
||||
|
||||
@ -368,7 +368,7 @@ tests/test.py << TEST
|
||||
lfs_remove(&lfs, "cactus") => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "/") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -386,7 +386,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Multi-block directory with files ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_mkdir(&lfs, "prickly-pear") => 0;
|
||||
for (int i = 0; i < $LARGESIZE; i++) {
|
||||
@ -400,7 +400,7 @@ tests/test.py << TEST
|
||||
}
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "prickly-pear") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -421,7 +421,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Multi-block rename with files ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
for (int i = 0; i < $LARGESIZE; i++) {
|
||||
sprintf((char*)buffer, "prickly-pear/test%03d", i);
|
||||
@ -430,7 +430,7 @@ tests/test.py << TEST
|
||||
}
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "prickly-pear") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -451,7 +451,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Multi-block remove with files ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_remove(&lfs, "prickly-pear") => LFS_ERR_NOTEMPTY;
|
||||
|
||||
@ -463,7 +463,7 @@ tests/test.py << TEST
|
||||
lfs_remove(&lfs, "prickly-pear") => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "/") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -481,4 +481,4 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Results ---"
|
||||
tests/stats.py
|
||||
scripts/stats.py
|
||||
|
@ -30,7 +30,7 @@ TEST
|
||||
}
|
||||
|
||||
echo "--- Entry grow test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
@ -50,7 +50,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Entry shrink test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
@ -70,7 +70,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Entry spill test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
@ -87,7 +87,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Entry push spill test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
@ -107,7 +107,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Entry push spill two test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
@ -129,7 +129,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Entry drop test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
@ -159,7 +159,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Create too big ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
@ -182,7 +182,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Resize too big ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
@ -218,4 +218,4 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Results ---"
|
||||
tests/stats.py
|
||||
scripts/stats.py
|
||||
|
@ -7,12 +7,12 @@ LARGESIZE=262144
|
||||
|
||||
echo "=== File tests ==="
|
||||
rm -rf blocks
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
TEST
|
||||
|
||||
echo "--- Simple file test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "hello", LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||
size = strlen("Hello World!\n");
|
||||
@ -29,7 +29,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
w_test() {
|
||||
tests/test.py ${4:-} << TEST
|
||||
scripts/test.py ${4:-} << TEST
|
||||
size = $1;
|
||||
lfs_size_t chunk = 31;
|
||||
srand(0);
|
||||
@ -49,7 +49,7 @@ TEST
|
||||
}
|
||||
|
||||
r_test() {
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
size = $1;
|
||||
lfs_size_t chunk = 29;
|
||||
srand(0);
|
||||
@ -105,7 +105,7 @@ r_test $LARGESIZE largeavacado
|
||||
r_test 0 noavacado
|
||||
|
||||
echo "--- Dir check ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "/") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -136,10 +136,10 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Many file test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
// Create 300 files of 6 bytes
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_mkdir(&lfs, "directory") => 0;
|
||||
@ -155,4 +155,4 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Results ---"
|
||||
tests/stats.py
|
||||
scripts/stats.py
|
||||
|
@ -5,12 +5,12 @@ echo "=== Formatting tests ==="
|
||||
rm -rf blocks
|
||||
|
||||
echo "--- Basic formatting ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
TEST
|
||||
|
||||
echo "--- Basic mounting ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
@ -20,18 +20,18 @@ TEST
|
||||
echo "--- Invalid superblocks ---"
|
||||
ln -f -s /dev/zero blocks/0
|
||||
ln -f -s /dev/zero blocks/1
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => LFS_ERR_NOSPC;
|
||||
TEST
|
||||
rm blocks/0 blocks/1
|
||||
|
||||
echo "--- Invalid mount ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => LFS_ERR_CORRUPT;
|
||||
TEST
|
||||
|
||||
echo "--- Expanding superblock ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
for (int i = 0; i < 100; i++) {
|
||||
@ -40,11 +40,11 @@ tests/test.py << TEST
|
||||
}
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_mkdir(&lfs, "dummy") => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
|
||||
echo "--- Results ---"
|
||||
tests/stats.py
|
||||
scripts/stats.py
|
||||
|
@ -3,12 +3,12 @@ set -eu
|
||||
|
||||
echo "=== Interspersed tests ==="
|
||||
rm -rf blocks
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
TEST
|
||||
|
||||
echo "--- Interspersed file test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "a", LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||
lfs_file_open(&lfs, &file[1], "b", LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||
@ -78,7 +78,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Interspersed remove file test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "e", LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||
|
||||
@ -124,7 +124,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Remove inconveniently test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "e", LFS_O_WRONLY | LFS_O_TRUNC) => 0;
|
||||
lfs_file_open(&lfs, &file[1], "f", LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||
@ -183,4 +183,4 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Results ---"
|
||||
tests/stats.py
|
||||
scripts/stats.py
|
||||
|
@ -3,7 +3,7 @@ set -eu
|
||||
|
||||
echo "=== Move tests ==="
|
||||
rm -rf blocks
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
@ -26,12 +26,12 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Move file ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_rename(&lfs, "a/hello", "b/hello") => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "a") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -54,13 +54,13 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Move file corrupt source ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_rename(&lfs, "b/hello", "c/hello") => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/corrupt.py -n 1
|
||||
tests/test.py << TEST
|
||||
scripts/corrupt.py -n 1
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "b") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -81,13 +81,13 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Move file corrupt source and dest ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_rename(&lfs, "c/hello", "d/hello") => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/corrupt.py -n 2
|
||||
tests/test.py << TEST
|
||||
scripts/corrupt.py -n 2
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "c") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -108,12 +108,12 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Move file after corrupt ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_rename(&lfs, "c/hello", "d/hello") => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "c") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -134,12 +134,12 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Move dir ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_rename(&lfs, "a/hi", "b/hi") => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "a") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -160,13 +160,13 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Move dir corrupt source ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_rename(&lfs, "b/hi", "c/hi") => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/corrupt.py -n 1
|
||||
tests/test.py << TEST
|
||||
scripts/corrupt.py -n 1
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "b") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -187,13 +187,13 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Move dir corrupt source and dest ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_rename(&lfs, "c/hi", "d/hi") => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/corrupt.py -n 2
|
||||
tests/test.py << TEST
|
||||
scripts/corrupt.py -n 2
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "c") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -216,12 +216,12 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Move dir after corrupt ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_rename(&lfs, "c/hi", "d/hi") => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "c") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -244,7 +244,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Move check ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_dir_open(&lfs, &dir[0], "a/hi") => LFS_ERR_NOENT;
|
||||
@ -282,7 +282,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Move state stealing ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_remove(&lfs, "b") => 0;
|
||||
@ -290,7 +290,7 @@ tests/test.py << TEST
|
||||
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_dir_open(&lfs, &dir[0], "a/hi") => LFS_ERR_NOENT;
|
||||
@ -329,4 +329,4 @@ TEST
|
||||
|
||||
|
||||
echo "--- Results ---"
|
||||
tests/stats.py
|
||||
scripts/stats.py
|
||||
|
@ -3,12 +3,12 @@ set -eu
|
||||
|
||||
echo "=== Orphan tests ==="
|
||||
rm -rf blocks
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
TEST
|
||||
|
||||
echo "--- Orphan test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_mkdir(&lfs, "parent") => 0;
|
||||
lfs_mkdir(&lfs, "parent/orphan") => 0;
|
||||
@ -17,8 +17,8 @@ tests/test.py << TEST
|
||||
TEST
|
||||
# corrupt most recent commit, this should be the update to the previous
|
||||
# linked-list entry and should orphan the child
|
||||
tests/corrupt.py
|
||||
tests/test.py << TEST
|
||||
scripts/corrupt.py
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
|
||||
lfs_stat(&lfs, "parent/orphan", &info) => LFS_ERR_NOENT;
|
||||
@ -42,4 +42,4 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Results ---"
|
||||
tests/stats.py
|
||||
scripts/stats.py
|
||||
|
@ -3,11 +3,11 @@ set -eu
|
||||
|
||||
echo "=== Path tests ==="
|
||||
rm -rf blocks
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
TEST
|
||||
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_mkdir(&lfs, "tea") => 0;
|
||||
lfs_mkdir(&lfs, "coffee") => 0;
|
||||
@ -25,7 +25,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Root path tests ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_stat(&lfs, "tea/hottea", &info) => 0;
|
||||
strcmp(info.name, "hottea") => 0;
|
||||
@ -39,7 +39,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Redundant slash path tests ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_stat(&lfs, "/tea/hottea", &info) => 0;
|
||||
strcmp(info.name, "hottea") => 0;
|
||||
@ -55,7 +55,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Dot path tests ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_stat(&lfs, "./tea/hottea", &info) => 0;
|
||||
strcmp(info.name, "hottea") => 0;
|
||||
@ -73,7 +73,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Dot dot path tests ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_stat(&lfs, "coffee/../tea/hottea", &info) => 0;
|
||||
strcmp(info.name, "hottea") => 0;
|
||||
@ -91,7 +91,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Trailing dot path tests ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_stat(&lfs, "tea/hottea/", &info) => 0;
|
||||
strcmp(info.name, "hottea") => 0;
|
||||
@ -107,7 +107,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Root dot dot path tests ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_stat(&lfs, "coffee/../../../../../../tea/hottea", &info) => 0;
|
||||
strcmp(info.name, "hottea") => 0;
|
||||
@ -119,7 +119,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Root tests ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_stat(&lfs, "/", &info) => 0;
|
||||
info.type => LFS_TYPE_DIR;
|
||||
@ -140,7 +140,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Sketchy path tests ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_mkdir(&lfs, "dirt/ground") => LFS_ERR_NOENT;
|
||||
lfs_mkdir(&lfs, "dirt/ground/earth") => LFS_ERR_NOENT;
|
||||
@ -148,7 +148,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Superblock conflict test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_mkdir(&lfs, "littlefs") => 0;
|
||||
lfs_remove(&lfs, "littlefs") => 0;
|
||||
@ -156,7 +156,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Max path test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
memset(buffer, 'w', LFS_NAME_MAX+1);
|
||||
buffer[LFS_NAME_MAX+2] = '\0';
|
||||
@ -174,7 +174,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Really big path test ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
memset(buffer, 'w', LFS_NAME_MAX);
|
||||
buffer[LFS_NAME_MAX+1] = '\0';
|
||||
@ -198,4 +198,4 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Results ---"
|
||||
tests/stats.py
|
||||
scripts/stats.py
|
||||
|
@ -7,7 +7,7 @@ LARGESIZE=132
|
||||
|
||||
echo "=== Seek tests ==="
|
||||
rm -rf blocks
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_mkdir(&lfs, "hello") => 0;
|
||||
@ -28,7 +28,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Simple dir seek ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "hello") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -70,7 +70,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Large dir seek ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_dir_open(&lfs, &dir[0], "hello") => 0;
|
||||
lfs_dir_read(&lfs, &dir[0], &info) => 1;
|
||||
@ -112,7 +112,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Simple file seek ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "hello/kitty042", LFS_O_RDONLY) => 0;
|
||||
|
||||
@ -161,7 +161,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Large file seek ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "hello/kitty042", LFS_O_RDONLY) => 0;
|
||||
|
||||
@ -210,7 +210,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Simple file seek and write ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "hello/kitty042", LFS_O_RDWR) => 0;
|
||||
|
||||
@ -251,7 +251,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Large file seek and write ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "hello/kitty042", LFS_O_RDWR) => 0;
|
||||
|
||||
@ -294,7 +294,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Boundary seek and write ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "hello/kitty042", LFS_O_RDWR) => 0;
|
||||
|
||||
@ -322,7 +322,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Out-of-bounds seek ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "hello/kitty042", LFS_O_RDWR) => 0;
|
||||
|
||||
@ -360,7 +360,7 @@ TEST
|
||||
echo "--- Inline write and seek ---"
|
||||
for SIZE in $SMALLSIZE $MEDIUMSIZE $LARGESIZE
|
||||
do
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "hello/tinykitty$SIZE",
|
||||
LFS_O_RDWR | LFS_O_CREAT) => 0;
|
||||
@ -426,4 +426,4 @@ TEST
|
||||
done
|
||||
|
||||
echo "--- Results ---"
|
||||
tests/stats.py
|
||||
scripts/stats.py
|
||||
|
@ -7,12 +7,12 @@ LARGESIZE=8192
|
||||
|
||||
echo "=== Truncate tests ==="
|
||||
rm -rf blocks
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
TEST
|
||||
|
||||
echo "--- Simple truncate ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "baldynoop",
|
||||
LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||
@ -27,7 +27,7 @@ tests/test.py << TEST
|
||||
lfs_file_close(&lfs, &file[0]) => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "baldynoop", LFS_O_RDWR) => 0;
|
||||
lfs_file_size(&lfs, &file[0]) => $LARGESIZE;
|
||||
@ -38,7 +38,7 @@ tests/test.py << TEST
|
||||
lfs_file_close(&lfs, &file[0]) => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "baldynoop", LFS_O_RDONLY) => 0;
|
||||
lfs_file_size(&lfs, &file[0]) => $MEDIUMSIZE;
|
||||
@ -55,7 +55,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Truncate and read ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "baldyread",
|
||||
LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||
@ -70,7 +70,7 @@ tests/test.py << TEST
|
||||
lfs_file_close(&lfs, &file[0]) => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "baldyread", LFS_O_RDWR) => 0;
|
||||
lfs_file_size(&lfs, &file[0]) => $LARGESIZE;
|
||||
@ -88,7 +88,7 @@ tests/test.py << TEST
|
||||
lfs_file_close(&lfs, &file[0]) => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "baldyread", LFS_O_RDONLY) => 0;
|
||||
lfs_file_size(&lfs, &file[0]) => $MEDIUMSIZE;
|
||||
@ -105,7 +105,7 @@ tests/test.py << TEST
|
||||
TEST
|
||||
|
||||
echo "--- Truncate and write ---"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "baldywrite",
|
||||
LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||
@ -120,7 +120,7 @@ tests/test.py << TEST
|
||||
lfs_file_close(&lfs, &file[0]) => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "baldywrite", LFS_O_RDWR) => 0;
|
||||
lfs_file_size(&lfs, &file[0]) => $LARGESIZE;
|
||||
@ -138,7 +138,7 @@ tests/test.py << TEST
|
||||
lfs_file_close(&lfs, &file[0]) => 0;
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
lfs_file_open(&lfs, &file[0], "baldywrite", LFS_O_RDONLY) => 0;
|
||||
lfs_file_size(&lfs, &file[0]) => $MEDIUMSIZE;
|
||||
@ -160,7 +160,7 @@ STARTSIZES="$1"
|
||||
STARTSEEKS="$2"
|
||||
HOTSIZES="$3"
|
||||
COLDSIZES="$4"
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
static const lfs_off_t startsizes[] = {$STARTSIZES};
|
||||
static const lfs_off_t startseeks[] = {$STARTSEEKS};
|
||||
static const lfs_off_t hotsizes[] = {$HOTSIZES};
|
||||
@ -192,7 +192,7 @@ tests/test.py << TEST
|
||||
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
static const lfs_off_t startsizes[] = {$STARTSIZES};
|
||||
static const lfs_off_t hotsizes[] = {$HOTSIZES};
|
||||
static const lfs_off_t coldsizes[] = {$COLDSIZES};
|
||||
@ -224,7 +224,7 @@ tests/test.py << TEST
|
||||
|
||||
lfs_unmount(&lfs) => 0;
|
||||
TEST
|
||||
tests/test.py << TEST
|
||||
scripts/test.py << TEST
|
||||
static const lfs_off_t startsizes[] = {$STARTSIZES};
|
||||
static const lfs_off_t hotsizes[] = {$HOTSIZES};
|
||||
static const lfs_off_t coldsizes[] = {$COLDSIZES};
|
||||
@ -299,4 +299,4 @@ truncate_test \
|
||||
"2*$LARGESIZE, 2*$LARGESIZE, 2*$LARGESIZE, 2*$LARGESIZE, 2*$LARGESIZE"
|
||||
|
||||
echo "--- Results ---"
|
||||
tests/stats.py
|
||||
scripts/stats.py
|
||||
|
Loading…
Reference in New Issue
Block a user