depends_build_without_features.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #include <tools/ccanlint/ccanlint.h>
  2. #include <tools/tools.h>
  3. #include <ccan/str/str.h>
  4. #include <ccan/foreach/foreach.h>
  5. #include <sys/types.h>
  6. #include <sys/stat.h>
  7. #include <fcntl.h>
  8. #include <unistd.h>
  9. #include <limits.h>
  10. #include <errno.h>
  11. #include <stdlib.h>
  12. #include <stdio.h>
  13. #include <err.h>
  14. #include <string.h>
  15. #include <ctype.h>
  16. #include "reduce_features.h"
  17. #include "build.h"
  18. static const char *can_build(struct manifest *m UNNEEDED)
  19. {
  20. if (safe_mode)
  21. return "Safe mode enabled";
  22. return NULL;
  23. }
  24. static void check_depends_built_without_features(struct manifest *m,
  25. unsigned int *timeleft UNNEEDED,
  26. struct score *score)
  27. {
  28. struct list_head *list;
  29. struct manifest *i;
  30. char *flags;
  31. flags = tal_fmt(score, "%s %s", cflags, REDUCE_FEATURES_FLAGS);
  32. foreach_ptr(list, &m->deps, &m->test_deps) {
  33. list_for_each(list, i, list) {
  34. char *errstr = build_submodule(i, flags,
  35. COMPILE_NOFEAT);
  36. if (errstr) {
  37. score->error = tal_fmt(score,
  38. "Dependency %s"
  39. " did not build:\n%s",
  40. i->modname,
  41. errstr);
  42. return;
  43. }
  44. }
  45. }
  46. score->pass = true;
  47. score->score = score->total;
  48. }
  49. struct ccanlint depends_build_without_features = {
  50. .key = "depends_build_without_features",
  51. .name = "Module's CCAN dependencies can be found or built (reduced features)",
  52. .check = check_depends_built_without_features,
  53. .can_run = can_build,
  54. .needs = "depends_build reduce_features"
  55. };
  56. REGISTER_TEST(depends_build_without_features);