Commit 6295df05 authored by Swann Perarnau's avatar Swann Perarnau
Browse files

[fix] missing headers, include on a .c

Add headers to the automake infrastructure to ensure that `make dist`
will include them.

Also remove one "header" that was in a .c, and not needed as of now.
parent 65909645
......@@ -10,6 +10,7 @@ include_aml_layoutdir=$(includedir)/aml/layout
include_aml_layout_HEADERS = \
aml/layout/native.h \
aml/layout/dense.h \
aml/layout/pad.h \
aml/layout/sparse.h \
aml/layout/reshape.h
......
......@@ -41,6 +41,7 @@ noinst_LTLIBRARIES = liblayout_test.la
liblayout_test_la_CPPFLAGS =
liblayout_test_la_LDFLAGS =
liblayout_test_la_SOURCES = \
layout/test_layout.h \
layout/coords.c \
layout/dense.c \
layout/layout.c \
......
......@@ -8,14 +8,38 @@
* SPDX-License-Identifier: BSD-3-Clause
******************************************************************************/
#include "test_replicaset.c"
#include <stdlib.h>
#include "aml.h"
#include "aml/higher/replicaset.h"
#include "aml/higher/replicaset/hwloc.h"
void test_replicaset(struct aml_replicaset *replicaset,
const void *src,
int (*comp)(const void *, const void *, size_t))
{
// Basic tests
assert(replicaset != NULL);
assert(replicaset->ops != NULL);
assert(replicaset->ops->init != NULL);
assert(replicaset->ops->sync != NULL);
assert(replicaset->n > 0);
for (unsigned i = 0; i < replicaset->n; i++)
assert(replicaset->replica[i] != NULL);
// Check sync
assert(aml_replicaset_sync(replicaset, 0) == AML_SUCCESS);
for (unsigned i = 1; i < replicaset->n; i++)
assert(!comp(replicaset->replica[i], replicaset->replica[0],
replicaset->size));
// Check init
assert(aml_replicaset_init(replicaset, src) == AML_SUCCESS);
for (unsigned i = 0; i < replicaset->n; i++)
assert(!comp(replicaset->replica[i], src, replicaset->size));
}
const size_t size = 1 << 20; // 1 Mo
void *src;
......
/*******************************************************************************
* Copyright 2019 UChicago Argonne, LLC.
* (c.f. AUTHORS, LICENSE)
*
* This file is part of the AML project.
* For more info, see https://xgitlab.cels.anl.gov/argo/aml
*
* SPDX-License-Identifier: BSD-3-Clause
******************************************************************************/
#include <assert.h>
#include "aml.h"
#include "aml/higher/replicaset.h"
/**
* Common replicaset test.
*/
void test_replicaset(struct aml_replicaset *replicaset,
const void *src,
int (*comp)(const void *, const void *, size_t))
{
// Basic tests
assert(replicaset != NULL);
assert(replicaset->ops != NULL);
assert(replicaset->ops->init != NULL);
assert(replicaset->ops->sync != NULL);
assert(replicaset->n > 0);
for (unsigned i = 0; i < replicaset->n; i++)
assert(replicaset->replica[i] != NULL);
// Check sync
assert(aml_replicaset_sync(replicaset, 0) == AML_SUCCESS);
for (unsigned i = 1; i < replicaset->n; i++)
assert(!comp(replicaset->replica[i], replicaset->replica[0],
replicaset->size));
// Check init
assert(aml_replicaset_init(replicaset, src) == AML_SUCCESS);
for (unsigned i = 0; i < replicaset->n; i++)
assert(!comp(replicaset->replica[i], src, replicaset->size));
}
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