depends_build_without_features.c 1.5 KB

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