depends_build_without_features.c 1.3 KB

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