* [PATCH 1/7] erofs-utils: tests: fix when lz4 is not enabled
2021-01-21 16:37 [PATCH 0/7] Setup tests Hu Weiwen
@ 2021-01-21 16:37 ` Hu Weiwen
2021-01-22 0:21 ` Gao Xiang
2021-01-21 16:37 ` [PATCH 2/7] erofs-utils: tests: fix on out-of-tree build Hu Weiwen
` (5 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Hu Weiwen @ 2021-01-21 16:37 UTC (permalink / raw)
To: linux-erofs
Signed-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn>
---
tests/src/Makefile.am | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/src/Makefile.am b/tests/src/Makefile.am
index 4959592..ad272d6 100644
--- a/tests/src/Makefile.am
+++ b/tests/src/Makefile.am
@@ -2,11 +2,12 @@
# Makefile.am
AUTOMAKE_OPTIONS = foreign
-noinst_PROGRAMS = fssum badlz4
+noinst_PROGRAMS = fssum
fssum_SOURCES = md5.c fssum.c
if ENABLE_LZ4
+noinst_PROGRAMS += badlz4
badlz4_SOURCES = badlz4.c
badlz4_LDADD = ${liblz4_LIBS}
endif
--
2.30.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/7] erofs-utils: tests: fix when lz4 is not enabled
2021-01-21 16:37 ` [PATCH 1/7] erofs-utils: tests: fix when lz4 is not enabled Hu Weiwen
@ 2021-01-22 0:21 ` Gao Xiang
0 siblings, 0 replies; 13+ messages in thread
From: Gao Xiang @ 2021-01-22 0:21 UTC (permalink / raw)
To: Hu Weiwen; +Cc: linux-erofs
On Fri, Jan 22, 2021 at 12:37:09AM +0800, Hu Weiwen wrote:
> Signed-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn>
Generally it can be directly fixed to check_PROGRAMS =...
Otherwise, it looks good to me,
Reviewed-by: Gao Xiang <hsiangkao@aol.com>
Thanks,
Gao Xiang
> ---
> tests/src/Makefile.am | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tests/src/Makefile.am b/tests/src/Makefile.am
> index 4959592..ad272d6 100644
> --- a/tests/src/Makefile.am
> +++ b/tests/src/Makefile.am
> @@ -2,11 +2,12 @@
> # Makefile.am
>
> AUTOMAKE_OPTIONS = foreign
> -noinst_PROGRAMS = fssum badlz4
> +noinst_PROGRAMS = fssum
>
> fssum_SOURCES = md5.c fssum.c
>
> if ENABLE_LZ4
> +noinst_PROGRAMS += badlz4
> badlz4_SOURCES = badlz4.c
> badlz4_LDADD = ${liblz4_LIBS}
> endif
> --
> 2.30.0
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/7] erofs-utils: tests: fix on out-of-tree build
2021-01-21 16:37 [PATCH 0/7] Setup tests Hu Weiwen
2021-01-21 16:37 ` [PATCH 1/7] erofs-utils: tests: fix when lz4 is not enabled Hu Weiwen
@ 2021-01-21 16:37 ` Hu Weiwen
2021-01-22 0:19 ` Gao Xiang
2021-01-21 16:37 ` [PATCH 3/7] erofs-utils: tests: fix memory leakage in fssum Hu Weiwen
` (4 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Hu Weiwen @ 2021-01-21 16:37 UTC (permalink / raw)
To: linux-erofs
e.g.: mkdir debug && cd debug && ../configure && make check
Signed-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn>
---
.gitignore | 1 +
tests/erofs/001 | 2 +-
tests/erofs/002 | 2 +-
tests/erofs/003 | 2 +-
tests/erofs/004 | 2 +-
tests/erofs/005 | 2 +-
tests/erofs/006 | 2 +-
tests/erofs/007 | 2 +-
tests/erofs/008 | 2 +-
tests/erofs/009 | 2 +-
tests/erofs/010 | 2 +-
tests/erofs/011 | 2 +-
tests/erofs/012 | 2 +-
tests/erofs/013 | 2 +-
tests/erofs/014 | 2 +-
15 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/.gitignore b/.gitignore
index 8bdd505..e4349dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,3 +28,4 @@ libtool
stamp-h
stamp-h1
+*/tests/results/
diff --git a/tests/erofs/001 b/tests/erofs/001
index e4adfd4..2107e81 100755
--- a/tests/erofs/001
+++ b/tests/erofs/001
@@ -4,7 +4,7 @@ seq=`basename $0`
seqres=$RESULT_DIR/$seq
# get standard environment, filters and checks
-. common/rc
+. "${srcdir}/common/rc"
cleanup()
{
diff --git a/tests/erofs/002 b/tests/erofs/002
index 4f0d13a..88a5cbf 100755
--- a/tests/erofs/002
+++ b/tests/erofs/002
@@ -4,7 +4,7 @@ seq=`basename $0`
seqres=$RESULT_DIR/$seq
# get standard environment, filters and checks
-. common/rc
+. "${srcdir}/common/rc"
cleanup()
{
diff --git a/tests/erofs/003 b/tests/erofs/003
index b283801..43c1e07 100755
--- a/tests/erofs/003
+++ b/tests/erofs/003
@@ -4,7 +4,7 @@ seq=`basename $0`
seqres=$RESULT_DIR/$seq
# get standard environment, filters and checks
-. common/rc
+. "${srcdir}/common/rc"
cleanup()
{
diff --git a/tests/erofs/004 b/tests/erofs/004
index 6827f70..4a8284b 100755
--- a/tests/erofs/004
+++ b/tests/erofs/004
@@ -4,7 +4,7 @@ seq=`basename $0`
seqres=$RESULT_DIR/$seq
# get standard environment, filters and checks
-. common/rc
+. "${srcdir}/common/rc"
cleanup()
{
diff --git a/tests/erofs/005 b/tests/erofs/005
index 64c6d40..dd0487b 100755
--- a/tests/erofs/005
+++ b/tests/erofs/005
@@ -4,7 +4,7 @@ seq=`basename $0`
seqres=$RESULT_DIR/$seq
# get standard environment, filters and checks
-. common/rc
+. "${srcdir}/common/rc"
cleanup()
{
diff --git a/tests/erofs/006 b/tests/erofs/006
index 6a0222f..ebe1f8b 100755
--- a/tests/erofs/006
+++ b/tests/erofs/006
@@ -4,7 +4,7 @@ seq=`basename $0`
seqres=$RESULT_DIR/$seq
# get standard environment, filters and checks
-. common/rc
+. "${srcdir}/common/rc"
cleanup()
{
diff --git a/tests/erofs/007 b/tests/erofs/007
index 7f69617..80628cb 100755
--- a/tests/erofs/007
+++ b/tests/erofs/007
@@ -4,7 +4,7 @@ seq=`basename $0`
seqres=$RESULT_DIR/$seq
# get standard environment, filters and checks
-. common/rc
+. "${srcdir}/common/rc"
cleanup()
{
diff --git a/tests/erofs/008 b/tests/erofs/008
index 48b91b6..80a6d2e 100755
--- a/tests/erofs/008
+++ b/tests/erofs/008
@@ -4,7 +4,7 @@ seq=`basename $0`
seqres=$RESULT_DIR/$seq
# get standard environment, filters and checks
-. common/rc
+. "${srcdir}/common/rc"
cleanup()
{
diff --git a/tests/erofs/009 b/tests/erofs/009
index b95787e..14e6639 100755
--- a/tests/erofs/009
+++ b/tests/erofs/009
@@ -4,7 +4,7 @@ seq=`basename $0`
seqres=$RESULT_DIR/$seq
# get standard environment, filters and checks
-. common/rc
+. "${srcdir}/common/rc"
cleanup()
{
diff --git a/tests/erofs/010 b/tests/erofs/010
index 5b87e5b..c31e387 100755
--- a/tests/erofs/010
+++ b/tests/erofs/010
@@ -4,7 +4,7 @@ seq=`basename $0`
seqres=$RESULT_DIR/$seq
# get standard environment, filters and checks
-. common/rc
+. "${srcdir}/common/rc"
cleanup()
{
diff --git a/tests/erofs/011 b/tests/erofs/011
index 16d485c..3922ae6 100755
--- a/tests/erofs/011
+++ b/tests/erofs/011
@@ -4,7 +4,7 @@ seq=`basename $0`
seqres=$RESULT_DIR/$seq
# get standard environment, filters and checks
-. common/rc
+. "${srcdir}/common/rc"
cleanup()
{
diff --git a/tests/erofs/012 b/tests/erofs/012
index ab5d345..46dcc3a 100755
--- a/tests/erofs/012
+++ b/tests/erofs/012
@@ -4,7 +4,7 @@ seq=`basename $0`
seqres=$RESULT_DIR/$seq
# get standard environment, filters and checks
-. common/rc
+. "${srcdir}/common/rc"
cleanup()
{
diff --git a/tests/erofs/013 b/tests/erofs/013
index 1bc3448..0beac2e 100755
--- a/tests/erofs/013
+++ b/tests/erofs/013
@@ -4,7 +4,7 @@ seq=`basename $0`
seqres=$RESULT_DIR/$seq
# get standard environment, filters and checks
-. common/rc
+. "${srcdir}/common/rc"
cleanup()
{
diff --git a/tests/erofs/014 b/tests/erofs/014
index aa6b604..b94b48f 100755
--- a/tests/erofs/014
+++ b/tests/erofs/014
@@ -4,7 +4,7 @@ seq=`basename $0`
seqres=$RESULT_DIR/$seq
# get standard environment, filters and checks
-. common/rc
+. "${srcdir}/common/rc"
cleanup()
{
--
2.30.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/7] erofs-utils: tests: fix memory leakage in fssum
2021-01-21 16:37 [PATCH 0/7] Setup tests Hu Weiwen
2021-01-21 16:37 ` [PATCH 1/7] erofs-utils: tests: fix when lz4 is not enabled Hu Weiwen
2021-01-21 16:37 ` [PATCH 2/7] erofs-utils: tests: fix on out-of-tree build Hu Weiwen
@ 2021-01-21 16:37 ` Hu Weiwen
2021-01-21 23:45 ` Gao Xiang
2021-01-21 16:37 ` [PATCH 4/7] erofs-utils: tests: fix distcheck Hu Weiwen
` (3 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Hu Weiwen @ 2021-01-21 16:37 UTC (permalink / raw)
To: linux-erofs
Signed-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn>
---
tests/src/fssum.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/tests/src/fssum.c b/tests/src/fssum.c
index 10d6275..0f40452 100644
--- a/tests/src/fssum.c
+++ b/tests/src/fssum.c
@@ -31,6 +31,7 @@
#include <endian.h>
#define CS_SIZE 16
+#define CS_STR_SIZE (CS_SIZE * 2 + 1)
#define CHUNKS 128
#ifdef __linux__
@@ -209,16 +210,13 @@ sum_add_time(sum_t *dst, time_t t)
sum_add_u64(dst, t);
}
-char *
-sum_to_string(sum_t *dst)
+void
+sum_to_string(sum_t *dst, char *s)
{
int i;
- char *s = alloc(CS_SIZE * 2 + 1);
for (i = 0; i < CS_SIZE; ++i)
sprintf(s + i * 2, "%02x", dst->out[i]);
-
- return s;
}
int
@@ -523,7 +521,7 @@ sum(int dirfd, int level, sum_t *dircs, char *path_prefix, char *path_in)
exit(-1);
}
- d = fdopendir(dirfd);
+ d = fdopendir(dup(dirfd));
if (!d) {
perror("opendir");
exit(-1);
@@ -547,6 +545,7 @@ sum(int dirfd, int level, sum_t *dircs, char *path_prefix, char *path_in)
}
++entries;
}
+ closedir(d);
qsort(namelist, entries, sizeof(*namelist), namecmp);
for (i = 0; i < entries; ++i) {
struct stat64 st;
@@ -674,21 +673,19 @@ sum(int dirfd, int level, sum_t *dircs, char *path_prefix, char *path_in)
sum_fini(&meta);
if (gen_manifest || in_manifest) {
char *fn;
- char *m;
- char *c;
+ char m[CS_STR_SIZE];
+ char c[CS_STR_SIZE];
if (S_ISDIR(st.st_mode))
strcat(path, "/");
fn = escape(path);
- m = sum_to_string(&meta);
- c = sum_to_string(&cs);
+ sum_to_string(&meta, m);
+ sum_to_string(&cs, c);
if (gen_manifest)
fprintf(out_fp, "%s %s %s\n", fn, m, c);
if (in_manifest)
check_manifest(fn, m, c, 0);
- free(c);
- free(m);
free(fn);
}
sum_add_sum(dircs, &cs);
@@ -696,6 +693,9 @@ sum(int dirfd, int level, sum_t *dircs, char *path_prefix, char *path_in)
next:
free(path);
}
+ for (i = 0; i < entries; ++i)
+ free(namelist[i]);
+ free(namelist);
}
int
@@ -713,6 +713,7 @@ main(int argc, char *argv[])
int elen;
int n_flags = 0;
const char *allopts = "heEfuUgGoOaAmMcCdDtTsSnNw:r:vx:";
+ char sum_string[CS_STR_SIZE];
out_fp = stdout;
while ((c = getopt(argc, argv, allopts)) != EOF) {
@@ -871,9 +872,11 @@ main(int argc, char *argv[])
if (!gen_manifest)
fprintf(out_fp, "%s:", flagstring);
- fprintf(out_fp, "%s\n", sum_to_string(&cs));
+ sum_to_string(&cs, sum_string);
+ fprintf(out_fp, "%s\n", sum_string);
} else {
- if (strcmp(checksum, sum_to_string(&cs)) == 0) {
+ sum_to_string(&cs, sum_string);
+ if (strcmp(checksum, sum_string) == 0) {
printf("OK\n");
exit(0);
} else {
--
2.30.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 3/7] erofs-utils: tests: fix memory leakage in fssum
2021-01-21 16:37 ` [PATCH 3/7] erofs-utils: tests: fix memory leakage in fssum Hu Weiwen
@ 2021-01-21 23:45 ` Gao Xiang
0 siblings, 0 replies; 13+ messages in thread
From: Gao Xiang @ 2021-01-21 23:45 UTC (permalink / raw)
To: Hu Weiwen; +Cc: linux-erofs
Hi Weiwen,
On Fri, Jan 22, 2021 at 12:37:11AM +0800, Hu Weiwen wrote:
> Signed-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn>
It just synced up with fstests, if you'd like to fix memory leakage of
this program. How about sending out it to fstests community directly?
fstests <fstests@vger.kernel.org>
and
https://lore.kernel.org/fstests/
So newer fssum here can be synced up again... (Also, kindly reminder,
before you submit it to fstests community, it'd be better leave some
commit message rather than leave it empty, since empty commit messge
(I mean only SOB) is somewhat uncommon for linux community...)
Thanks,
Gao Xiang
> ---
> tests/src/fssum.c | 31 +++++++++++++++++--------------
> 1 file changed, 17 insertions(+), 14 deletions(-)
>
> diff --git a/tests/src/fssum.c b/tests/src/fssum.c
> index 10d6275..0f40452 100644
> --- a/tests/src/fssum.c
> +++ b/tests/src/fssum.c
> @@ -31,6 +31,7 @@
> #include <endian.h>
>
> #define CS_SIZE 16
> +#define CS_STR_SIZE (CS_SIZE * 2 + 1)
> #define CHUNKS 128
>
> #ifdef __linux__
> @@ -209,16 +210,13 @@ sum_add_time(sum_t *dst, time_t t)
> sum_add_u64(dst, t);
> }
>
> -char *
> -sum_to_string(sum_t *dst)
> +void
> +sum_to_string(sum_t *dst, char *s)
> {
> int i;
> - char *s = alloc(CS_SIZE * 2 + 1);
>
> for (i = 0; i < CS_SIZE; ++i)
> sprintf(s + i * 2, "%02x", dst->out[i]);
> -
> - return s;
> }
>
> int
> @@ -523,7 +521,7 @@ sum(int dirfd, int level, sum_t *dircs, char *path_prefix, char *path_in)
> exit(-1);
> }
>
> - d = fdopendir(dirfd);
> + d = fdopendir(dup(dirfd));
> if (!d) {
> perror("opendir");
> exit(-1);
> @@ -547,6 +545,7 @@ sum(int dirfd, int level, sum_t *dircs, char *path_prefix, char *path_in)
> }
> ++entries;
> }
> + closedir(d);
> qsort(namelist, entries, sizeof(*namelist), namecmp);
> for (i = 0; i < entries; ++i) {
> struct stat64 st;
> @@ -674,21 +673,19 @@ sum(int dirfd, int level, sum_t *dircs, char *path_prefix, char *path_in)
> sum_fini(&meta);
> if (gen_manifest || in_manifest) {
> char *fn;
> - char *m;
> - char *c;
> + char m[CS_STR_SIZE];
> + char c[CS_STR_SIZE];
>
> if (S_ISDIR(st.st_mode))
> strcat(path, "/");
> fn = escape(path);
> - m = sum_to_string(&meta);
> - c = sum_to_string(&cs);
> + sum_to_string(&meta, m);
> + sum_to_string(&cs, c);
>
> if (gen_manifest)
> fprintf(out_fp, "%s %s %s\n", fn, m, c);
> if (in_manifest)
> check_manifest(fn, m, c, 0);
> - free(c);
> - free(m);
> free(fn);
> }
> sum_add_sum(dircs, &cs);
> @@ -696,6 +693,9 @@ sum(int dirfd, int level, sum_t *dircs, char *path_prefix, char *path_in)
> next:
> free(path);
> }
> + for (i = 0; i < entries; ++i)
> + free(namelist[i]);
> + free(namelist);
> }
>
> int
> @@ -713,6 +713,7 @@ main(int argc, char *argv[])
> int elen;
> int n_flags = 0;
> const char *allopts = "heEfuUgGoOaAmMcCdDtTsSnNw:r:vx:";
> + char sum_string[CS_STR_SIZE];
>
> out_fp = stdout;
> while ((c = getopt(argc, argv, allopts)) != EOF) {
> @@ -871,9 +872,11 @@ main(int argc, char *argv[])
> if (!gen_manifest)
> fprintf(out_fp, "%s:", flagstring);
>
> - fprintf(out_fp, "%s\n", sum_to_string(&cs));
> + sum_to_string(&cs, sum_string);
> + fprintf(out_fp, "%s\n", sum_string);
> } else {
> - if (strcmp(checksum, sum_to_string(&cs)) == 0) {
> + sum_to_string(&cs, sum_string);
> + if (strcmp(checksum, sum_string) == 0) {
> printf("OK\n");
> exit(0);
> } else {
> --
> 2.30.0
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 4/7] erofs-utils: tests: fix distcheck
2021-01-21 16:37 [PATCH 0/7] Setup tests Hu Weiwen
` (2 preceding siblings ...)
2021-01-21 16:37 ` [PATCH 3/7] erofs-utils: tests: fix memory leakage in fssum Hu Weiwen
@ 2021-01-21 16:37 ` Hu Weiwen
2021-01-22 0:16 ` Gao Xiang
2021-01-21 16:37 ` [PATCH 5/7] erofs-utils: tests: check battach on full buffer block Hu Weiwen
` (2 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Hu Weiwen @ 2021-01-21 16:37 UTC (permalink / raw)
To: linux-erofs
To get required files to final .tar.gz distribution:
* Any header files should goes into _SOURCES.
* check scripts should goes into dist_check_SCRIPTS.
* 001.out will trigger a GNU make implicit rule, rename it to 001-out
Signed-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn>
---
lib/Makefile.am | 19 ++++++++++++++++++-
tests/Makefile.am | 22 ++++++++++++++++++++++
tests/common/rc | 2 +-
tests/erofs/{001.out => 001-out} | 0
tests/erofs/{002.out => 002-out} | 0
tests/erofs/{003.out => 003-out} | 0
tests/erofs/{004.out => 004-out} | 0
tests/erofs/{005.out => 005-out} | 0
tests/erofs/{006.out => 006-out} | 0
tests/erofs/007 | 2 +-
tests/erofs/{007.out => 007-out} | 0
tests/erofs/{008.out => 008-out} | 0
tests/erofs/{009.out => 009-out} | 0
tests/erofs/{010.out => 010-out} | 0
tests/erofs/{011.out => 011-out} | 0
tests/erofs/{012.out => 012-out} | 0
tests/erofs/{013.out => 013-out} | 0
tests/erofs/{014.out => 014-out} | 0
tests/src/Makefile.am | 6 +++---
19 files changed, 45 insertions(+), 6 deletions(-)
rename tests/erofs/{001.out => 001-out} (100%)
rename tests/erofs/{002.out => 002-out} (100%)
rename tests/erofs/{003.out => 003-out} (100%)
rename tests/erofs/{004.out => 004-out} (100%)
rename tests/erofs/{005.out => 005-out} (100%)
rename tests/erofs/{006.out => 006-out} (100%)
rename tests/erofs/{007.out => 007-out} (100%)
rename tests/erofs/{008.out => 008-out} (100%)
rename tests/erofs/{009.out => 009-out} (100%)
rename tests/erofs/{010.out => 010-out} (100%)
rename tests/erofs/{011.out => 011-out} (100%)
rename tests/erofs/{012.out => 012-out} (100%)
rename tests/erofs/{013.out => 013-out} (100%)
rename tests/erofs/{014.out => 014-out} (100%)
diff --git a/lib/Makefile.am b/lib/Makefile.am
index f21dc35..72c32da 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -3,7 +3,24 @@
noinst_LTLIBRARIES = liberofs.la
liberofs_la_SOURCES = config.c io.c cache.c super.c inode.c xattr.c exclude.c \
- namei.c data.c compress.c compressor.c zmap.c decompress.c
+ namei.c data.c compress.c compressor.c zmap.c decompress.c \
+ compressor.h \
+ $(top_srcdir)/include/erofs_fs.h \
+ $(top_srcdir)/include/erofs/cache.h \
+ $(top_srcdir)/include/erofs/compress.h \
+ $(top_srcdir)/include/erofs/config.h \
+ $(top_srcdir)/include/erofs/decompress.h \
+ $(top_srcdir)/include/erofs/defs.h \
+ $(top_srcdir)/include/erofs/err.h \
+ $(top_srcdir)/include/erofs/exclude.h \
+ $(top_srcdir)/include/erofs/hashtable.h \
+ $(top_srcdir)/include/erofs/inode.h \
+ $(top_srcdir)/include/erofs/internal.h \
+ $(top_srcdir)/include/erofs/io.h \
+ $(top_srcdir)/include/erofs/list.h \
+ $(top_srcdir)/include/erofs/print.h \
+ $(top_srcdir)/include/erofs/trace.h \
+ $(top_srcdir)/include/erofs/xattr.h
liberofs_la_CFLAGS = -Wall -Werror -I$(top_srcdir)/include
if ENABLE_LZ4
liberofs_la_CFLAGS += ${LZ4_CFLAGS}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index efc38fd..3702f91 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -5,6 +5,7 @@ AUTOMAKE_OPTIONS = serial-tests
SUBDIRS = src
TESTS =
+TESTS_OUT =
TESTS_ENVIRONMENT = \
if [ -z $$SCRATCH_MNT ]; then \
@@ -27,43 +28,64 @@ endif
# 001 - test if unknown algorithm is specificed
TESTS += erofs/001
+TESTS_OUT += erofs/001-out
# 002 - mkfs & test short symlink (fast symlink)
TESTS += erofs/002
+TESTS_OUT += erofs/002-out
# 003 - mkfs & test long symlink (non-fast symlink)
TESTS += erofs/003
+TESTS_OUT += erofs/003-out
# 004 - mkfs & test character/block device
TESTS += erofs/004
+TESTS_OUT += erofs/004-out
# 005 - mkfs & test pipe
TESTS += erofs/005
+TESTS_OUT += erofs/005-out
# 006 - verify the uncompressed image
TESTS += erofs/006
+TESTS_OUT += erofs/006-out
# 007 - check for bad lz4 versions
TESTS += erofs/007
+TESTS_OUT += erofs/007-out
# 008 - verify lz4 compressed image
TESTS += erofs/008
+TESTS_OUT += erofs/008-out
# 009 - verify lz4hc compressed image
TESTS += erofs/009
+TESTS_OUT += erofs/009-out
# 010 - (legacy image) verify lz4 compressed image
TESTS += erofs/010
+TESTS_OUT += erofs/010-out
# 011 - (legacy image) verify lz4hc compressed image
TESTS += erofs/011
+TESTS_OUT += erofs/011-out
# 012 - check the hard-link functionality
TESTS += erofs/012
+TESTS_OUT += erofs/012-out
# 013 - check if hardlinked directories are allowed
TESTS += erofs/013
+TESTS_OUT += erofs/013-out
# 014 - check if cross-device submounts are handled properly
TESTS += erofs/014
+TESTS_OUT += erofs/014-out
+dist_check_SCRIPTS = common/rc $(TESTS)
+dist_check_DATA = $(TESTS_OUT)
+
+clean-local: clean-local-check
+.PHONY: clean-local-check
+clean-local-check:
+ -rm -rf results
diff --git a/tests/common/rc b/tests/common/rc
index a6b6014..edce3ff 100644
--- a/tests/common/rc
+++ b/tests/common/rc
@@ -199,7 +199,7 @@ _check_results()
[ -z $srcdir ] && return 0
[ -f $seqres.notrun ] && return 0
- if ! diff `dirname $0`/$seq.out $tmp.out >/dev/null 2>&1 ; then
+ if ! diff `dirname $0`/$seq-out $tmp.out >/dev/null 2>&1 ; then
mv $tmp.out $seqres.out.bad
return 1
fi
diff --git a/tests/erofs/001.out b/tests/erofs/001-out
similarity index 100%
rename from tests/erofs/001.out
rename to tests/erofs/001-out
diff --git a/tests/erofs/002.out b/tests/erofs/002-out
similarity index 100%
rename from tests/erofs/002.out
rename to tests/erofs/002-out
diff --git a/tests/erofs/003.out b/tests/erofs/003-out
similarity index 100%
rename from tests/erofs/003.out
rename to tests/erofs/003-out
diff --git a/tests/erofs/004.out b/tests/erofs/004-out
similarity index 100%
rename from tests/erofs/004.out
rename to tests/erofs/004-out
diff --git a/tests/erofs/005.out b/tests/erofs/005-out
similarity index 100%
rename from tests/erofs/005.out
rename to tests/erofs/005-out
diff --git a/tests/erofs/006.out b/tests/erofs/006-out
similarity index 100%
rename from tests/erofs/006.out
rename to tests/erofs/006-out
diff --git a/tests/erofs/007 b/tests/erofs/007
index 80628cb..1e9a780 100755
--- a/tests/erofs/007
+++ b/tests/erofs/007
@@ -21,7 +21,7 @@ echo "QA output created by $seq"
[ -z "$lz4_on" ] && \
_notrun "lz4 compression is disabled, skipped."
-$here/src/badlz4 >> $seqres.full 2>&1 || _fail "--> lz4 test FAILED"
+./src/badlz4 >> $seqres.full 2>&1 || _fail "--> lz4 test FAILED"
echo Silence is golden
status=0
diff --git a/tests/erofs/007.out b/tests/erofs/007-out
similarity index 100%
rename from tests/erofs/007.out
rename to tests/erofs/007-out
diff --git a/tests/erofs/008.out b/tests/erofs/008-out
similarity index 100%
rename from tests/erofs/008.out
rename to tests/erofs/008-out
diff --git a/tests/erofs/009.out b/tests/erofs/009-out
similarity index 100%
rename from tests/erofs/009.out
rename to tests/erofs/009-out
diff --git a/tests/erofs/010.out b/tests/erofs/010-out
similarity index 100%
rename from tests/erofs/010.out
rename to tests/erofs/010-out
diff --git a/tests/erofs/011.out b/tests/erofs/011-out
similarity index 100%
rename from tests/erofs/011.out
rename to tests/erofs/011-out
diff --git a/tests/erofs/012.out b/tests/erofs/012-out
similarity index 100%
rename from tests/erofs/012.out
rename to tests/erofs/012-out
diff --git a/tests/erofs/013.out b/tests/erofs/013-out
similarity index 100%
rename from tests/erofs/013.out
rename to tests/erofs/013-out
diff --git a/tests/erofs/014.out b/tests/erofs/014-out
similarity index 100%
rename from tests/erofs/014.out
rename to tests/erofs/014-out
diff --git a/tests/src/Makefile.am b/tests/src/Makefile.am
index ad272d6..537d6b7 100644
--- a/tests/src/Makefile.am
+++ b/tests/src/Makefile.am
@@ -2,12 +2,12 @@
# Makefile.am
AUTOMAKE_OPTIONS = foreign
-noinst_PROGRAMS = fssum
+check_PROGRAMS = fssum
-fssum_SOURCES = md5.c fssum.c
+fssum_SOURCES = md5.c md5.h fssum.c
if ENABLE_LZ4
-noinst_PROGRAMS += badlz4
+check_PROGRAMS += badlz4
badlz4_SOURCES = badlz4.c
badlz4_LDADD = ${liblz4_LIBS}
endif
--
2.30.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 4/7] erofs-utils: tests: fix distcheck
2021-01-21 16:37 ` [PATCH 4/7] erofs-utils: tests: fix distcheck Hu Weiwen
@ 2021-01-22 0:16 ` Gao Xiang
2021-01-22 1:09 ` 胡玮文
0 siblings, 1 reply; 13+ messages in thread
From: Gao Xiang @ 2021-01-22 0:16 UTC (permalink / raw)
To: Hu Weiwen; +Cc: linux-erofs
Hi Weiwen,
On Fri, Jan 22, 2021 at 12:37:12AM +0800, Hu Weiwen wrote:
> To get required files to final .tar.gz distribution:
> * Any header files should goes into _SOURCES.
should we use noinst_HEADERS instead? do you have some reference
link (I mean document) for this? what's the impact of this,
just dictcheck? I'm not familiar with that...
> * check scripts should goes into dist_check_SCRIPTS.
> * 001.out will trigger a GNU make implicit rule, rename it to 001-out
How about also renaming $tmp.out to $tmp.stdout?
Also, 'since experimental-tests' has't merged into dev, do you mind
me folding these bugfix patches (I mean except for "[PATCH 5/7] and
[PATCH 7/7]") into the original patches, and add your contribution
description & SOB(Signed-off-by:) to the commit message? That would
make the whole commit history much cleaner... If you agree that, I
will resend the testcase patchset later with your fixes and new
patches and wait for Guifu to review if he has extra free slots.
Note that, only dev & master branches have stable commit ids.
experimental-xxx could be rebased frequently.
Thanks,
Gao Xiang
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/7] erofs-utils: tests: fix distcheck
2021-01-22 0:16 ` Gao Xiang
@ 2021-01-22 1:09 ` 胡玮文
0 siblings, 0 replies; 13+ messages in thread
From: 胡玮文 @ 2021-01-22 1:09 UTC (permalink / raw)
To: Gao Xiang; +Cc: linux-erofs
[-- Attachment #1: Type: text/plain, Size: 1529 bytes --]
> 在 2021年1月22日,08:16,Gao Xiang <hsiangkao@redhat.com> 写道:
>
> Hi Weiwen,
>
>> On Fri, Jan 22, 2021 at 12:37:12AM +0800, Hu Weiwen wrote:
>> To get required files to final .tar.gz distribution:
>> * Any header files should goes into _SOURCES.
>
> should we use noinst_HEADERS instead? do you have some reference
> link (I mean document) for this? what's the impact of this,
> just dictcheck? I'm not familiar with that...
https://www.gnu.org/software/automake/manual/automake.html#Program-Sources
I quote from above link:
Header files listed in a _SOURCES definition will be included in the distribution but otherwise ignored
>> * check scripts should goes into dist_check_SCRIPTS.
>> * 001.out will trigger a GNU make implicit rule, rename it to 001-out
>
> How about also renaming $tmp.out to $tmp.stdout?
Yes, that should work.
> Also, 'since experimental-tests' has't merged into dev, do you mind
> me folding these bugfix patches (I mean except for "[PATCH 5/7] and
> [PATCH 7/7]") into the original patches, and add your contribution
> description & SOB(Signed-off-by:) to the commit message? That would
> make the whole commit history much cleaner... If you agree that, I
> will resend the testcase patchset later with your fixes and new
> patches and wait for Guifu to review if he has extra free slots.
Okay.
> Note that, only dev & master branches have stable commit ids.
> experimental-xxx could be rebased frequently.
>
> Thanks,
> Gao Xiang
[-- Attachment #2: Type: text/html, Size: 2951 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 5/7] erofs-utils: tests: check battach on full buffer block
2021-01-21 16:37 [PATCH 0/7] Setup tests Hu Weiwen
` (3 preceding siblings ...)
2021-01-21 16:37 ` [PATCH 4/7] erofs-utils: tests: fix distcheck Hu Weiwen
@ 2021-01-21 16:37 ` Hu Weiwen
2021-01-21 16:41 ` [PATCH 6/7] erofs-utils: tests: fix fuse build order Hu Weiwen
2021-01-21 16:42 ` [PATCH 7/7] erofs-utils: tests: enable GitHub Actions Hu Weiwen
6 siblings, 0 replies; 13+ messages in thread
From: Hu Weiwen @ 2021-01-21 16:37 UTC (permalink / raw)
To: linux-erofs
regression test for
https://lore.kernel.org/linux-erofs/20210118123945.23676-1-sehuww@mail.scut.edu.cn/
Signed-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn>
---
tests/Makefile.am | 4 ++++
tests/erofs/015 | 55 +++++++++++++++++++++++++++++++++++++++++++++
tests/erofs/015-out | 2 ++
3 files changed, 61 insertions(+)
create mode 100755 tests/erofs/015
create mode 100644 tests/erofs/015-out
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3702f91..03f3ab3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -82,6 +82,10 @@ TESTS_OUT += erofs/013-out
TESTS += erofs/014
TESTS_OUT += erofs/014-out
+# 015 - battach on full buffer block
+TESTS += erofs/015
+TESTS_OUT += erofs/015-out
+
dist_check_SCRIPTS = common/rc $(TESTS)
dist_check_DATA = $(TESTS_OUT)
diff --git a/tests/erofs/015 b/tests/erofs/015
new file mode 100755
index 0000000..f445ba1
--- /dev/null
+++ b/tests/erofs/015
@@ -0,0 +1,55 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+
+# get standard environment, filters and checks
+. "${srcdir}/common/rc"
+
+cleanup()
+{
+ cd /
+ rm -rf $tmp.*
+}
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+echo "QA output created by $seq"
+
+if [ -z $SCRATCH_DEV ]; then
+ SCRATCH_DEV=$tmp/erofs_$seq.img
+ rm -f SCRATCH_DEV
+fi
+
+localdir="$tmp/$seq"
+rm -rf $localdir
+mkdir -p $localdir
+
+# collect files pending for verification
+head -c 4032 /dev/urandom > $localdir/1
+head -c 4095 /dev/urandom > $localdir/2
+head -c 12345 /dev/urandom > $localdir/3 # arbitrary size
+
+_scratch_mkfs -Eforce-inode-compact $localdir || _fail "failed to mkfs"
+
+# verify the uncompressed image
+_require_erofs
+
+_scratch_mount 2>>$seqres.full
+
+FSSUM_OPTS="-MAC"
+[ $FSTYP = "erofsfuse" ] && FSSUM_OPTS="${FSSUM_OPTS}T"
+
+sum1=`$FSSUM_PROG $FSSUM_OPTS $localdir`
+echo "$localdir checksum is $sum1" >>$seqres.full
+sum2=`$FSSUM_PROG $FSSUM_OPTS $SCRATCH_MNT`
+echo "$SCRATCH_MNT checksum is $sum2" >>$seqres.full
+
+[ "x$sum1" = "x$sum2" ] || _fail "-->checkMD5 FAILED"
+_scratch_unmount
+
+echo Silence is golden
+status=0
+exit 0
diff --git a/tests/erofs/015-out b/tests/erofs/015-out
new file mode 100644
index 0000000..fee0fcf
--- /dev/null
+++ b/tests/erofs/015-out
@@ -0,0 +1,2 @@
+QA output created by 015
+Silence is golden
--
2.30.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 6/7] erofs-utils: tests: fix fuse build order
2021-01-21 16:37 [PATCH 0/7] Setup tests Hu Weiwen
` (4 preceding siblings ...)
2021-01-21 16:37 ` [PATCH 5/7] erofs-utils: tests: check battach on full buffer block Hu Weiwen
@ 2021-01-21 16:41 ` Hu Weiwen
2021-01-21 16:42 ` [PATCH 7/7] erofs-utils: tests: enable GitHub Actions Hu Weiwen
6 siblings, 0 replies; 13+ messages in thread
From: Hu Weiwen @ 2021-01-21 16:41 UTC (permalink / raw)
To: linux-erofs
Signed-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn>
---
Makefile.am | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index e7a22b2..bcadd6f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,8 +3,9 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = man lib mkfs tests
+SUBDIRS = man lib mkfs
if ENABLE_FUSE
SUBDIRS += fuse
endif
+SUBDIRS += tests
--
2.30.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 7/7] erofs-utils: tests: enable GitHub Actions
2021-01-21 16:37 [PATCH 0/7] Setup tests Hu Weiwen
` (5 preceding siblings ...)
2021-01-21 16:41 ` [PATCH 6/7] erofs-utils: tests: fix fuse build order Hu Weiwen
@ 2021-01-21 16:42 ` Hu Weiwen
6 siblings, 0 replies; 13+ messages in thread
From: Hu Weiwen @ 2021-01-21 16:42 UTC (permalink / raw)
To: linux-erofs
Use GitHub Actions to run tests automatically.
for two configuration: no lz4, with lz4 v1.8.3
run tests: make check; FSTYPE=fuse make check; sudo make check; make distcheck
Signed-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn>
---
.github/workflows/c.yml | 49 +++++++++++++++++++++++++++++++++++++++++
.gitignore | 1 +
2 files changed, 50 insertions(+)
create mode 100644 .github/workflows/c.yml
diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml
new file mode 100644
index 0000000..1d55feb
--- /dev/null
+++ b/.github/workflows/c.yml
@@ -0,0 +1,49 @@
+name: C CI
+
+on:
+ push:
+ pull_request:
+ branches: [ dev ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-20.04
+ strategy:
+ matrix:
+ lz4: [no, v1.9.3]
+
+ steps:
+ - name: check kernel version
+ run: uname -a
+ - uses: actions/checkout@v2
+ - name: install dependencies
+ run: sudo apt-get install uuid-dev libfuse-dev
+ - name: install lz4
+ if: ${{ matrix.lz4 != 'no' }}
+ run: |
+ cd
+ git clone --depth=1 --branch=${{ matrix.lz4 }} https://github.com/lz4/lz4.git
+ cd lz4
+ make
+ sudo make install
+ sudo ldconfig
+ - name: autogen
+ run: ./autogen.sh
+ - name: configure
+ run: ./configure --enable-fuse
+ - name: make
+ run: make
+ - name: make check
+ run: make check
+ - name: make check (fuse)
+ run: FSTYP=erofsfuse make check
+ - name: make check (root)
+ run: sudo make check
+ - uses: actions/upload-artifact@v2
+ if: ${{ !cancelled() }}
+ with:
+ name: test-results-lz4-${{ matrix.lz4 }}
+ path: tests/results
+ - name: make distcheck
+ run: make distcheck
diff --git a/.gitignore b/.gitignore
index e4349dd..0feae62 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@
*.so
*.so.dbg
*.tar.*
+!.github
#
# Generated files
--
2.30.0
^ permalink raw reply related [flat|nested] 13+ messages in thread