depends_build_without_features.c 1.4 KB

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