All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv1 1/3] tests: make jittertest buildable
@ 2011-04-05 11:33 Andy Shevchenko
  2011-04-05 11:33 ` [PATCHv1 2/3] tests: build tests by default Andy Shevchenko
  2011-04-05 12:51 ` [PATCHv1 1/3] tests: make jittertest buildable Artem Bityutskiy
  0 siblings, 2 replies; 29+ messages in thread
From: Andy Shevchenko @ 2011-04-05 11:33 UTC (permalink / raw)
  To: Artem Bityutskiy, linux-mtd; +Cc: Andy Shevchenko

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 tests/jittertest/JitterTest.c |    6 +++---
 tests/jittertest/Makefile     |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/jittertest/JitterTest.c b/tests/jittertest/JitterTest.c
index 13c64d9..fcf8e0d 100644
--- a/tests/jittertest/JitterTest.c
+++ b/tests/jittertest/JitterTest.c
@@ -292,7 +292,7 @@ int main(
     }
 
     /*------------------------- Initializations --------------------------*/
-    if((Fd1 = open(OutFileName, O_RDWR|O_CREAT|O_SYNC)) <= 0)
+    if((Fd1 = open(OutFileName, O_RDWR|O_CREAT|O_SYNC, S_IRWXU)) <= 0)
     {
         perror("Cannot open outfile for write:");
         exit(1);
@@ -304,7 +304,7 @@ int main(
     if(DoRead)
     {
 
-        if((Fd2 = open(ReadFile, O_RDWR|O_CREAT|O_SYNC|O_TRUNC)) <= 0)
+        if((Fd2 = open(ReadFile, O_RDWR|O_CREAT|O_SYNC|O_TRUNC, S_IRWXU)) <= 0)
         {
             perror("cannot open read file:");
             exit(1);
@@ -459,7 +459,7 @@ void doGrabKProfile(int jitterusec, char *fileName)
     int readBytes;
     char readBuf[4096];
 
-    if((fdSnapshot = open(fileName, O_WRONLY | O_CREAT)) <= 0)
+    if((fdSnapshot = open(fileName, O_WRONLY | O_CREAT, S_IRWXU)) <= 0)
     {
         fprintf(stderr, "Could not open file %s.\n", fileName);
         perror("Error:");
diff --git a/tests/jittertest/Makefile b/tests/jittertest/Makefile
index 2f11329..0209c63 100644
--- a/tests/jittertest/Makefile
+++ b/tests/jittertest/Makefile
@@ -1,6 +1,6 @@
 CC=gcc
 # uncomment following for performance
-CCFLAGS=-O3 -Wall -m486 -fomit-frame-pointer
+CCFLAGS=-O3 -Wall -fomit-frame-pointer
 
 # uncomment following for debugging. Uncomment either this or the one above. Not both.
 # CCFLAGS=-Wall -g
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCHv1 2/3] tests: build tests by default
  2011-04-05 11:33 [PATCHv1 1/3] tests: make jittertest buildable Andy Shevchenko
@ 2011-04-05 11:33 ` Andy Shevchenko
  2011-04-05 11:33   ` [PATCHv1 3/3] tests: fix compiler warnings Andy Shevchenko
  2011-04-05 12:44   ` [PATCHv1 2/3] tests: build tests by default Josh Boyer
  2011-04-05 12:51 ` [PATCHv1 1/3] tests: make jittertest buildable Artem Bityutskiy
  1 sibling, 2 replies; 29+ messages in thread
From: Andy Shevchenko @ 2011-04-05 11:33 UTC (permalink / raw)
  To: Artem Bityutskiy, linux-mtd; +Cc: Andy Shevchenko

Also, append Makefile to the tests subdirectory.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 Makefile       |    4 ++--
 tests/Makefile |    8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)
 create mode 100644 tests/Makefile

diff --git a/Makefile b/Makefile
index 7ab9743..7269c6a 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ ifeq ($(WITHOUT_XATTR), 1)
   CPPFLAGS += -DWITHOUT_XATTR
 endif
 
-SUBDIRS = lib ubi-utils mkfs.ubifs
+SUBDIRS = lib ubi-utils mkfs.ubifs tests
 
 TARGETS = ftl_format flash_erase nanddump doc_loadbios \
 	ftl_check mkfs.jffs2 flash_lock flash_unlock flash_info \
@@ -54,7 +54,7 @@ LDLIBS_jffs2reader  = -lz -llzo2
 
 $(BUILDDIR)/lib/libmtd.a: subdirs_lib_all ;
 
-install:: ${TARGETS} ${SCRIPTS}
+install:: ${TARGETS} ${SCRIPTS} tests
 	mkdir -p ${DESTDIR}/${SBINDIR}
 	install -m 0755 ${TARGETS} ${SCRIPTS} ${DESTDIR}/${SBINDIR}/
 	mkdir -p ${DESTDIR}/${MANDIR}/man1
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 0000000..05b37e9
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,8 @@
+
+SUBDIRS = checkfs fs-tests jittertest ubi-tests
+
+all clean tests: $(SUBDIRS)
+
+.PHONY: $(SUBDIRS)
+$(SUBDIRS):
+	$(MAKE) -C $@ $(MAKECMDGOALS)
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCHv1 3/3] tests: fix compiler warnings
  2011-04-05 11:33 ` [PATCHv1 2/3] tests: build tests by default Andy Shevchenko
@ 2011-04-05 11:33   ` Andy Shevchenko
  2011-04-05 12:52     ` Artem Bityutskiy
  2011-04-05 12:44   ` [PATCHv1 2/3] tests: build tests by default Josh Boyer
  1 sibling, 1 reply; 29+ messages in thread
From: Andy Shevchenko @ 2011-04-05 11:33 UTC (permalink / raw)
  To: Artem Bityutskiy, linux-mtd; +Cc: Andy Shevchenko

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 tests/checkfs/checkfs.c              |    8 ++++----
 tests/checkfs/comm.c                 |    2 +-
 tests/fs-tests/lib/tests.c           |    3 ++-
 tests/fs-tests/stress/atoms/pdfrun.c |    5 ++++-
 tests/jittertest/JitterTest.c        |   11 ++++++++---
 tests/ubi-tests/integ.c              |    5 +++--
 6 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/tests/checkfs/checkfs.c b/tests/checkfs/checkfs.c
index da2d0c4..3224d2b 100644
--- a/tests/checkfs/checkfs.c
+++ b/tests/checkfs/checkfs.c
@@ -167,11 +167,11 @@ int setupSerial (const char *dev) {
 
     fd = open(dev,O_RDWR | O_NDELAY );
     if (fd < 0) {
-        fprintf(stderr, "%s: %s\n", dev, sys_errlist[errno]);
+        fprintf(stderr, "%s: %s\n", dev, strerror(errno));
         exit(1);
     }
     if (tcgetattr(fd, &tios) < 0) {
-        fprintf(stderr,"Could not get terminal attributes: %s",sys_errlist[errno]);
+        fprintf(stderr, "Could not get terminal attributes: %s", strerror(errno));
         exit(1);
     }
 
@@ -197,7 +197,7 @@ int setupSerial (const char *dev) {
     cfsetispeed (&tios, B9600);
 
     if (tcsetattr(fd, TCSAFLUSH, &tios) < 0) {
-        fprintf(stderr,"Could not set attributes: ,%s",sys_errlist[errno]);
+        fprintf(stderr, "Could not set attributes: ,%s", strerror(errno));
         exit(1);
     }
     return fd;
@@ -520,7 +520,7 @@ void processCmdLine(int argc, char **argv)
                 FileSizeMax = (float)atoi(argv[++cnt]);
                 if(FileSizeMax > (MAX_INTS_ALLOW*sizeof(int)))
                 {
-                    printf("Max file size allowd is %i.\n",
+                    printf("Max file size allowed is %lu.\n",
                            MAX_INTS_ALLOW*sizeof(int));
                     exit(0);
                 }
diff --git a/tests/checkfs/comm.c b/tests/checkfs/comm.c
index 57fc7ed..f8c43fd 100644
--- a/tests/checkfs/comm.c
+++ b/tests/checkfs/comm.c
@@ -28,7 +28,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
-
+#include <string.h>
 
 
 /*
diff --git a/tests/fs-tests/lib/tests.c b/tests/fs-tests/lib/tests.c
index 00b94f9..8a6a5f5 100644
--- a/tests/fs-tests/lib/tests.c
+++ b/tests/fs-tests/lib/tests.c
@@ -1236,7 +1236,8 @@ void tests_try_to_clear_dir(const char *dir_name)
 			break;
 		}
 	}
-	chdir(buf);
+	if (chdir(buf) < 0)
+		perror("chdir");
 	closedir(dir);
 }
 
diff --git a/tests/fs-tests/stress/atoms/pdfrun.c b/tests/fs-tests/stress/atoms/pdfrun.c
index 3536580..46c70e1 100644
--- a/tests/fs-tests/stress/atoms/pdfrun.c
+++ b/tests/fs-tests/stress/atoms/pdfrun.c
@@ -40,8 +40,11 @@ void adjust_size(void)
 
 	total_memory = 0;
 	f = fopen("/proc/meminfo", "r");
-	fscanf(f, "%s %lu", dummy, &total_memory);
+	if (fscanf(f, "%s %lu", dummy, &total_memory) != 2)
+		perror("fscanf error");
 	fclose(f);
+
+
 	if (total_memory > 0 && tests_size_parameter > total_memory / 2)
 		tests_size_parameter = total_memory / 2;
 }
diff --git a/tests/jittertest/JitterTest.c b/tests/jittertest/JitterTest.c
index fcf8e0d..19392d5 100644
--- a/tests/jittertest/JitterTest.c
+++ b/tests/jittertest/JitterTest.c
@@ -82,6 +82,7 @@
 #include <string.h>     /* strcpy, strcmp */
 #include <stdlib.h>     /* exit, atol, atoi */
 #include <sys/time.h>   /* setitimer, settimeofday, gettimeofday */
+#include <time.h>	/* time */
 #include <signal.h>     /* signal */
 #include <sched.h>      /* sched_setscheduler, sched_get_priority_min,*/
 /*   sched_get_priority_max */
@@ -475,7 +476,9 @@ void doGrabKProfile(int jitterusec, char *fileName)
 
     while((readBytes = read(fdProfile, readBuf, sizeof(readBuf))) > 0)
     {
-        write(fdSnapshot, readBuf, readBytes);
+	int writeBytes = write(fdSnapshot, readBuf, readBytes);
+	if (writeBytes < 0)
+		perror("write error");
     }
 
     close(fdSnapshot);
@@ -650,7 +653,9 @@ void AlarmHandler(
         if(DoRead)
         {
 
-            read(Fd2, tmpBuf, 1);
+            cntr = read(Fd2, tmpBuf, 1);
+	    if (cntr < 0)
+		perror("read error");
             lseek(Fd2, 0, SEEK_SET); /* back to start */
         }
 
@@ -1032,7 +1037,7 @@ int Write(int fd, void *buf, size_t bytes, int lineNo)
     if(err < bytes)
     {
 
-        printf("Write Error at line %i! Wanted to write %i bytes, but wrote only %i bytes.\n",
+        printf("Write Error at line %i! Wanted to write %zu bytes, but wrote only %i bytes.\n",
                lineNo, bytes, err);
         perror("Write did not complete. Error. Bye:"); /* show error from errno. */
 	exit(1);
diff --git a/tests/ubi-tests/integ.c b/tests/ubi-tests/integ.c
index f293444..4e13b73 100644
--- a/tests/ubi-tests/integ.c
+++ b/tests/ubi-tests/integ.c
@@ -14,6 +14,7 @@
 #include <sys/stat.h>
 
 #include "libubi.h"
+#include "common.h"
 
 struct erase_block_info;
 struct volume_info;
@@ -586,7 +587,7 @@ static void reload_ubi(void)
 	sleep(1);
 }
 
-static void check_volume(struct volume_info *vol)
+static void integ_check_volume(struct volume_info *vol)
 {
 	struct erase_block_info *eb = vol->erase_blocks;
 	int pos;
@@ -607,7 +608,7 @@ static void check_ubi_device(struct ubi_device_info *ubi_device)
 
 	vol = ubi_device->volumes;
 	while (vol) {
-		check_volume(vol);
+		integ_check_volume(vol);
 		vol = vol->next;
 	}
 }
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [PATCHv1 2/3] tests: build tests by default
  2011-04-05 11:33 ` [PATCHv1 2/3] tests: build tests by default Andy Shevchenko
  2011-04-05 11:33   ` [PATCHv1 3/3] tests: fix compiler warnings Andy Shevchenko
@ 2011-04-05 12:44   ` Josh Boyer
  2011-04-05 12:45     ` Artem Bityutskiy
                       ` (2 more replies)
  1 sibling, 3 replies; 29+ messages in thread
From: Josh Boyer @ 2011-04-05 12:44 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Artem Bityutskiy, linux-mtd

On Tue, Apr 5, 2011 at 7:33 AM, Andy Shevchenko
<ext-andriy.shevchenko@nokia.com> wrote
>
> -install:: ${TARGETS} ${SCRIPTS}
> +install:: ${TARGETS} ${SCRIPTS} tests
>        mkdir -p ${DESTDIR}/${SBINDIR}
>        install -m 0755 ${TARGETS} ${SCRIPTS} ${DESTDIR}/${SBINDIR}/
>        mkdir -p ${DESTDIR}/${MANDIR}/man1
> diff --git a/tests/Makefile b/tests/Makefile
> new file mode 100644
> index 0000000..05b37e9
> --- /dev/null
> +++ b/tests/Makefile
> @@ -0,0 +1,8 @@
> +
> +SUBDIRS = checkfs fs-tests jittertest ubi-tests
> +
> +all clean tests: $(SUBDIRS)
> +
> +.PHONY: $(SUBDIRS)
> +$(SUBDIRS):
> +       $(MAKE) -C $@ $(MAKECMDGOALS)

We don't want the tests installed by default, do we?  If we do for
some reason, it might be better to stick them in
/usr/libexec/mtd-utils/ or /usr/share/mtd-utils/ or something.  I
doubt we need them sitting in /usr/sbin,/sbin,/bin,/usr/bin on 99% of
the installs.

josh

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCHv1 2/3] tests: build tests by default
  2011-04-05 12:44   ` [PATCHv1 2/3] tests: build tests by default Josh Boyer
@ 2011-04-05 12:45     ` Artem Bityutskiy
  2011-04-05 12:57     ` Florian Fainelli
  2011-04-05 15:03     ` [PATCHv2] tests: introduce new target tests in Makefile Andy Shevchenko
  2 siblings, 0 replies; 29+ messages in thread
From: Artem Bityutskiy @ 2011-04-05 12:45 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linux-mtd, Andy Shevchenko

On Tue, 2011-04-05 at 08:44 -0400, Josh Boyer wrote:
> On Tue, Apr 5, 2011 at 7:33 AM, Andy Shevchenko
> <ext-andriy.shevchenko@nokia.com> wrote
> >
> > -install:: ${TARGETS} ${SCRIPTS}
> > +install:: ${TARGETS} ${SCRIPTS} tests
> >        mkdir -p ${DESTDIR}/${SBINDIR}
> >        install -m 0755 ${TARGETS} ${SCRIPTS} ${DESTDIR}/${SBINDIR}/
> >        mkdir -p ${DESTDIR}/${MANDIR}/man1
> > diff --git a/tests/Makefile b/tests/Makefile
> > new file mode 100644
> > index 0000000..05b37e9
> > --- /dev/null
> > +++ b/tests/Makefile
> > @@ -0,0 +1,8 @@
> > +
> > +SUBDIRS = checkfs fs-tests jittertest ubi-tests
> > +
> > +all clean tests: $(SUBDIRS)
> > +
> > +.PHONY: $(SUBDIRS)
> > +$(SUBDIRS):
> > +       $(MAKE) -C $@ $(MAKECMDGOALS)
> 
> We don't want the tests installed by default, do we?  If we do for
> some reason, it might be better to stick them in
> /usr/libexec/mtd-utils/ or /usr/share/mtd-utils/ or something.  I
> doubt we need them sitting in /usr/sbin,/sbin,/bin,/usr/bin on 99% of
> the installs.

I agree that installing tests should be a separate option.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCHv1 1/3] tests: make jittertest buildable
  2011-04-05 11:33 [PATCHv1 1/3] tests: make jittertest buildable Andy Shevchenko
  2011-04-05 11:33 ` [PATCHv1 2/3] tests: build tests by default Andy Shevchenko
@ 2011-04-05 12:51 ` Artem Bityutskiy
  1 sibling, 0 replies; 29+ messages in thread
From: Artem Bityutskiy @ 2011-04-05 12:51 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-mtd

On Tue, 2011-04-05 at 14:33 +0300, Andy Shevchenko wrote:
> Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
> ---
>  tests/jittertest/JitterTest.c |    6 +++---
>  tests/jittertest/Makefile     |    2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)

Pushed this one, thanks.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCHv1 3/3] tests: fix compiler warnings
  2011-04-05 11:33   ` [PATCHv1 3/3] tests: fix compiler warnings Andy Shevchenko
@ 2011-04-05 12:52     ` Artem Bityutskiy
  2011-04-05 13:08       ` Andy Shevchenko
  2011-04-05 13:55       ` [PATCHv1 1/5] tests: checkfs: " Andy Shevchenko
  0 siblings, 2 replies; 29+ messages in thread
From: Artem Bityutskiy @ 2011-04-05 12:52 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-mtd

On Tue, 2011-04-05 at 14:33 +0300, Andy Shevchenko wrote:
> Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
> ---
>  tests/checkfs/checkfs.c              |    8 ++++----
>  tests/checkfs/comm.c                 |    2 +-
>  tests/fs-tests/lib/tests.c           |    3 ++-
>  tests/fs-tests/stress/atoms/pdfrun.c |    5 ++++-
>  tests/jittertest/JitterTest.c        |   11 ++++++++---
>  tests/ubi-tests/integ.c              |    5 +++--
>  6 files changed, 22 insertions(+), 12 deletions(-)

Would it please be possible to split this patch on a series of per-test
patches and may be write which warnings are fixed. For some of the
changes it is difficult to figure out what is being fixed.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCHv1 2/3] tests: build tests by default
  2011-04-05 12:44   ` [PATCHv1 2/3] tests: build tests by default Josh Boyer
  2011-04-05 12:45     ` Artem Bityutskiy
@ 2011-04-05 12:57     ` Florian Fainelli
  2011-04-05 15:03     ` [PATCHv2] tests: introduce new target tests in Makefile Andy Shevchenko
  2 siblings, 0 replies; 29+ messages in thread
From: Florian Fainelli @ 2011-04-05 12:57 UTC (permalink / raw)
  To: linux-mtd; +Cc: Artem Bityutskiy, Josh Boyer, Andy Shevchenko

On Tuesday 05 April 2011 14:44:24 Josh Boyer wrote:
> On Tue, Apr 5, 2011 at 7:33 AM, Andy Shevchenko
> <ext-andriy.shevchenko@nokia.com> wrote
> 
> > -install:: ${TARGETS} ${SCRIPTS}
> > +install:: ${TARGETS} ${SCRIPTS} tests
> >        mkdir -p ${DESTDIR}/${SBINDIR}
> >        install -m 0755 ${TARGETS} ${SCRIPTS} ${DESTDIR}/${SBINDIR}/
> >        mkdir -p ${DESTDIR}/${MANDIR}/man1
> > diff --git a/tests/Makefile b/tests/Makefile
> > new file mode 100644
> > index 0000000..05b37e9
> > --- /dev/null
> > +++ b/tests/Makefile
> > @@ -0,0 +1,8 @@
> > +
> > +SUBDIRS = checkfs fs-tests jittertest ubi-tests
> > +
> > +all clean tests: $(SUBDIRS)
> > +
> > +.PHONY: $(SUBDIRS)
> > +$(SUBDIRS):
> > +       $(MAKE) -C $@ $(MAKECMDGOALS)
> 
> We don't want the tests installed by default, do we?  If we do for
> some reason, it might be better to stick them in
> /usr/libexec/mtd-utils/ or /usr/share/mtd-utils/ or something.  I
> doubt we need them sitting in /usr/sbin,/sbin,/bin,/usr/bin on 99% of
> the installs.

Most embedded distributions would prefer tests to be disabled by default.

If this is absolutely required, they should still be built as a separate Make 
target.
--
Florian

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCHv1 3/3] tests: fix compiler warnings
  2011-04-05 12:52     ` Artem Bityutskiy
@ 2011-04-05 13:08       ` Andy Shevchenko
  2011-04-05 13:55       ` [PATCHv1 1/5] tests: checkfs: " Andy Shevchenko
  1 sibling, 0 replies; 29+ messages in thread
From: Andy Shevchenko @ 2011-04-05 13:08 UTC (permalink / raw)
  To: Artem.Bityutskiy; +Cc: linux-mtd

On Tue, 2011-04-05 at 15:52 +0300, Artem Bityutskiy wrote:
> On Tue, 2011-04-05 at 14:33 +0300, Andy Shevchenko wrote:
> > Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
> > ---
> >  tests/checkfs/checkfs.c              |    8 ++++----
> >  tests/checkfs/comm.c                 |    2 +-
> >  tests/fs-tests/lib/tests.c           |    3 ++-
> >  tests/fs-tests/stress/atoms/pdfrun.c |    5 ++++-
> >  tests/jittertest/JitterTest.c        |   11 ++++++++---
> >  tests/ubi-tests/integ.c              |    5 +++--
> >  6 files changed, 22 insertions(+), 12 deletions(-)
> 
> Would it please be possible to split this patch on a series of per-test
> patches and may be write which warnings are fixed. For some of the
> changes it is difficult to figure out what is being fixed.
Makes sense. Will do.


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCHv1 1/5] tests: checkfs: fix compiler warnings
  2011-04-05 12:52     ` Artem Bityutskiy
  2011-04-05 13:08       ` Andy Shevchenko
@ 2011-04-05 13:55       ` Andy Shevchenko
  2011-04-05 13:55         ` [PATCHv1 2/5] tests: checkfs: fix linker warnings Andy Shevchenko
  2011-04-05 14:08         ` [PATCHv1 1/5] tests: checkfs: fix compiler warnings Artem Bityutskiy
  1 sibling, 2 replies; 29+ messages in thread
From: Andy Shevchenko @ 2011-04-05 13:55 UTC (permalink / raw)
  To: Artem Bityutskiy, linux-mtd; +Cc: Andy Shevchenko

There are two warnings:
 - strlen() is used without prototype
 - argument of printf() is unsigned long, but used specifier is for int

This patch fixes them.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 tests/checkfs/checkfs.c |    2 +-
 tests/checkfs/comm.c    |    5 +----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/tests/checkfs/checkfs.c b/tests/checkfs/checkfs.c
index da2d0c4..6ca2c0e 100644
--- a/tests/checkfs/checkfs.c
+++ b/tests/checkfs/checkfs.c
@@ -520,7 +520,7 @@ void processCmdLine(int argc, char **argv)
                 FileSizeMax = (float)atoi(argv[++cnt]);
                 if(FileSizeMax > (MAX_INTS_ALLOW*sizeof(int)))
                 {
-                    printf("Max file size allowd is %i.\n",
+                    printf("Max file size allowed is %lu.\n",
                            MAX_INTS_ALLOW*sizeof(int));
                     exit(0);
                 }
diff --git a/tests/checkfs/comm.c b/tests/checkfs/comm.c
index 57fc7ed..881a270 100644
--- a/tests/checkfs/comm.c
+++ b/tests/checkfs/comm.c
@@ -21,15 +21,12 @@
   Split the modbus comm part of the program (that sends the ok to pwr me down
   message) into another file "comm.c"
 
-
-
  */
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
-
-
+#include <string.h>
 
 /*
   This is the routine that forms and
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCHv1 2/5] tests: checkfs: fix linker warnings
  2011-04-05 13:55       ` [PATCHv1 1/5] tests: checkfs: " Andy Shevchenko
@ 2011-04-05 13:55         ` Andy Shevchenko
  2011-04-05 13:55           ` [PATCHv1 3/5] tests: fs-tests: check return value of functions Andy Shevchenko
  2011-04-05 14:15           ` [PATCHv1 2/5] tests: checkfs: fix linker warnings Artem Bityutskiy
  2011-04-05 14:08         ` [PATCHv1 1/5] tests: checkfs: fix compiler warnings Artem Bityutskiy
  1 sibling, 2 replies; 29+ messages in thread
From: Andy Shevchenko @ 2011-04-05 13:55 UTC (permalink / raw)
  To: Artem Bityutskiy, linux-mtd; +Cc: Andy Shevchenko

The sys_errlist[errno] is deprecated. We should use strerror(errno) instead.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 tests/checkfs/checkfs.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/checkfs/checkfs.c b/tests/checkfs/checkfs.c
index 6ca2c0e..3224d2b 100644
--- a/tests/checkfs/checkfs.c
+++ b/tests/checkfs/checkfs.c
@@ -167,11 +167,11 @@ int setupSerial (const char *dev) {
 
     fd = open(dev,O_RDWR | O_NDELAY );
     if (fd < 0) {
-        fprintf(stderr, "%s: %s\n", dev, sys_errlist[errno]);
+        fprintf(stderr, "%s: %s\n", dev, strerror(errno));
         exit(1);
     }
     if (tcgetattr(fd, &tios) < 0) {
-        fprintf(stderr,"Could not get terminal attributes: %s",sys_errlist[errno]);
+        fprintf(stderr, "Could not get terminal attributes: %s", strerror(errno));
         exit(1);
     }
 
@@ -197,7 +197,7 @@ int setupSerial (const char *dev) {
     cfsetispeed (&tios, B9600);
 
     if (tcsetattr(fd, TCSAFLUSH, &tios) < 0) {
-        fprintf(stderr,"Could not set attributes: ,%s",sys_errlist[errno]);
+        fprintf(stderr, "Could not set attributes: ,%s", strerror(errno));
         exit(1);
     }
     return fd;
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCHv1 3/5] tests: fs-tests: check return value of functions
  2011-04-05 13:55         ` [PATCHv1 2/5] tests: checkfs: fix linker warnings Andy Shevchenko
@ 2011-04-05 13:55           ` Andy Shevchenko
  2011-04-05 13:55             ` [PATCHv1 4/5] tests: jittertest: fix set of compiler warnings Andy Shevchenko
  2011-04-05 14:17             ` [PATCHv1 3/5] tests: fs-tests: check return value of functions Artem Bityutskiy
  2011-04-05 14:15           ` [PATCHv1 2/5] tests: checkfs: fix linker warnings Artem Bityutskiy
  1 sibling, 2 replies; 29+ messages in thread
From: Andy Shevchenko @ 2011-04-05 13:55 UTC (permalink / raw)
  To: Artem Bityutskiy, linux-mtd; +Cc: Andy Shevchenko

chdir() returns negative value in case of error.
fscanf() returns amount of successfully parsed parameters.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 tests/fs-tests/lib/tests.c           |    3 ++-
 tests/fs-tests/stress/atoms/pdfrun.c |    5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/fs-tests/lib/tests.c b/tests/fs-tests/lib/tests.c
index 00b94f9..8a6a5f5 100644
--- a/tests/fs-tests/lib/tests.c
+++ b/tests/fs-tests/lib/tests.c
@@ -1236,7 +1236,8 @@ void tests_try_to_clear_dir(const char *dir_name)
 			break;
 		}
 	}
-	chdir(buf);
+	if (chdir(buf) < 0)
+		perror("chdir");
 	closedir(dir);
 }
 
diff --git a/tests/fs-tests/stress/atoms/pdfrun.c b/tests/fs-tests/stress/atoms/pdfrun.c
index 3536580..46c70e1 100644
--- a/tests/fs-tests/stress/atoms/pdfrun.c
+++ b/tests/fs-tests/stress/atoms/pdfrun.c
@@ -40,8 +40,11 @@ void adjust_size(void)
 
 	total_memory = 0;
 	f = fopen("/proc/meminfo", "r");
-	fscanf(f, "%s %lu", dummy, &total_memory);
+	if (fscanf(f, "%s %lu", dummy, &total_memory) != 2)
+		perror("fscanf error");
 	fclose(f);
+
+
 	if (total_memory > 0 && tests_size_parameter > total_memory / 2)
 		tests_size_parameter = total_memory / 2;
 }
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCHv1 4/5] tests: jittertest: fix set of compiler warnings
  2011-04-05 13:55           ` [PATCHv1 3/5] tests: fs-tests: check return value of functions Andy Shevchenko
@ 2011-04-05 13:55             ` Andy Shevchenko
  2011-04-05 13:55               ` [PATCHv1 5/5] tests: ubi-tests: seed_random_generator() was used w/o prototype Andy Shevchenko
  2011-04-05 14:20               ` [PATCHv1 4/5] tests: jittertest: fix set of compiler warnings Artem Bityutskiy
  2011-04-05 14:17             ` [PATCHv1 3/5] tests: fs-tests: check return value of functions Artem Bityutskiy
  1 sibling, 2 replies; 29+ messages in thread
From: Andy Shevchenko @ 2011-04-05 13:55 UTC (permalink / raw)
  To: Artem Bityutskiy, linux-mtd; +Cc: Andy Shevchenko

- time() was used without prototype.
- the return value of read() and write() wasn't checked
- classificator in printf() was wrong for argument of size_t type

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 tests/jittertest/JitterTest.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/tests/jittertest/JitterTest.c b/tests/jittertest/JitterTest.c
index fcf8e0d..11dc8f5 100644
--- a/tests/jittertest/JitterTest.c
+++ b/tests/jittertest/JitterTest.c
@@ -82,6 +82,7 @@
 #include <string.h>     /* strcpy, strcmp */
 #include <stdlib.h>     /* exit, atol, atoi */
 #include <sys/time.h>   /* setitimer, settimeofday, gettimeofday */
+#include <time.h>	/* time */
 #include <signal.h>     /* signal */
 #include <sched.h>      /* sched_setscheduler, sched_get_priority_min,*/
 /*   sched_get_priority_max */
@@ -475,7 +476,9 @@ void doGrabKProfile(int jitterusec, char *fileName)
 
     while((readBytes = read(fdProfile, readBuf, sizeof(readBuf))) > 0)
     {
-        write(fdSnapshot, readBuf, readBytes);
+	int writeBytes = write(fdSnapshot, readBuf, readBytes);
+	if (writeBytes < 0)
+		perror("write error");
     }
 
     close(fdSnapshot);
@@ -650,7 +653,9 @@ void AlarmHandler(
         if(DoRead)
         {
 
-            read(Fd2, tmpBuf, 1);
+	    cntr = read(Fd2, tmpBuf, 1);
+	    if (cntr < 0)
+		perror("read error");
             lseek(Fd2, 0, SEEK_SET); /* back to start */
         }
 
@@ -1032,7 +1037,7 @@ int Write(int fd, void *buf, size_t bytes, int lineNo)
     if(err < bytes)
     {
 
-        printf("Write Error at line %i! Wanted to write %i bytes, but wrote only %i bytes.\n",
+        printf("Write Error at line %i! Wanted to write %zu bytes, but wrote only %i bytes.\n",
                lineNo, bytes, err);
         perror("Write did not complete. Error. Bye:"); /* show error from errno. */
 	exit(1);
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCHv1 5/5] tests: ubi-tests: seed_random_generator() was used w/o prototype
  2011-04-05 13:55             ` [PATCHv1 4/5] tests: jittertest: fix set of compiler warnings Andy Shevchenko
@ 2011-04-05 13:55               ` Andy Shevchenko
  2011-04-05 14:22                 ` Artem Bityutskiy
  2011-04-05 14:20               ` [PATCHv1 4/5] tests: jittertest: fix set of compiler warnings Artem Bityutskiy
  1 sibling, 1 reply; 29+ messages in thread
From: Andy Shevchenko @ 2011-04-05 13:55 UTC (permalink / raw)
  To: Artem Bityutskiy, linux-mtd; +Cc: Andy Shevchenko

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 tests/ubi-tests/integ.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/ubi-tests/integ.c b/tests/ubi-tests/integ.c
index f293444..4e13b73 100644
--- a/tests/ubi-tests/integ.c
+++ b/tests/ubi-tests/integ.c
@@ -14,6 +14,7 @@
 #include <sys/stat.h>
 
 #include "libubi.h"
+#include "common.h"
 
 struct erase_block_info;
 struct volume_info;
@@ -586,7 +587,7 @@ static void reload_ubi(void)
 	sleep(1);
 }
 
-static void check_volume(struct volume_info *vol)
+static void integ_check_volume(struct volume_info *vol)
 {
 	struct erase_block_info *eb = vol->erase_blocks;
 	int pos;
@@ -607,7 +608,7 @@ static void check_ubi_device(struct ubi_device_info *ubi_device)
 
 	vol = ubi_device->volumes;
 	while (vol) {
-		check_volume(vol);
+		integ_check_volume(vol);
 		vol = vol->next;
 	}
 }
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [PATCHv1 1/5] tests: checkfs: fix compiler warnings
  2011-04-05 13:55       ` [PATCHv1 1/5] tests: checkfs: " Andy Shevchenko
  2011-04-05 13:55         ` [PATCHv1 2/5] tests: checkfs: fix linker warnings Andy Shevchenko
@ 2011-04-05 14:08         ` Artem Bityutskiy
  1 sibling, 0 replies; 29+ messages in thread
From: Artem Bityutskiy @ 2011-04-05 14:08 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-mtd

On Tue, 2011-04-05 at 16:55 +0300, Andy Shevchenko wrote:
> There are two warnings:
>  - strlen() is used without prototype
>  - argument of printf() is unsigned long, but used specifier is for int
> 
> This patch fixes them.
> 
> Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>

Pushed to mtd-utils.git, thanks.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCHv1 2/5] tests: checkfs: fix linker warnings
  2011-04-05 13:55         ` [PATCHv1 2/5] tests: checkfs: fix linker warnings Andy Shevchenko
  2011-04-05 13:55           ` [PATCHv1 3/5] tests: fs-tests: check return value of functions Andy Shevchenko
@ 2011-04-05 14:15           ` Artem Bityutskiy
  1 sibling, 0 replies; 29+ messages in thread
From: Artem Bityutskiy @ 2011-04-05 14:15 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-mtd

On Tue, 2011-04-05 at 16:55 +0300, Andy Shevchenko wrote:
> The sys_errlist[errno] is deprecated. We should use strerror(errno) instead.
> 
> Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
> ---
>  tests/checkfs/checkfs.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)

Pushed this one, thanks!

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCHv1 3/5] tests: fs-tests: check return value of functions
  2011-04-05 13:55           ` [PATCHv1 3/5] tests: fs-tests: check return value of functions Andy Shevchenko
  2011-04-05 13:55             ` [PATCHv1 4/5] tests: jittertest: fix set of compiler warnings Andy Shevchenko
@ 2011-04-05 14:17             ` Artem Bityutskiy
  1 sibling, 0 replies; 29+ messages in thread
From: Artem Bityutskiy @ 2011-04-05 14:17 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-mtd

On Tue, 2011-04-05 at 16:55 +0300, Andy Shevchenko wrote:
> chdir() returns negative value in case of error.
> fscanf() returns amount of successfully parsed parameters.
> 
> Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
> ---
>  tests/fs-tests/lib/tests.c           |    3 ++-
>  tests/fs-tests/stress/atoms/pdfrun.c |    5 ++++-
>  2 files changed, 6 insertions(+), 2 deletions(-)

Pushed this one, thanks.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCHv1 4/5] tests: jittertest: fix set of compiler warnings
  2011-04-05 13:55             ` [PATCHv1 4/5] tests: jittertest: fix set of compiler warnings Andy Shevchenko
  2011-04-05 13:55               ` [PATCHv1 5/5] tests: ubi-tests: seed_random_generator() was used w/o prototype Andy Shevchenko
@ 2011-04-05 14:20               ` Artem Bityutskiy
  2011-04-05 14:32                 ` [PATCHv2] " Andy Shevchenko
  1 sibling, 1 reply; 29+ messages in thread
From: Artem Bityutskiy @ 2011-04-05 14:20 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-mtd

On Tue, 2011-04-05 at 16:55 +0300, Andy Shevchenko wrote:
> -        write(fdSnapshot, readBuf, readBytes);
> +       int writeBytes = write(fdSnapshot, readBuf, readBytes);
> +       if (writeBytes < 0)
> +               perror("write error"); 

Then you should better check for (writeBytes != readBytes). Similar to
the read case you fix in this patch.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCHv1 5/5] tests: ubi-tests: seed_random_generator() was used w/o prototype
  2011-04-05 13:55               ` [PATCHv1 5/5] tests: ubi-tests: seed_random_generator() was used w/o prototype Andy Shevchenko
@ 2011-04-05 14:22                 ` Artem Bityutskiy
  0 siblings, 0 replies; 29+ messages in thread
From: Artem Bityutskiy @ 2011-04-05 14:22 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-mtd

On Tue, 2011-04-05 at 16:55 +0300, Andy Shevchenko wrote:
> Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
> ---
>  tests/ubi-tests/integ.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)

Pushed this one, thanks!

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCHv2] tests: jittertest: fix set of compiler warnings
  2011-04-05 14:20               ` [PATCHv1 4/5] tests: jittertest: fix set of compiler warnings Artem Bityutskiy
@ 2011-04-05 14:32                 ` Andy Shevchenko
  2011-04-05 14:39                   ` Artem Bityutskiy
  0 siblings, 1 reply; 29+ messages in thread
From: Andy Shevchenko @ 2011-04-05 14:32 UTC (permalink / raw)
  To: Artem Bityutskiy, linux-mtd; +Cc: Andy Shevchenko

- time() was used without prototype.
- the return value of read() and write() wasn't checked
- classificator in printf() was wrong for argument of size_t type

Don't continue to read the /proc/profile in case when write was failed.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 tests/jittertest/JitterTest.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/tests/jittertest/JitterTest.c b/tests/jittertest/JitterTest.c
index fcf8e0d..76371e8 100644
--- a/tests/jittertest/JitterTest.c
+++ b/tests/jittertest/JitterTest.c
@@ -82,6 +82,7 @@
 #include <string.h>     /* strcpy, strcmp */
 #include <stdlib.h>     /* exit, atol, atoi */
 #include <sys/time.h>   /* setitimer, settimeofday, gettimeofday */
+#include <time.h>	/* time */
 #include <signal.h>     /* signal */
 #include <sched.h>      /* sched_setscheduler, sched_get_priority_min,*/
 /*   sched_get_priority_max */
@@ -475,7 +476,11 @@ void doGrabKProfile(int jitterusec, char *fileName)
 
     while((readBytes = read(fdProfile, readBuf, sizeof(readBuf))) > 0)
     {
-        write(fdSnapshot, readBuf, readBytes);
+	int writeBytes = write(fdSnapshot, readBuf, readBytes);
+	if (writeBytes != readBytes) {
+		perror("write error");
+		break;
+	}
     }
 
     close(fdSnapshot);
@@ -650,7 +655,9 @@ void AlarmHandler(
         if(DoRead)
         {
 
-            read(Fd2, tmpBuf, 1);
+	    cntr = read(Fd2, tmpBuf, 1);
+	    if (cntr < 0)
+		perror("read error");
             lseek(Fd2, 0, SEEK_SET); /* back to start */
         }
 
@@ -1032,7 +1039,7 @@ int Write(int fd, void *buf, size_t bytes, int lineNo)
     if(err < bytes)
     {
 
-        printf("Write Error at line %i! Wanted to write %i bytes, but wrote only %i bytes.\n",
+        printf("Write Error at line %i! Wanted to write %zu bytes, but wrote only %i bytes.\n",
                lineNo, bytes, err);
         perror("Write did not complete. Error. Bye:"); /* show error from errno. */
 	exit(1);
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [PATCHv2] tests: jittertest: fix set of compiler warnings
  2011-04-05 14:32                 ` [PATCHv2] " Andy Shevchenko
@ 2011-04-05 14:39                   ` Artem Bityutskiy
  0 siblings, 0 replies; 29+ messages in thread
From: Artem Bityutskiy @ 2011-04-05 14:39 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-mtd

On Tue, 2011-04-05 at 17:32 +0300, Andy Shevchenko wrote:
> -            read(Fd2, tmpBuf, 1);
> +	    cntr = read(Fd2, tmpBuf, 1);
> +	    if (cntr < 0)
> +		perror("read error");

I've pushed this but only then noticed that you should have checked
(cntr != 1) instead. But this is not a big deal anyway.
-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCHv2] tests: introduce new target tests in Makefile
  2011-04-05 12:44   ` [PATCHv1 2/3] tests: build tests by default Josh Boyer
  2011-04-05 12:45     ` Artem Bityutskiy
  2011-04-05 12:57     ` Florian Fainelli
@ 2011-04-05 15:03     ` Andy Shevchenko
  2011-04-06  8:53       ` Artem Bityutskiy
  2011-04-07 10:44       ` Artem Bityutskiy
  2 siblings, 2 replies; 29+ messages in thread
From: Andy Shevchenko @ 2011-04-05 15:03 UTC (permalink / raw)
  To: linux-mtd, Artem Bityutskiy, Florian Fainelli; +Cc: Andy Shevchenko

This patch appends Makefile to the tests subdirectory and introduces tests
target in the root Makefile.

Additionally the clean target removes temporary stuff under tests subdirectory
as well.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 Makefile       |    7 ++++++-
 tests/Makefile |    8 ++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)
 create mode 100644 tests/Makefile

diff --git a/Makefile b/Makefile
index 7ab9743..b4d4170 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,7 @@ ifeq ($(WITHOUT_XATTR), 1)
 endif
 
 SUBDIRS = lib ubi-utils mkfs.ubifs
+TESTS = tests
 
 TARGETS = ftl_format flash_erase nanddump doc_loadbios \
 	ftl_check mkfs.jffs2 flash_lock flash_unlock flash_info \
@@ -38,6 +39,7 @@ ifneq ($(BUILDDIR),$(CURDIR))
 endif
 endif
 endif
+	$(MAKE) -C $(TESTS) clean
 
 $(SYMLINKS):
 	ln -sf ../fs/jffs2/$@ $@
@@ -52,10 +54,13 @@ $(BUILDDIR)/jffs2reader: $(BUILDDIR)/jffs2reader.o
 LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
 LDLIBS_jffs2reader  = -lz -llzo2
 
-$(BUILDDIR)/lib/libmtd.a: subdirs_lib_all ;
+$(BUILDDIR)/lib/libmtd.a: subdirs_lib_all
 
 install:: ${TARGETS} ${SCRIPTS}
 	mkdir -p ${DESTDIR}/${SBINDIR}
 	install -m 0755 ${TARGETS} ${SCRIPTS} ${DESTDIR}/${SBINDIR}/
 	mkdir -p ${DESTDIR}/${MANDIR}/man1
 	gzip -9c mkfs.jffs2.1 > ${DESTDIR}/${MANDIR}/man1/mkfs.jffs2.1.gz
+
+tests::
+	$(MAKE) -C $(TESTS)
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 0000000..05b37e9
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,8 @@
+
+SUBDIRS = checkfs fs-tests jittertest ubi-tests
+
+all clean tests: $(SUBDIRS)
+
+.PHONY: $(SUBDIRS)
+$(SUBDIRS):
+	$(MAKE) -C $@ $(MAKECMDGOALS)
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [PATCHv2] tests: introduce new target tests in Makefile
  2011-04-05 15:03     ` [PATCHv2] tests: introduce new target tests in Makefile Andy Shevchenko
@ 2011-04-06  8:53       ` Artem Bityutskiy
  2011-04-06  9:04         ` Florian Fainelli
  2011-04-07 10:44       ` Artem Bityutskiy
  1 sibling, 1 reply; 29+ messages in thread
From: Artem Bityutskiy @ 2011-04-06  8:53 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-mtd, Florian Fainelli

On Tue, 2011-04-05 at 18:03 +0300, Andy Shevchenko wrote:
> This patch appends Makefile to the tests subdirectory and introduces tests
> target in the root Makefile.
> 
> Additionally the clean target removes temporary stuff under tests subdirectory
> as well.
> 
> Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>

Looks good for me, I'll wait a bit and if no one objects, will push it.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCHv2] tests: introduce new target tests in Makefile
  2011-04-06  8:53       ` Artem Bityutskiy
@ 2011-04-06  9:04         ` Florian Fainelli
  0 siblings, 0 replies; 29+ messages in thread
From: Florian Fainelli @ 2011-04-06  9:04 UTC (permalink / raw)
  To: linux-mtd, Artem.Bityutskiy; +Cc: Andy Shevchenko

Hello,

On Wednesday 06 April 2011 10:53:17 Artem Bityutskiy wrote:
> On Tue, 2011-04-05 at 18:03 +0300, Andy Shevchenko wrote:
> > This patch appends Makefile to the tests subdirectory and introduces
> > tests target in the root Makefile.
> > 
> > Additionally the clean target removes temporary stuff under tests
> > subdirectory as well.
> > 
> > Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
> 
> Looks good for me, I'll wait a bit and if no one objects, will push it.

Looks good for me as well, thank you!
--
Florian

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCHv2] tests: introduce new target tests in Makefile
  2011-04-05 15:03     ` [PATCHv2] tests: introduce new target tests in Makefile Andy Shevchenko
  2011-04-06  8:53       ` Artem Bityutskiy
@ 2011-04-07 10:44       ` Artem Bityutskiy
  2011-04-07 13:10         ` Andy Shevchenko
  1 sibling, 1 reply; 29+ messages in thread
From: Artem Bityutskiy @ 2011-04-07 10:44 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-mtd, Florian Fainelli

On Tue, 2011-04-05 at 18:03 +0300, Andy Shevchenko wrote:
> This patch appends Makefile to the tests subdirectory and introduces tests
> target in the root Makefile.
> 
> Additionally the clean target removes temporary stuff under tests subdirectory
> as well.
> 
> Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
> ---
>  Makefile       |    7 ++++++-
>  tests/Makefile |    8 ++++++++
>  2 files changed, 14 insertions(+), 1 deletions(-)
>  create mode 100644 tests/Makefile

Breaks compilation for me:

[dedekind@eru mtd-utils (master)]$ make
d=lib_all; \
        t=`echo $d | sed s:.*_::` d=`echo $d | sed s:_.*::`; \
        make BUILDDIR=/home/dedekind/git/mtd-utils/$d -C $d $t
make[1]: Entering directory `/home/dedekind/git/mtd-utils/lib'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/dedekind/git/mtd-utils/lib'
ar crv /home/dedekind/git/mtd-utils/lib/libmtd.a subdirs_lib_all
ar: subdirs_lib_all: No such file or directory
make: *** [/home/dedekind/git/mtd-utils/lib/libmtd.a] Error 1


-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCHv2] tests: introduce new target tests in Makefile
  2011-04-07 13:10         ` Andy Shevchenko
@ 2011-04-07 13:10           ` Artem Bityutskiy
  2011-04-07 13:27             ` Andy Shevchenko
  0 siblings, 1 reply; 29+ messages in thread
From: Artem Bityutskiy @ 2011-04-07 13:10 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-mtd

On Thu, 2011-04-07 at 16:10 +0300, Andy Shevchenko wrote:
> +
> +tests::
> +	$(MAKE) -C $(TESTS)

two colons?


-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCHv2] tests: introduce new target tests in Makefile
  2011-04-07 10:44       ` Artem Bityutskiy
@ 2011-04-07 13:10         ` Andy Shevchenko
  2011-04-07 13:10           ` Artem Bityutskiy
  0 siblings, 1 reply; 29+ messages in thread
From: Andy Shevchenko @ 2011-04-07 13:10 UTC (permalink / raw)
  To: Artem Bityutskiy, linux-mtd; +Cc: Andy Shevchenko

This patch appends Makefile to the tests subdirectory and introduces tests
target in the root Makefile.

Additionally the clean target removes temporary stuff under tests subdirectory
as well.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 Makefile       |    5 +++++
 tests/Makefile |    8 ++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
 create mode 100644 tests/Makefile

diff --git a/Makefile b/Makefile
index 7ab9743..1f264e9 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,7 @@ ifeq ($(WITHOUT_XATTR), 1)
 endif
 
 SUBDIRS = lib ubi-utils mkfs.ubifs
+TESTS = tests
 
 TARGETS = ftl_format flash_erase nanddump doc_loadbios \
 	ftl_check mkfs.jffs2 flash_lock flash_unlock flash_info \
@@ -38,6 +39,7 @@ ifneq ($(BUILDDIR),$(CURDIR))
 endif
 endif
 endif
+	$(MAKE) -C $(TESTS) clean
 
 $(SYMLINKS):
 	ln -sf ../fs/jffs2/$@ $@
@@ -59,3 +61,6 @@ install:: ${TARGETS} ${SCRIPTS}
 	install -m 0755 ${TARGETS} ${SCRIPTS} ${DESTDIR}/${SBINDIR}/
 	mkdir -p ${DESTDIR}/${MANDIR}/man1
 	gzip -9c mkfs.jffs2.1 > ${DESTDIR}/${MANDIR}/man1/mkfs.jffs2.1.gz
+
+tests::
+	$(MAKE) -C $(TESTS)
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 0000000..05b37e9
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,8 @@
+
+SUBDIRS = checkfs fs-tests jittertest ubi-tests
+
+all clean tests: $(SUBDIRS)
+
+.PHONY: $(SUBDIRS)
+$(SUBDIRS):
+	$(MAKE) -C $@ $(MAKECMDGOALS)
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [PATCHv2] tests: introduce new target tests in Makefile
  2011-04-07 13:10           ` Artem Bityutskiy
@ 2011-04-07 13:27             ` Andy Shevchenko
  2011-04-07 13:44               ` Artem Bityutskiy
  0 siblings, 1 reply; 29+ messages in thread
From: Andy Shevchenko @ 2011-04-07 13:27 UTC (permalink / raw)
  To: Artem.Bityutskiy; +Cc: linux-mtd

On Thu, 2011-04-07 at 16:10 +0300, Artem Bityutskiy wrote:
> On Thu, 2011-04-07 at 16:10 +0300, Andy Shevchenko wrote:
> > +
> > +tests::
> > +	$(MAKE) -C $(TESTS)
> 
> two colons?
Yep, exactly.

We have tests subdirectory, and we have tests rule in tests/Makefile.
So, double colon here makes the rule a) independent, b) runs every time
when asked.


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCHv2] tests: introduce new target tests in Makefile
  2011-04-07 13:27             ` Andy Shevchenko
@ 2011-04-07 13:44               ` Artem Bityutskiy
  0 siblings, 0 replies; 29+ messages in thread
From: Artem Bityutskiy @ 2011-04-07 13:44 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-mtd

On Thu, 2011-04-07 at 16:27 +0300, Andy Shevchenko wrote:
> On Thu, 2011-04-07 at 16:10 +0300, Artem Bityutskiy wrote:
> > On Thu, 2011-04-07 at 16:10 +0300, Andy Shevchenko wrote:
> > > +
> > > +tests::
> > > +	$(MAKE) -C $(TESTS)
> > 
> > two colons?
> Yep, exactly.
> 
> We have tests subdirectory, and we have tests rule in tests/Makefile.
> So, double colon here makes the rule a) independent, b) runs every time
> when asked.

