summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-01-16 20:53:42 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-01-16 20:53:42 +0200
commitf6bd2c366b32262c2a5a1ac38713dc84bf7c9cbf (patch)
tree6464f369218560de977847b1dafc2952f89e37d9 /tests
parent3bcddc65e3ffd69f29a68410c0604218cec8c34a (diff)
ubi-tests: fix build and some warnings
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/ubi-tests/Makefile40
-rw-r--r--tests/ubi-tests/common.c8
-rw-r--r--tests/ubi-tests/common.h8
-rw-r--r--tests/ubi-tests/integ.c8
-rw-r--r--tests/ubi-tests/io_basic.c2
-rw-r--r--tests/ubi-tests/io_paral.c4
-rw-r--r--tests/ubi-tests/io_update.c2
7 files changed, 24 insertions, 48 deletions
diff --git a/tests/ubi-tests/Makefile b/tests/ubi-tests/Makefile
index d122c8b..0ce99d8 100644
--- a/tests/ubi-tests/Makefile
+++ b/tests/ubi-tests/Makefile
@@ -1,45 +1,25 @@
LIBUBI_PATH=../../ubi-utils/new-utils/
LIBUBI_SRC_PATH=../../ubi-utils/new-utils/src/
LIBUBI_HEADER_PATH=../../ubi-utils/new-utils/include
-UBI_HEADERS_PATH=../../include/
UBIUTILS_PATH=../../ubi-utils/new-utils/
-CC := $(CROSS)gcc
+LIBUBI_PATH=../../ubi-utils/new-utils/
+KERNELHDR := ../../include
-TESTS=io_update volrefcnt integ io_paral io_read io_basic \
+LIBS = libubi
+TARGETS=io_update volrefcnt integ io_paral io_read io_basic \
mkvol_basic mkvol_bad mkvol_paral rsvol
-# Because of implicite rules we use make treats .o files as intermediate, thus
-# it removes the. If you want to prevent the removal, uncomment the below
-#.SECONDARY: $(addsuffix .o, $(TESTS)) $(addsuffix .o, $(HELPERS))
-
-CFLAGS += -Wall -I$(LIBUBI_HEADER_PATH) -I $(UBI_HEADERS_PATH) -L. -O2
+CFLAGS += -I$(LIBUBI_HEADER_PATH) -I $(KERNELHDR) -lpthread
-all: ubi-utils libubi $(TESTS)
+include ../../common.mk
# Compile ubilib with the udevsettle hack
-libubi: $(LIBUBI_SRC_PATH)/libubi.c $(LIBUBI_HEADER_PATH)/libubi.h $(LIBUBI_SRC_PATH)/libubi_int.h
+libubi.a: $(LIBUBI_SRC_PATH)/libubi.c $(LIBUBI_HEADER_PATH)/libubi.h $(LIBUBI_SRC_PATH)/libubi_int.h
$(CC) $(CFLAGS) -I $(LIBUBI_SRC_PATH) -I../../include -DUDEV_SETTLE_HACK -c $(LIBUBI_SRC_PATH)/libubi.c -o libubi.o
ar cr libubi.a libubi.o
-# The below cancels existing implicite rule to make programs from .c files,
-# in order to force make using our rule defined below
-%: %.c
-
-# The below is the rule to get an .o file from a .c file
-%.o: %.c
- $(CC) $(CFLAGS) $< -c -o $@
-
-# And the below is the rule to get final test executable from its .o and common.o
-%: %.o common.o
- $(CC) $(CFLAGS) $^ -lubi -o $@
-
-# *paral tests require libpthread, thus the below rule for them
-%paral: %paral.o common.o
- $(CC) $(CFLAGS) $^ -lubi -lpthread -o $@
-
-ubi-utils:
- make -C $(UBIUTILS_PATH)
+$(TARGETS): $(addprefix $(BUILDDIR)/, common.o) libubi.a
-clean:
- rm -f $(TESTS) $(addsuffix .o, $(TESTS)) libubi.* $(HELPERS) $(addsuffix .o, $(HELPERS))
+clean::
+ rm -f $(TARGETS) $(addsuffix .o, $(TESTS)) libubi.*
diff --git a/tests/ubi-tests/common.c b/tests/ubi-tests/common.c
index e785b91..59b30a7 100644
--- a/tests/ubi-tests/common.c
+++ b/tests/ubi-tests/common.c
@@ -203,8 +203,7 @@ int __check_volume(libubi_t libubi, struct ubi_dev_info *dev_info,
/**
* __check_vol_patt - check that volume contains certain data
*
- * @libubi libubi descriptor
- * @dev_info UBI device description
+ * @libubi libubi descriptor
* @test test name
* @func function name
* @line line number
@@ -214,9 +213,8 @@ int __check_volume(libubi_t libubi, struct ubi_dev_info *dev_info,
* This function returns %0 if the volume contains only @byte bytes, and %-1 if
* not.
*/
-int __check_vol_patt(libubi_t libubi, struct ubi_dev_info *dev_info,
- const char *test, const char *func, int line,
- const char *node, uint8_t byte)
+int __check_vol_patt(libubi_t libubi, const char *test, const char *func,
+ int line, const char *node, uint8_t byte)
{
int ret, fd;
long long bytes = 0;
diff --git a/tests/ubi-tests/common.h b/tests/ubi-tests/common.h
index 3e8ada8..faa2865 100644
--- a/tests/ubi-tests/common.h
+++ b/tests/ubi-tests/common.h
@@ -49,8 +49,7 @@ extern "C" {
__LINE__, vol_id, req)
#define check_vol_patt(node, byte) \
- __check_vol_patt(libubi, &dev_info, TESTNAME, __FUNCTION__, __LINE__, \
- node, byte)
+ __check_vol_patt(libubi, TESTNAME, __FUNCTION__, __LINE__, node, byte)
#define update_vol_patt(node, bytes, byte) \
__update_vol_patt(libubi, TESTNAME, __FUNCTION__, __LINE__, \
@@ -89,9 +88,8 @@ int __initial_check(const char *test, int argc, char * const argv[]);
int __check_volume(libubi_t libubi, struct ubi_dev_info *dev_info,
const char *test, const char *func, int line, int vol_id,
const struct ubi_mkvol_request *req);
-int __check_vol_patt(libubi_t libubi, struct ubi_dev_info *dev_info,
- const char *test, const char *func, int line,
- const char *node, uint8_t byte);
+int __check_vol_patt(libubi_t libubi, const char *test, const char *func,
+ int line, const char *node, uint8_t byte);
int __update_vol_patt(libubi_t libubi, const char *test, const char *func,
int line, const char *node, long long bytes,
uint8_t byte);
diff --git a/tests/ubi-tests/integ.c b/tests/ubi-tests/integ.c
index f78c280..9958466 100644
--- a/tests/ubi-tests/integ.c
+++ b/tests/ubi-tests/integ.c
@@ -81,7 +81,7 @@ static uint64_t total_written = 0;
static uint64_t total_space = 0;
static struct open_volume_fd *open_volumes;
-static size_t open_volume_count = 0;
+static int open_volume_count = 0;
static const char *ubi_module_load_string;
@@ -237,7 +237,7 @@ static void check_erase_block(struct erase_block_info *erase_block, int fd)
if (w->offset + w->size < gap_end) {
/* There is a gap. Check all 0xff */
off64_t gap_start = w->offset + w->size;
- size_t size = gap_end - gap_start;
+ ssize_t size = gap_end - gap_start;
if (lseek64(fd, gap_start, SEEK_SET) != gap_start)
error_exit("lseek64 failed");
memset(read_buffer, 0 , size);
@@ -273,7 +273,7 @@ static void check_erase_block(struct erase_block_info *erase_block, int fd)
if (gap_end > erase_block->offset) {
/* Check all 0xff */
off64_t gap_start = erase_block->offset;
- size_t size = gap_end - gap_start;
+ ssize_t size = gap_end - gap_start;
if (lseek64(fd, gap_start, SEEK_SET) != gap_start)
error_exit("lseek64 failed");
memset(read_buffer, 0 , size);
@@ -535,7 +535,7 @@ static void get_ubi_devices_info(void)
{
int i, ubi_pos = 0;
char dev_name[1024];
- size_t buf_size = 1024 * 128;
+ ssize_t buf_size = 1024 * 128;
if (ubi_get_info(libubi, &info))
error_exit("ubi_get_info failed");
diff --git a/tests/ubi-tests/io_basic.c b/tests/ubi-tests/io_basic.c
index e10f8db..819893c 100644
--- a/tests/ubi-tests/io_basic.c
+++ b/tests/ubi-tests/io_basic.c
@@ -93,7 +93,7 @@ remove:
*/
static int test_aligned(int type)
{
- int i, ebsz;
+ unsigned int i, ebsz;
struct ubi_mkvol_request req;
const char *name = TESTNAME ":test_aligned()";
char vol_node[strlen(UBI_VOLUME_PATTERN) + 100];
diff --git a/tests/ubi-tests/io_paral.c b/tests/ubi-tests/io_paral.c
index f98618c..ed0cbe0 100644
--- a/tests/ubi-tests/io_paral.c
+++ b/tests/ubi-tests/io_paral.c
@@ -60,7 +60,7 @@ static long long memory_limit(void)
*
* @ptr thread number
*/
-static void * the_thread(void *ptr)
+static void *the_thread(void *ptr)
{
int fd, iter = iterations, vol_id = (int)ptr;
unsigned char *wbuf, *rbuf;
@@ -219,7 +219,7 @@ int main(int argc, char * const argv[])
}
for (i = 0; i < THREADS_NUM; i++) {
- ret = pthread_create(&threads[i], NULL, &the_thread, (void*)i);
+ ret = pthread_create(&threads[i], NULL, &the_thread, (void *)i);
if (ret) {
failed("pthread_create");
goto remove;
diff --git a/tests/ubi-tests/io_update.c b/tests/ubi-tests/io_update.c
index a86b005..24c0563 100644
--- a/tests/ubi-tests/io_update.c
+++ b/tests/ubi-tests/io_update.c
@@ -211,7 +211,7 @@ static int test_update(int type)
int alignments[] = ALIGNMENTS(dev_info.leb_size);
struct ubi_vol_info vol_info;
char vol_node[strlen(UBI_VOLUME_PATTERN) + 100];
- int i;
+ unsigned int i;
for (i = 0; i < sizeof(alignments)/sizeof(int); i++) {
int leb_size;