Commit 29d9a8b8 authored by Swann Perarnau's avatar Swann Perarnau

[fix] more warnings in tests

Still fails, some issues in configure.ac/Makefile.am
parent 466eb6f3
......@@ -17,7 +17,6 @@ void test_map(const struct aml_area *area){
assert(area->ops->munmap != NULL);
void *ptr;
int err;
size_t s;
const size_t sizes[4] = {1, 32, 4096, 1<<20};
......
......@@ -7,54 +7,65 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*******************************************************************************/
#include "config.h"
#include "aml.h"
#include "aml/area/linux.h"
#include <assert.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] = {
AML_AREA_LINUX_BINDING_FLAG_BIND,
AML_AREA_LINUX_BINDING_FLAG_INTERLEAVE,
AML_AREA_LINUX_BINDING_FLAG_PREFERRED
};
const int mmap_flags[2] = {
AML_AREA_LINUX_MMAP_FLAG_PRIVATE,
AML_AREA_LINUX_MMAP_FLAG_SHARED
};
void test_binding(struct aml_bitmap *bitmap){
void test_binding(struct aml_bitmap *bitmap)
{
void *ptr;
int err;
size_t s;
int bf, mf, i, nnodes, binding_flag, mmap_flag;
int binding_flag, mmap_flag;
struct aml_area *area;
for(bf=0; bf<sizeof(binding_flags)/sizeof(*binding_flags); bf++){
for (unsigned int bf = 0;
bf < sizeof(binding_flags) / sizeof(*binding_flags); bf++) {
binding_flag = binding_flags[bf];
for(mf=0; mf<sizeof(mmap_flags)/sizeof(*mmap_flags); mf++){
for (unsigned int mf = 0;
mf < sizeof(mmap_flags) / sizeof(*mmap_flags); mf++) {
mmap_flag = mmap_flags[mf];
for(s = 0; s<sizeof(sizes)/sizeof(*sizes); s++){
aml_area_linux_create(&area, mmap_flag, bitmap, binding_flag);
for (size_t s = 0;
s < sizeof(sizes) / sizeof(*sizes); s++) {
aml_area_linux_create(&area, mmap_flag, bitmap,
binding_flag);
assert(area != NULL);
ptr = area->ops->mmap((struct aml_area_data*)area->data,
NULL,
sizes[s]);
ptr = area->ops->mmap(
(struct aml_area_data *)area->data,
NULL, sizes[s]);
assert(ptr != NULL);
memset(ptr, 0, sizes[s]);
assert(aml_area_linux_check_binding((struct aml_area_linux_data*)area->data, ptr, sizes[s]) > 0);
assert(area->ops->munmap((struct aml_area_data*)area->data, ptr, sizes[s]) == AML_SUCCESS);
assert(aml_area_linux_check_binding(
(struct aml_area_linux_data *)area->data,
ptr, sizes[s]) > 0);
assert(area->ops->munmap(
(struct aml_area_data *)area->data,
ptr, sizes[s]) == AML_SUCCESS);
aml_area_linux_destroy(&area);
}
}
}
}
void test_bind(){
void test_bind(void)
{
struct bitmask *nodeset;
int i, num_nodes;
int i, num_nodes;
struct aml_bitmap bitmap;
struct aml_area *area;
......@@ -62,24 +73,25 @@ void test_bind(){
num_nodes = numa_bitmask_weight(nodeset);
aml_bitmap_fill(&bitmap);
if(aml_bitmap_last(&bitmap) > num_nodes){
assert(aml_area_linux_create(&area, AML_AREA_LINUX_MMAP_FLAG_PRIVATE,
&bitmap,
AML_AREA_LINUX_BINDING_FLAG_PREFERRED) == -AML_EDOM);
if (aml_bitmap_last(&bitmap) > num_nodes) {
assert(aml_area_linux_create
(&area, AML_AREA_LINUX_MMAP_FLAG_PRIVATE, &bitmap,
AML_AREA_LINUX_BINDING_FLAG_PREFERRED) == -AML_EDOM);
assert(area == NULL);
}
test_binding(NULL);
aml_bitmap_zero(&bitmap);
for(i = 0; i<num_nodes; i++){
for (i = 0; i < num_nodes; i++) {
aml_bitmap_set(&bitmap, i);
test_binding(&bitmap);
aml_bitmap_clear(&bitmap, i);
}
}
int main(int argc, char** argv){
int main(void)
{
test_bind();
return 0;
}
......@@ -36,8 +36,9 @@ int doit(struct aml_tiling *t, struct aml_tiling_iterator *it)
for(i = 0; i < NBTILES; i++)
{
ptr = (intptr_t) aml_tiling_tilestart(t, NULL, i);
assert(ptr == i*TILESIZE);
assert(ptr == (intptr_t)i*TILESIZE);
}
return 0;
}
int main(int argc, char *argv[])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment