depends_build_without_features.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #include <tools/ccanlint/ccanlint.h>
  2. #include <tools/tools.h>
  3. #include <ccan/talloc/talloc.h>
  4. #include <ccan/str/str.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)
  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,
  26. struct score *score)
  27. {
  28. struct manifest *i;
  29. char *flags;
  30. flags = talloc_asprintf(score, "%s %s", cflags,
  31. REDUCE_FEATURES_FLAGS);
  32. list_for_each(&m->deps, i, list) {
  33. char *errstr = build_submodule(i, flags, COMPILE_NOFEAT);
  34. if (errstr) {
  35. score->error = talloc_asprintf(score,
  36. "Dependency %s"
  37. " did not build:\n%s",
  38. i->basename, errstr);
  39. return;
  40. }
  41. }
  42. score->pass = true;
  43. score->score = score->total;
  44. }
  45. struct ccanlint depends_build_without_features = {
  46. .key = "depends_build_without_features",
  47. .name = "Module's CCAN dependencies can be found or built (reduced features)",
  48. .check = check_depends_built_without_features,
  49. .can_run = can_build,
  50. .needs = "depends_build reduce_features"
  51. };
  52. REGISTER_TEST(depends_build_without_features);