All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] add types for functions in fs-bench
@ 2010-04-26 21:21 Cyril Hrubis
       [not found] ` <i2t364299f41004261917vf9e34d44y3cbde0a2eada4e75@mail.gmail.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Cyril Hrubis @ 2010-04-26 21:21 UTC (permalink / raw)
  To: ltp-list

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]

Hi!
Attached patch adds types for functions in sources for fs-bench just because
when function doesn't have return type it defaults to int and this causes
problems (for example when doing return from such function without value).

Signed-off-by: Cyril Hrubis chrubis@suse.cz


Side note:

The code quality for fs-bench is very poor, there is no documentation and the
scripts are broken (mostly wrongly hardcoded paths). IMHO these tests are not
worth fixing and candidate for removal.

-- 
Cyril Hrubis
chrubis@suse.cz

[-- Attachment #2: clean_up_fs-bench.patch --]
[-- Type: text/x-patch, Size: 3162 bytes --]

Index: ltp-full-20100228/testcases/kernel/fs/fs-bench/create-files.c
===================================================================
--- ltp-full-20100228.orig/testcases/kernel/fs/fs-bench/create-files.c
+++ ltp-full-20100228/testcases/kernel/fs/fs-bench/create-files.c
@@ -19,7 +19,7 @@ static int filecount=0;
 extern int box_muler(int, int);
 
 int startc=0;
-main(int ac,char *av[])
+int main(int ac,char *av[])
 {
   int i=0;
   int j=0;
@@ -75,14 +75,17 @@ end:
 
 int showchar[]={124,47,45,92,124,47,45,92};
 static int mkdir_counter=0;
-makedir(char *dir1)
+
+void makedir(char *dir1)
 {
   if (mkdir(dir1, S_IRWXU) < 0) {
     perror(dir1);
     exit(1);
   }
 }
-changedir(char *dir) {
+
+void changedir(char *dir)
+{
   if ( chdir(dir) < 0 ) {
     perror(dir);
     exit(1);
@@ -90,7 +93,7 @@ changedir(char *dir) {
 }
 
 
-create_file(char *filename)
+void create_file(char *filename)
 {
   int fd;
   int randomsize;
Index: ltp-full-20100228/testcases/kernel/fs/fs-bench/random-access-del-create.c
===================================================================
--- ltp-full-20100228.orig/testcases/kernel/fs/fs-bench/random-access-del-create.c
+++ ltp-full-20100228/testcases/kernel/fs/fs-bench/random-access-del-create.c
@@ -24,8 +24,7 @@ int cfilecount=0;
 int dfilecount=0;
 int errorcount=0;
 
-int
-main(int ac, char **av)
+int main(int ac, char **av)
 {
   int r;
   char fname[1024];
@@ -92,7 +91,7 @@ void create_or_delete(char *fname)
   }
 }
 
-create_file(char *filename)
+int create_file(char *filename)
 {
   int fd;
   int randomsize;
@@ -117,7 +116,7 @@ create_file(char *filename)
 #include <sys/stat.h>
 #include <unistd.h>
 
-delete_file(char *filename)
+int delete_file(char *filename)
 {
   struct stat buf;
   int st;
Index: ltp-full-20100228/testcases/kernel/fs/fs-bench/random-access.c
===================================================================
--- ltp-full-20100228.orig/testcases/kernel/fs/fs-bench/random-access.c
+++ ltp-full-20100228/testcases/kernel/fs/fs-bench/random-access.c
@@ -16,7 +16,7 @@ int openlog[2]={0,0};
 #define MAXNUM 0x100000
 
 int nullfd;
-main(int ac, char **av)
+int main(int ac, char **av)
 {
   int fd;
   int r;
@@ -62,7 +62,7 @@ main(int ac, char **av)
 }
 
 #define BUFS 8192
-open_read_close(char *fname)
+void open_read_close(char *fname)
 {
   int fd;
   char buf[BUFS];
Index: ltp-full-20100228/testcases/kernel/fs/fs-bench/random-del-create.c
===================================================================
--- ltp-full-20100228.orig/testcases/kernel/fs/fs-bench/random-del-create.c
+++ ltp-full-20100228/testcases/kernel/fs/fs-bench/random-del-create.c
@@ -24,7 +24,7 @@ int cfilecount=0;
 int dfilecount=0;
 int errorcount=0;
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
   int r;
   char fname[1024];
@@ -91,7 +91,7 @@ void create_or_delete(char *fname)
   }
 }
 
-create_file(char *filename)
+int create_file(char *filename)
 {
   int fd;
   int randomsize;
@@ -116,7 +116,7 @@ create_file(char *filename)
 #include <sys/stat.h>
 #include <unistd.h>
 
-delete_file(char *filename)
+int delete_file(char *filename)
 {
   struct stat buf;
   int st;

[-- Attachment #3: Type: text/plain, Size: 79 bytes --]

------------------------------------------------------------------------------

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] add types for functions in fs-bench
       [not found] ` <i2t364299f41004261917vf9e34d44y3cbde0a2eada4e75@mail.gmail.com>
