#include <tools/ccanlint/ccanlint.h>
#include <tools/tools.h>
-#include <ccan/talloc/talloc.h>
+#include <ccan/foreach/foreach.h>
#include <ccan/str/str.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <err.h>
#include <string.h>
#include <ctype.h>
-#include "../compulsory_tests/build.h"
+#include "build.h"
static const char *can_build(struct manifest *m)
{
struct ccan_file *i;
list_for_each(&m->c_files, i, list) {
- char *fullfile = talloc_asprintf(m, "%s/%s", m->dir, i->name);
+ char *fullfile = tal_fmt(m, "%s/%s", m->dir, i->name);
char *output;
- i->compiled[ctype] = maybe_temp_file(m, "", false, fullfile);
+ i->compiled[ctype] = temp_file(m, "", fullfile);
if (!compile_object(m, fullfile, ccan_dir, compiler, flags,
i->compiled[ctype], &output)) {
- talloc_free(i->compiled[ctype]);
+ tal_free(i->compiled[ctype]);
i->compiled[ctype] = NULL;
- return talloc_asprintf(m,
- "Dependency %s"
- " did not build:\n%s",
- m->basename, output);
+ return tal_fmt(m,
+ "Dependency %s did not build:\n%s",
+ m->modname, output);
}
}
return NULL;
if (errstr)
return errstr;
- m->compiled[ctype] = build_module(m, false, ctype, &errstr);
+ m->compiled[ctype] = build_module(m, ctype, &errstr);
if (!m->compiled[ctype])
return errstr;
return NULL;
}
static void check_depends_built(struct manifest *m,
- bool keep,
unsigned int *timeleft, struct score *score)
{
- struct manifest *i;
+ struct list_head *list;
- list_for_each(&m->deps, i, list) {
- char *errstr = build_submodule(i, cflags, COMPILE_NORMAL);
+ foreach_ptr(list, &m->deps, &m->test_deps) {
+ struct manifest *i;
+ list_for_each(list, i, list) {
+ char *errstr;
- if (errstr) {
- score->error = talloc_asprintf(score,
+ errstr = build_submodule(i, cflags, COMPILE_NORMAL);
+
+ if (errstr) {
+ score->error = tal_fmt(score,
"Dependency %s"
- " did not build:\n%s",
- i->basename, errstr);
- return;
+ " did not"
+ " build:\n%s",
+ i->modname,
+ errstr);
+ return;
+ }
}
}
.name = "Module's CCAN dependencies can be found or built",
.check = check_depends_built,
.can_run = can_build,
- .needs = "depends_exist"
+ .needs = "depends_exist test_depends_exist info_ported"
};
REGISTER_TEST(depends_build);