Commit 8d99c512 authored by Swann Perarnau's avatar Swann Perarnau

Merge branch 'better-flags-for-ci' into 'master'

Better flags for CI

See merge request !65
parents b1b6b9a1 deb5a06d
Pipeline #7969 passed with stages
in 18 minutes and 9 seconds
...@@ -27,6 +27,8 @@ make:generic: ...@@ -27,6 +27,8 @@ make:generic:
except: except:
- /^wip.*/ - /^wip.*/
- /^WIP.*/ - /^WIP.*/
variables:
CFLAGS: "-std=c99 -pedantic -Wall -Wextra -Werror -Wno-unused-but-set-parameter"
script: script:
- ./autogen.sh - ./autogen.sh
- mkdir build - mkdir build
...@@ -37,6 +39,7 @@ make:generic: ...@@ -37,6 +39,7 @@ make:generic:
artifacts: artifacts:
when: on_failure when: on_failure
paths: paths:
- config.log
- tests/*.log - tests/*.log
make:knl: make:knl:
......
...@@ -67,7 +67,7 @@ AC_CHECK_LIB(dl, dlopen) ...@@ -67,7 +67,7 @@ AC_CHECK_LIB(dl, dlopen)
# add pthread support. # add pthread support.
# doc in m4/ax_pthread.m4. Defines automake PTHREAD_CFLAGS and PTHREAD_LIBS # doc in m4/ax_pthread.m4. Defines automake PTHREAD_CFLAGS and PTHREAD_LIBS
AX_PTHREAD AX_PTHREAD([],[AC_MSG_ERROR([Cannot find how to compile with pthreads.])])
CC="$PTHREAD_CC" CC="$PTHREAD_CC"
# NUMA support # NUMA support
...@@ -100,11 +100,6 @@ AC_CONFIG_HEADERS([include/config.h]) ...@@ -100,11 +100,6 @@ AC_CONFIG_HEADERS([include/config.h])
AC_CONFIG_FILES([Makefile AC_CONFIG_FILES([Makefile
src/Makefile src/Makefile
src/area/Makefile
src/dma/Makefile
src/tiling/Makefile
src/scratch/Makefile
src/utils/Makefile
include/Makefile include/Makefile
tests/Makefile tests/Makefile
doc/Makefile doc/Makefile
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <stddef.h> #include <stddef.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <unistd.h> #include <unistd.h>
......
...@@ -33,7 +33,7 @@ struct aml_dma_linux_par_thread_data { ...@@ -33,7 +33,7 @@ struct aml_dma_linux_par_thread_data {
* A logical identifier of the thread in charge for * A logical identifier of the thread in charge for
* the request progress. * the request progress.
**/ **/
int tid; size_t tid;
/** The actual thread in charge for the request progress**/ /** The actual thread in charge for the request progress**/
pthread_t thread; pthread_t thread;
/** The dma containing sequential operations **/ /** The dma containing sequential operations **/
...@@ -70,7 +70,7 @@ struct aml_dma_linux_par_data { ...@@ -70,7 +70,7 @@ struct aml_dma_linux_par_data {
struct aml_dma_linux_par_ops { struct aml_dma_linux_par_ops {
void *(*do_thread)(void *thread_data); void *(*do_thread)(void *thread_data);
int (*do_copy)(struct aml_dma_linux_par_data *data, int (*do_copy)(struct aml_dma_linux_par_data *data,
struct aml_dma_request_linux_par *request, int tid); struct aml_dma_request_linux_par *request, size_t tid);
}; };
/** /**
......
...@@ -30,10 +30,10 @@ extern int aml_errno; ...@@ -30,10 +30,10 @@ extern int aml_errno;
/** /**
* Get a string description of an aml error. * Get a string description of an aml error.
* @param errno: the aml error number. * @param err: the aml error number.
* Returns a static string describing the error. * Returns a static string describing the error.
**/ **/
const char *aml_strerror(const int errno); const char *aml_strerror(const int err);
/** /**
* Print error on standard error output. * Print error on standard error output.
......
lib_LTLIBRARIES = libaml.la AM_CFLAGS = -I$(top_srcdir)/include $(PTHREAD_CFLAGS)
AM_LDFLAGS = $(PTHREAD_LIBS)
libaml_la_SOURCES = aml.c
libaml_la_CFLAGS = -I$(top_srcdir)/include AREA_SOURCES = \
area/area.c \
libaml_la_LDFLAGS=$(PTHREAD_CFLAGS) area/linux.c
libaml_la_LIBADD=
DMA_SOURCES = \
SUBDIRS=utils dma/dma.c \
libaml_la_LIBADD+=$(top_srcdir)/src/utils/libamlutils.la dma/dma_linux_par.c \
dma/dma_linux_seq.c
SUBDIRS+=area
libaml_la_LIBADD+=$(top_srcdir)/src/area/libamlarea.la SCRATCH_SOURCES = \
scratch/scratch.c \
SUBDIRS+=dma scratch/scratch_par.c \
libaml_la_LIBADD+=$(top_srcdir)/src/dma/libamldma.la scratch/scratch_seq.c
SUBDIRS+=tiling TILING_SOURCES = \
libaml_la_LIBADD+=$(top_srcdir)/src/tiling/libamltiling.la tiling/tiling.c \
tiling/tiling_1d.c \
SUBDIRS+=scratch tiling/tiling_2d.c
libaml_la_LIBADD+=$(top_srcdir)/src/scratch/libamlscratch.la
UTILS_SOURCES = \
utils/bitmap.c \
utils/error.c \
utils/vector.c
LIB_SOURCES = \
$(AREA_SOURCES) \
$(DMA_SOURCES) \
$(SCRATCH_SOURCES) \
$(TILING_SOURCES) \
$(UTILS_SOURCES) \
aml.c
lib_LTLIBRARIES = libaml.la
libaml_la_SOURCES = $(LIB_SOURCES)
...@@ -21,6 +21,8 @@ int aml_errno; ...@@ -21,6 +21,8 @@ int aml_errno;
int aml_init(int *argc, char **argv[]) int aml_init(int *argc, char **argv[])
{ {
// disable warnings
(void)argc; (void)argv;
return 0; return 0;
} }
......
AM_CFLAGS=-I$(top_srcdir)/include
AM_CPPFLAGS=$(AM_CFLAGS)
noinst_LTLIBRARIES = libamlarea.la
libamlarea_la_LDFLAGS = -lnuma
libamlarea_la_CFLAGS = $(AM_CFLAGS)
libamlarea_la_SOURCES = \
area.c \
linux.c
...@@ -47,6 +47,8 @@ aml_area_linux_check_binding(struct aml_area_linux_data *area_data, ...@@ -47,6 +47,8 @@ aml_area_linux_check_binding(struct aml_area_linux_data *area_data,
{ {
int err, mode, i; int err, mode, i;
struct bitmask *nodeset; struct bitmask *nodeset;
// unused parameter
(void)size;
nodeset = numa_allocate_nodemask(); nodeset = numa_allocate_nodemask();
if (nodeset == NULL) if (nodeset == NULL)
...@@ -209,7 +211,6 @@ int aml_area_linux_init(struct aml_area *area, const int mmap_flags, ...@@ -209,7 +211,6 @@ int aml_area_linux_init(struct aml_area *area, const int mmap_flags,
const int binding_flags) const int binding_flags)
{ {
struct aml_area_linux_data *data; struct aml_area_linux_data *data;
int err;
if (area == NULL) if (area == NULL)
return -AML_EINVAL; return -AML_EINVAL;
......
AM_CFLAGS=-I$(top_srcdir)/include
AM_CPPFLAGS=$(AM_CFLAGS)
noinst_LTLIBRARIES=libamldma.la
libamldma_la_SOURCES=\
dma.c \
dma_linux_par.c \
dma_linux_seq.c
libamldma_la_CFLAGS=$(AM_CFLAGS)
libamldma_la_LDFLAGS=$(AM_CFLAGS)
...@@ -66,7 +66,7 @@ void *aml_dma_linux_par_do_thread(void *arg) ...@@ -66,7 +66,7 @@ void *aml_dma_linux_par_do_thread(void *arg)
} }
int aml_dma_linux_par_do_copy(struct aml_dma_linux_par_data *dma, int aml_dma_linux_par_do_copy(struct aml_dma_linux_par_data *dma,
struct aml_dma_request_linux_par *req, int tid) struct aml_dma_request_linux_par *req, size_t tid)
{ {
assert(dma != NULL); assert(dma != NULL);
assert(req != NULL); assert(req != NULL);
...@@ -125,7 +125,7 @@ int aml_dma_linux_par_create_request(struct aml_dma_data *d, ...@@ -125,7 +125,7 @@ int aml_dma_linux_par_create_request(struct aml_dma_data *d,
} }
pthread_mutex_unlock(&dma->data.lock); pthread_mutex_unlock(&dma->data.lock);
for (int i = 0; i < dma->data.nbthreads; i++) { for (size_t i = 0; i < dma->data.nbthreads; i++) {
struct aml_dma_linux_par_thread_data *rd = &req->thread_data[i]; struct aml_dma_linux_par_thread_data *rd = &req->thread_data[i];
rd->req = req; rd->req = req;
...@@ -149,7 +149,7 @@ int aml_dma_linux_par_destroy_request(struct aml_dma_data *d, ...@@ -149,7 +149,7 @@ int aml_dma_linux_par_destroy_request(struct aml_dma_data *d,
(struct aml_dma_request_linux_par *)r; (struct aml_dma_request_linux_par *)r;
/* we cancel and join, instead of killing, for a cleaner result */ /* we cancel and join, instead of killing, for a cleaner result */
for (int i = 0; i < dma->data.nbthreads; i++) { for (size_t i = 0; i < dma->data.nbthreads; i++) {
pthread_cancel(req->thread_data[i].thread); pthread_cancel(req->thread_data[i].thread);
pthread_join(req->thread_data[i].thread, NULL); pthread_join(req->thread_data[i].thread, NULL);
} }
...@@ -172,7 +172,7 @@ int aml_dma_linux_par_wait_request(struct aml_dma_data *d, ...@@ -172,7 +172,7 @@ int aml_dma_linux_par_wait_request(struct aml_dma_data *d,
struct aml_dma_request_linux_par *req = struct aml_dma_request_linux_par *req =
(struct aml_dma_request_linux_par *)r; (struct aml_dma_request_linux_par *)r;
for (int i = 0; i < dma->data.nbthreads; i++) for (size_t i = 0; i < dma->data.nbthreads; i++)
pthread_join(req->thread_data[i].thread, NULL); pthread_join(req->thread_data[i].thread, NULL);
/* destroy a completed request */ /* destroy a completed request */
...@@ -244,7 +244,7 @@ int aml_dma_linux_par_init(struct aml_dma *d, size_t nbreqs, ...@@ -244,7 +244,7 @@ int aml_dma_linux_par_init(struct aml_dma *d, size_t nbreqs,
sizeof(struct aml_dma_request_linux_par), sizeof(struct aml_dma_request_linux_par),
offsetof(struct aml_dma_request_linux_par, type), offsetof(struct aml_dma_request_linux_par, type),
AML_DMA_REQUEST_TYPE_INVALID); AML_DMA_REQUEST_TYPE_INVALID);
for (int i = 0; i < nbreqs; i++) { for (size_t i = 0; i < nbreqs; i++) {
struct aml_dma_request_linux_par *req = struct aml_dma_request_linux_par *req =
aml_vector_get(&dma->data.requests, i); aml_vector_get(&dma->data.requests, i);
...@@ -262,7 +262,7 @@ void aml_dma_linux_par_fini(struct aml_dma *d) ...@@ -262,7 +262,7 @@ void aml_dma_linux_par_fini(struct aml_dma *d)
if (d == NULL || d->data == NULL) if (d == NULL || d->data == NULL)
return; return;
dma = (struct aml_dma_linux_par *)d->data; dma = (struct aml_dma_linux_par *)d->data;
for (int i = 0; i < aml_vector_size(&dma->data.requests); i++) { for (size_t i = 0; i < aml_vector_size(&dma->data.requests); i++) {
struct aml_dma_request_linux_par *req = struct aml_dma_request_linux_par *req =
aml_vector_get(&dma->data.requests, i); aml_vector_get(&dma->data.requests, i);
......
AM_CFLAGS=-I$(top_srcdir)/include
AM_CPPFLAGS=$(AM_CFLAGS)
noinst_LTLIBRARIES=libamlscratch.la
libamlscratch_la_SOURCES=\
scratch.c \
scratch_seq.c \
scratch_par.c
libamlscratch_la_CFLAGS=$(AM_CFLAGS)
...@@ -58,6 +58,7 @@ void *aml_scratch_par_do_thread(void *arg) ...@@ -58,6 +58,7 @@ void *aml_scratch_par_do_thread(void *arg)
aml_dma_copy(scratch->data.dma, scratch->data.tiling, req->dstptr, aml_dma_copy(scratch->data.dma, scratch->data.tiling, req->dstptr,
req->dstid, scratch->data.tiling, req->srcptr, req->srcid); req->dstid, scratch->data.tiling, req->srcptr, req->srcid);
return NULL;
} }
struct aml_scratch_par_ops aml_scratch_par_inner_ops = { struct aml_scratch_par_ops aml_scratch_par_inner_ops = {
......
AM_CFLAGS=-I$(top_srcdir)/include
AM_CPPFLAGS=$(AM_CFLAGS)
noinst_LTLIBRARIES=libamltiling.la
libamltiling_la_SOURCES=\
tiling.c \
tiling_1d.c \
tiling_2d.c
...@@ -62,8 +62,7 @@ struct aml_tiling_iterator_ops aml_tiling_iterator_1d_ops = { ...@@ -62,8 +62,7 @@ struct aml_tiling_iterator_ops aml_tiling_iterator_1d_ops = {
int aml_tiling_1d_tileid(const struct aml_tiling_data *t, va_list ap) int aml_tiling_1d_tileid(const struct aml_tiling_data *t, va_list ap)
{ {
const struct aml_tiling_1d_data *data = (void)t;
(const struct aml_tiling_1d_data *)t;
size_t x = va_arg(ap, size_t); size_t x = va_arg(ap, size_t);
return x; return x;
} }
...@@ -99,7 +98,7 @@ int aml_tiling_1d_ndims(const struct aml_tiling_data *t, va_list ap) ...@@ -99,7 +98,7 @@ int aml_tiling_1d_ndims(const struct aml_tiling_data *t, va_list ap)
size_t *x = va_arg(ap, size_t *); size_t *x = va_arg(ap, size_t *);
*x = data->totalsize/data->blocksize; *x = data->totalsize/data->blocksize;
if (data->totalsize % data->blocksize != 0) if (data->totalsize % data->blocksize != 0)
*x++; *x += 1;
return 0; return 0;
} }
...@@ -107,6 +106,7 @@ int aml_tiling_1d_init_iterator(struct aml_tiling_data *t, ...@@ -107,6 +106,7 @@ int aml_tiling_1d_init_iterator(struct aml_tiling_data *t,
struct aml_tiling_iterator *it, int flags) struct aml_tiling_iterator *it, int flags)
{ {
assert(it->data != NULL); assert(it->data != NULL);
(void)flags;
struct aml_tiling_iterator_1d_data *data = struct aml_tiling_iterator_1d_data *data =
(struct aml_tiling_iterator_1d_data *)it->data; (struct aml_tiling_iterator_1d_data *)it->data;
...@@ -136,12 +136,15 @@ int aml_tiling_1d_create_iterator(struct aml_tiling_data *t, ...@@ -136,12 +136,15 @@ int aml_tiling_1d_create_iterator(struct aml_tiling_data *t,
int aml_tiling_1d_fini_iterator(struct aml_tiling_data *t, int aml_tiling_1d_fini_iterator(struct aml_tiling_data *t,
struct aml_tiling_iterator *it) struct aml_tiling_iterator *it)
{ {
(void)t;
(void)it;
return 0; return 0;
} }
int aml_tiling_1d_destroy_iterator(struct aml_tiling_data *t, int aml_tiling_1d_destroy_iterator(struct aml_tiling_data *t,
struct aml_tiling_iterator **it) struct aml_tiling_iterator **it)
{ {
(void)t;
free(*it); free(*it);
return 0; return 0;
} }
...@@ -197,7 +200,6 @@ int aml_tiling_1d_create(struct aml_tiling **t, ...@@ -197,7 +200,6 @@ int aml_tiling_1d_create(struct aml_tiling **t,
int aml_tiling_1d_init(struct aml_tiling *t, int aml_tiling_1d_init(struct aml_tiling *t,
size_t tilesize, size_t totalsize) size_t tilesize, size_t totalsize)
{ {
int err;
struct aml_tiling_1d_data *data; struct aml_tiling_1d_data *data;
if (t == NULL || t->data == NULL) if (t == NULL || t->data == NULL)
...@@ -215,6 +217,7 @@ int aml_tiling_1d_init(struct aml_tiling *t, ...@@ -215,6 +217,7 @@ int aml_tiling_1d_init(struct aml_tiling *t,
void aml_tiling_1d_fini(struct aml_tiling *t) void aml_tiling_1d_fini(struct aml_tiling *t)
{ {
/* nothing to do */ /* nothing to do */
(void)t;
} }
......
...@@ -92,7 +92,7 @@ size_t aml_tiling_2d_tilesize(const struct aml_tiling_data *t, int tileid) ...@@ -92,7 +92,7 @@ size_t aml_tiling_2d_tilesize(const struct aml_tiling_data *t, int tileid)
const struct aml_tiling_2d_data *data = const struct aml_tiling_2d_data *data =
(const struct aml_tiling_2d_data *)t; (const struct aml_tiling_2d_data *)t;
if (tileid < 0 || tileid >= data->ndims[0]*data->ndims[1]) if (tileid < 0 || tileid >= (int)(data->ndims[0]*data->ndims[1]))
return 0; return 0;
else else
return data->blocksize; return data->blocksize;
...@@ -105,7 +105,7 @@ void *aml_tiling_2d_tilestart(const struct aml_tiling_data *t, ...@@ -105,7 +105,7 @@ void *aml_tiling_2d_tilestart(const struct aml_tiling_data *t,
(const struct aml_tiling_2d_data *)t; (const struct aml_tiling_2d_data *)t;
intptr_t p = (intptr_t)ptr; intptr_t p = (intptr_t)ptr;
if (tileid < 0 || tileid >= data->ndims[0]*data->ndims[1]) if (tileid < 0 || tileid >= (int)(data->ndims[0]*data->ndims[1]))
return NULL; return NULL;
else else
return (void *)(p + tileid*data->blocksize); return (void *)(p + tileid*data->blocksize);
...@@ -128,6 +128,7 @@ int aml_tiling_2d_init_iterator(struct aml_tiling_data *t, ...@@ -128,6 +128,7 @@ int aml_tiling_2d_init_iterator(struct aml_tiling_data *t,
struct aml_tiling_iterator *it, int flags) struct aml_tiling_iterator *it, int flags)
{ {
assert(it->data != NULL); assert(it->data != NULL);
(void)flags;
struct aml_tiling_iterator_2d_data *data = struct aml_tiling_iterator_2d_data *data =
(struct aml_tiling_iterator_2d_data *)it->data; (struct aml_tiling_iterator_2d_data *)it->data;
it->ops = &aml_tiling_iterator_2d_ops; it->ops = &aml_tiling_iterator_2d_ops;
...@@ -156,12 +157,15 @@ int aml_tiling_2d_create_iterator(struct aml_tiling_data *t, ...@@ -156,12 +157,15 @@ int aml_tiling_2d_create_iterator(struct aml_tiling_data *t,
int aml_tiling_2d_fini_iterator(struct aml_tiling_data *t, int aml_tiling_2d_fini_iterator(struct aml_tiling_data *t,
struct aml_tiling_iterator *it) struct aml_tiling_iterator *it)
{ {
(void)t;
(void)it;
return 0; return 0;
} }
int aml_tiling_2d_destroy_iterator(struct aml_tiling_data *t, int aml_tiling_2d_destroy_iterator(struct aml_tiling_data *t,
struct aml_tiling_iterator **it) struct aml_tiling_iterator **it)
{ {
(void)t;
free(*it); free(*it);
return 0; return 0;
} }
...@@ -238,8 +242,8 @@ int aml_tiling_2d_init(struct aml_tiling *t, int type, ...@@ -238,8 +242,8 @@ int aml_tiling_2d_init(struct aml_tiling *t, int type,
size_t tilesize, size_t totalsize, size_t tilesize, size_t totalsize,
size_t rowsize, size_t colsize) size_t rowsize, size_t colsize)
{ {
int err;
struct aml_tiling_2d_data *data; struct aml_tiling_2d_data *data;
(void)type;
if (t == NULL || t->data == NULL) if (t == NULL || t->data == NULL)
return -AML_EINVAL; return -AML_EINVAL;
...@@ -258,6 +262,7 @@ int aml_tiling_2d_init(struct aml_tiling *t, int type, ...@@ -258,6 +262,7 @@ int aml_tiling_2d_init(struct aml_tiling *t, int type,
void aml_tiling_2d_fini(struct aml_tiling *t) void aml_tiling_2d_fini(struct aml_tiling *t)
{ {
/* nothing to do */ /* nothing to do */
(void)t;
} }
......
AM_CFLAGS=-I$(top_srcdir)/include
AM_CPPFLAGS=$(AM_CFLAGS)
noinst_LTLIBRARIES=libamlutils.la
libamlutils_la_SOURCES=\
vector.c \
bitmap.c \
error.c
libamlutils_la_CFLAGS=$(AM_CFLAGS)
libamlutils_la_LDFLAGS=
...@@ -7,9 +7,8 @@ ...@@ -7,9 +7,8 @@
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*******************************************************************************/ *******************************************************************************/
#include "config.h"
#include "aml.h" #include "aml.h"
#include <string.h>
#define AML_BITMAP_EMPTY (0UL) #define AML_BITMAP_EMPTY (0UL)
#define AML_BITMAP_FULL (~0UL) #define AML_BITMAP_FULL (~0UL)
......
...@@ -20,11 +20,11 @@ static const char * const aml_error_strings[] = { ...@@ -20,11 +20,11 @@ static const char * const aml_error_strings[] = {
[AML_ENOTSUP] = "Operation not supported", [AML_ENOTSUP] = "Operation not supported",
}; };
const char *aml_strerror(const int errno) const char *aml_strerror(const int err)
{ {
if (errno < 0 || errno < AML_ERROR_MAX) if (err < 0 || err < AML_ERROR_MAX)
return "Unknown error"; return "Unknown error";
return aml_error_strings[errno]; return aml_error_strings[err];
} }
void aml_perror(const char *msg) void aml_perror(const char *msg)
......
...@@ -29,7 +29,7 @@ int aml_vector_resize(struct aml_vector *vec, size_t newsize) ...@@ -29,7 +29,7 @@ int aml_vector_resize(struct aml_vector *vec, size_t newsize)
vec->ptr = realloc(vec->ptr, newsize * vec->sz); vec->ptr = realloc(vec->ptr, newsize * vec->sz);
assert(vec->ptr != NULL); assert(vec->ptr != NULL);
for (int i = vec->nbelems; i < newsize; i++) { for (size_t i = vec->nbelems; i < newsize; i++) {
int *k = AML_VECTOR_KEY_P(vec, i); int *k = AML_VECTOR_KEY_P(vec, i);
*k = vec->na; *k = vec->na;
} }
...@@ -47,8 +47,13 @@ size_t aml_vector_size(const struct aml_vector *vec) ...@@ -47,8 +47,13 @@ size_t aml_vector_size(const struct aml_vector *vec)
void *aml_vector_get(struct aml_vector *vec, int id) void *aml_vector_get(struct aml_vector *vec, int id)
{ {
assert(vec != NULL); assert(vec != NULL);
if (id != vec->na && id < vec->nbelems) if (id == vec->na || id < 0)
return AML_VECTOR_ELT_P(vec, id); return NULL;
size_t idx = (size_t)id;
if (idx < vec->nbelems)
return AML_VECTOR_ELT_P(vec, idx);
else else
return NULL; return NULL;
} }
...@@ -57,7 +62,7 @@ void *aml_vector_get(struct aml_vector *vec, int id) ...@@ -57,7 +62,7 @@ void *aml_vector_get(struct aml_vector *vec, int id)
int aml_vector_find(const struct aml_vector *vec, int key) int aml_vector_find(const struct aml_vector *vec, int key)
{ {
assert(vec != NULL); assert(vec != NULL);
for (int i = 0; i < vec->nbelems; i++) { for (size_t i = 0; i < vec->nbelems; i++) {
int *k = AML_VECTOR_KEY_P(vec, i); int *k = AML_VECTOR_KEY_P(vec, i);
if (*k == key) if (*k == key)
...@@ -135,7 +140,7 @@ int aml_vector_init(struct aml_vector *vec, size_t reserve, size_t size, ...@@ -135,7 +140,7 @@ int aml_vector_init(struct aml_vector *vec, size_t reserve, size_t size,
vec->na = na; vec->na = na;
vec->nbelems = reserve; vec->nbelems = reserve;
vec->ptr = ptr; vec->ptr = ptr;
for (int i = 0; i < vec->nbelems; i++) { for (size_t i = 0; i < vec->nbelems; i++) {
int *k = AML_VECTOR_KEY_P(vec, i); int *k = AML_VECTOR_KEY_P(vec, i);
*k = na; *k = na;
} }
......
AM_COLOR_TESTS = yes AM_COLOR_TESTS = yes
# add OpenMP to flags for test programs AM_CFLAGS = -I$(top_srcdir)/include $(PTHREAD_CFLAGS)
AM_CFLAGS = -I$(top_srcdir)/include AM_LDFLAGS = ../src/libaml.la $(PTHREAD_LIBS)
AM_LDFLAGS = ../src/libaml.la
# valgrind support # valgrind support
if TEST_VALGRIND if TEST_VALGRIND
......
...@@ -17,7 +17,6 @@ void test_map(const struct aml_area *area){ ...@@ -17,7 +17,6 @@ void test_map(const struct aml_area *area){
assert(area->ops->munmap != NULL); assert(area->ops->munmap != NULL);
void *ptr; void *ptr;
int err;
size_t s; size_t s;
const size_t sizes[4] = {1, 32, 4096, 1<<20}; const size_t sizes[4] = {1, 32, 4096, 1<<20};
......
...@@ -7,54 +7,65 @@ ...@@ -7,54 +7,65 @@
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*******************************************************************************/ *******************************************************************************/
#include "config.h"
#include "aml.h" #include "aml.h"
#include "aml/area/linux.h" #include "aml/area/linux.h"
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
const size_t sizes[3] = {1, 1<<12, 1<<20}; const size_t sizes[3] = { 1, 1 << 12, 1 << 20 };
const int binding_flags[3] = { const int binding_flags[3] = {
AML_AREA_LINUX_BINDING_FLAG_BIND, AML_AREA_LINUX_BINDING_FLAG_BIND,
AML_AREA_LINUX_BINDING_FLAG_INTERLEAVE, AML_AREA_LINUX_BINDING_FLAG_INTERLEAVE,
AML_AREA_LINUX_BINDING_FLAG_PREFERRED AML_AREA_LINUX_BINDING_FLAG_PREFERRED
}; };
const int mmap_flags[2] = { const int mmap_flags[2] = {
AML_AREA_LINUX_MMAP_FLAG_PRIVATE, AML_AREA_LINUX_MMAP_FLAG_PRIVATE,
AML_AREA_LINUX_MMAP_FLAG_SHARED AML_AREA_LINUX_MMAP_FLAG_SHARED
}; };
void test_binding(struct aml_bitmap *