@ 2010-07-08 10:55   ` Cyril Hrubis
  0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2010-07-08 10:55 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list

[-- Attachment #1: Type: text/plain, Size: 862 bytes --]

Hi!
> > Attached patch adds types for functions in sources for fs-bench just because
> > when function doesn't have return type it defaults to int and this causes
> > problems (for example when doing return from such function without value).
> >
> > Signed-off-by: Cyril Hrubis chrubis@suse.cz
> >
> >
> > Side note:
> >
> > The code quality for fs-bench is very poor, there is no documentation and the
> > scripts are broken (mostly wrongly hardcoded paths). IMHO these tests are not
> > worth fixing and candidate for removal.
> 
>     Please provide a build log.

Okay apparently I've missed some "unused variable" and "implicit
function declaration" warnings.  Attached patch fixes all compilation
issues (has previous two merged) but still at least the test scripts are
broken.

Signed-off-by: Cyril Hrubis chrubis@suse.cz

-- 
Cyril Hrubis
chrubis@suse.cz

[-- Attachment #2: fs-bench_cleanup.patch --]
[-- Type: text/x-patch, Size: 4423 bytes --]

diff --git a/testcases/kernel/fs/fs-bench/boxmuler.c b/testcases/kernel/fs/fs-bench/boxmuler.c
index 89ee941..0609335 100644
--- a/testcases/kernel/fs/fs-bench/boxmuler.c
+++ b/testcases/kernel/fs/fs-bench/boxmuler.c
@@ -1,5 +1,8 @@
 #include <math.h>
+#include <stdlib.h>
+
 #define M_2PI (M_PI*2)
+
 int box_muler(int min, int max)
 {
   double u1,u2,z;
diff --git a/testcases/kernel/fs/fs-bench/create-files.c b/testcases/kernel/fs/fs-bench/create-files.c
index 88ea202..ec54bb8 100644
--- a/testcases/kernel/fs/fs-bench/create-files.c
+++ b/testcases/kernel/fs/fs-bench/create-files.c
@@ -15,11 +15,14 @@
 char wbuf[MAXFSIZE];
 static int filecount=0;
 
+void makedir(char *dir1);
+void changedir(char *dir);
+void create_file(char *filename);
 
 extern int box_muler(int, int);
 
 int startc=0;
-main(int ac,char *av[])
+int main(int ac,char *av[])
 {
   int i=0;
   int j=0;
@@ -71,18 +74,21 @@ main(int ac,char *av[])
 end:
   fprintf(stderr,"\nTotal create files: %d\n",filecount);
   printf("Done\n");
+  return 0;
 }
 
 int showchar[]={124,47,45,92,124,47,45,92};
-static int mkdir_counter=0;
-makedir(char *dir1)
+
+void makedir(char *dir1)
 {
   if (mkdir(dir1, S_IRWXU) < 0) {
     perror(dir1);
     exit(1);
   }
 }
-changedir(char *dir) {
+
+void changedir(char *dir)
+{
   if ( chdir(dir) < 0 ) {
     perror(dir);
     exit(1);
@@ -90,7 +96,7 @@ changedir(char *dir) {
 }
 
 
-create_file(char *filename)
+void create_file(char *filename)
 {
   int fd;
   int randomsize;
diff --git a/testcases/kernel/fs/fs-bench/random-access-del-create.c b/testcases/kernel/fs/fs-bench/random-access-del-create.c
index 3322d92..fdfc71f 100644
--- a/testcases/kernel/fs/fs-bench/random-access-del-create.c
+++ b/testcases/kernel/fs/fs-bench/random-access-del-create.c
@@ -20,12 +20,14 @@ int openlog[2]={0,0};
 extern int box_muler(int, int);
 extern void create_or_delete(char *);
 
+int delete_file(char *filename);
+int create_file(char *filename);
+
 int cfilecount=0;
 int dfilecount=0;
 int errorcount=0;
 
-int
-main(int ac, char **av)
+int main(int ac, char **av)
 {
   int r;
   char fname[1024];
@@ -73,7 +75,6 @@ static int disk_space_pool=0;
 void create_or_delete(char *fname)
 {
   int r;
-  int fsize;
 
   r = (random() & 1);
   if ( r && disk_space_pool > POOLDISKSPACE) {
@@ -92,7 +93,7 @@ void create_or_delete(char *fname)
   }
 }
 
-create_file(char *filename)
+int create_file(char *filename)
 {
   int fd;
   int randomsize;
@@ -112,12 +113,14 @@ create_file(char *filename)
   cfilecount++;
   disk_space_pool -= randomsize;
   close(fd);
+
+  return 0;
 }
 
 #include <sys/stat.h>
 #include <unistd.h>
 
-delete_file(char *filename)
+int delete_file(char *filename)
 {
   struct stat buf;
   int st;
@@ -132,4 +135,6 @@ delete_file(char *filename)
     return(-1);
   }
   dfilecount++;
+
+  return 0;
 }
diff --git a/testcases/kernel/fs/fs-bench/random-access.c b/testcases/kernel/fs/fs-bench/random-access.c
index e2f8536..f5eb6a2 100644
--- a/testcases/kernel/fs/fs-bench/random-access.c
+++ b/testcases/kernel/fs/fs-bench/random-access.c
@@ -15,10 +15,12 @@ int openlog[2]={0,0};
 
 #define MAXNUM 0x100000
 
+void open_read_close(char *fname);
+
 int nullfd;
-main(int ac, char **av)
+
+int main(int ac, char **av)
 {
-  int fd;
   int r;
   char fname[1024];
   time_t t;
@@ -62,7 +64,7 @@ main(int ac, char **av)
 }
 
 #define BUFS 8192
-open_read_close(char *fname)
+void open_read_close(char *fname)
 {
   int fd;
   char buf[BUFS];
diff --git a/testcases/kernel/fs/fs-bench/random-del-create.c b/testcases/kernel/fs/fs-bench/random-del-create.c
index a1fc8b8..70ddf32 100644
--- a/testcases/kernel/fs/fs-bench/random-del-create.c
+++ b/testcases/kernel/fs/fs-bench/random-del-create.c
@@ -24,7 +24,7 @@ int cfilecount=0;
 int dfilecount=0;
 int errorcount=0;
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
   int r;
   char fname[1024];
@@ -91,7 +91,7 @@ void create_or_delete(char *fname)
   }
 }
 
-create_file(char *filename)
+int create_file(char *filename)
 {
   int fd;
   int randomsize;
@@ -111,12 +111,13 @@ create_file(char *filename)
   cfilecount++;
   disk_space_pool -= randomsize;
   close(fd);
+  return 0;
 }
 
 #include <sys/stat.h>
 #include <unistd.h>
 
-delete_file(char *filename)
+int delete_file(char *filename)
 {
   struct stat buf;
   int st;
@@ -131,4 +132,5 @@ delete_file(char *filename)
     return(-1);
   }
   dfilecount++;
+  return 0;
 }

[-- Attachment #3: orig_comp.log --]
[-- Type: text/x-log, Size: 3095 bytes --]

gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall  -I../../../../include -I../../../../include  -c -o create-files.o create-files.c
create-files.c:23: warning: return type defaults to 'int'
create-files.c: In function 'main':
create-files.c:48: warning: implicit declaration of function 'makedir'
create-files.c:49: warning: implicit declaration of function 'changedir'
create-files.c:60: warning: implicit declaration of function 'create_file'
create-files.c: At top level:
create-files.c:79: warning: return type defaults to 'int'
create-files.c:85: warning: return type defaults to 'int'
create-files.c:94: warning: return type defaults to 'int'
create-files.c: In function 'create_file':
create-files.c:112: warning: control reaches end of non-void function
create-files.c: In function 'changedir':
create-files.c:90: warning: control reaches end of non-void function
create-files.c: In function 'makedir':
create-files.c:84: warning: control reaches end of non-void function
create-files.c: In function 'main':
create-files.c:74: warning: control reaches end of non-void function
create-files.c: At top level:
create-files.c:77: warning: 'mkdir_counter' defined but not used
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall  -I../../../../include -I../../../../include  -c -o boxmuler.o boxmuler.c
boxmuler.c: In function 'box_muler':
boxmuler.c:16: warning: implicit declaration of function 'random'
gcc   -L../../../../lib  create-files.o boxmuler.o   -lm -o create-files
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall  -I../../../../include -I../../../../include   -L../../../../lib  random-access.c   -lm -o random-access
random-access.c:20: warning: return type defaults to 'int'
random-access.c: In function 'main':
random-access.c:57: warning: implicit declaration of function 'open_read_close'
random-access.c:21: warning: unused variable 'fd'
random-access.c: At top level:
random-access.c:66: warning: return type defaults to 'int'
random-access.c: In function 'open_read_close':
random-access.c:74: warning: 'return' with no value, in function returning non-void
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall  -I../../../../include -I../../../../include  -c -o random-access-del-create.o random-access-del-create.c
random-access-del-create.c: In function 'create_or_delete':
random-access-del-create.c:81: warning: implicit declaration of function 'create_file'
random-access-del-create.c:84: warning: implicit declaration of function 'delete_file'
random-access-del-create.c:76: warning: unused variable 'fsize'
random-access-del-create.c: At top level:
random-access-del-create.c:96: warning: return type defaults to 'int'
random-access-del-create.c:121: warning: return type defaults to 'int'
random-access-del-create.c: In function 'delete_file':
random-access-del-create.c:135: warning: control reaches end of non-void function
random-access-del-create.c: In function 'create_file':
random-access-del-create.c:115: warning: control reaches end of non-void function
gcc   -L../../../../lib  random-access-del-create.o boxmuler.o   -lm -o random-access-del-create

[-- Attachment #4: new_comp.log --]
[-- Type: text/x-log, Size: 741 bytes --]

gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall  -I../../../../include -I../../../../include  -c -o create-files.o create-files.c
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall  -I../../../../include -I../../../../include  -c -o boxmuler.o boxmuler.c
gcc   -L../../../../lib  create-files.o boxmuler.o   -lm -o create-files
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall  -I../../../../include -I../../../../include   -L../../../../lib  random-access.c   -lm -o random-access
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall  -I../../../../include -I../../../../include  -c -o random-access-del-create.o random-access-del-create.c
gcc   -L../../../../lib  random-access-del-create.o boxmuler.o   -lm -o random-access-del-create

[-- Attachment #5: Type: text/plain, Size: 235 bytes --]

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first

[-- Attachment #6: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2010-07-08 10:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-26 21:21 [LTP] [PATCH] add types for functions in fs-bench Cyril Hrubis
     [not found] ` <i2t364299f41004261917vf9e34d44y3cbde0a2eada4e75@mail.gmail.com>
2010-07-08 10:55   ` Cyril Hrubis

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.