Ok, got it.

Pushed to mtd-utils.git, thanks.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2011-04-07 13:47 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-05 11:33 [PATCHv1 1/3] tests: make jittertest buildable Andy Shevchenko
2011-04-05 11:33 ` [PATCHv1 2/3] tests: build tests by default Andy Shevchenko
2011-04-05 11:33   ` [PATCHv1 3/3] tests: fix compiler warnings Andy Shevchenko
2011-04-05 12:52     ` Artem Bityutskiy
2011-04-05 13:08       ` Andy Shevchenko
2011-04-05 13:55       ` [PATCHv1 1/5] tests: checkfs: " Andy Shevchenko
2011-04-05 13:55         ` [PATCHv1 2/5] tests: checkfs: fix linker warnings Andy Shevchenko
2011-04-05 13:55           ` [PATCHv1 3/5] tests: fs-tests: check return value of functions Andy Shevchenko
2011-04-05 13:55             ` [PATCHv1 4/5] tests: jittertest: fix set of compiler warnings Andy Shevchenko
2011-04-05 13:55               ` [PATCHv1 5/5] tests: ubi-tests: seed_random_generator() was used w/o prototype Andy Shevchenko
2011-04-05 14:22                 ` Artem Bityutskiy
2011-04-05 14:20               ` [PATCHv1 4/5] tests: jittertest: fix set of compiler warnings Artem Bityutskiy
2011-04-05 14:32                 ` [PATCHv2] " Andy Shevchenko
2011-04-05 14:39                   ` Artem Bityutskiy
2011-04-05 14:17             ` [PATCHv1 3/5] tests: fs-tests: check return value of functions Artem Bityutskiy
2011-04-05 14:15           ` [PATCHv1 2/5] tests: checkfs: fix linker warnings Artem Bityutskiy
2011-04-05 14:08         ` [PATCHv1 1/5] tests: checkfs: fix compiler warnings Artem Bityutskiy
2011-04-05 12:44   ` [PATCHv1 2/3] tests: build tests by default Josh Boyer
2011-04-05 12:45     ` Artem Bityutskiy
2011-04-05 12:57     ` Florian Fainelli
2011-04-05 15:03     ` [PATCHv2] tests: introduce new target tests in Makefile Andy Shevchenko
2011-04-06  8:53       ` Artem Bityutskiy
2011-04-06  9:04         ` Florian Fainelli
2011-04-07 10:44       ` Artem Bityutskiy
2011-04-07 13:10         ` Andy Shevchenko
2011-04-07 13:10           ` Artem Bityutskiy
2011-04-07 13:27             ` Andy Shevchenko
2011-04-07 13:44               ` Artem Bityutskiy
2011-04-05 12:51 ` [PATCHv1 1/3] tests: make jittertest buildable Artem Bityutskiy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.