info_ported.c 972 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include <tools/ccanlint/ccanlint.h>
  2. #include <tools/tools.h>
  3. #include <ccan/str/str.h>
  4. #include <sys/types.h>
  5. #include <sys/stat.h>
  6. #include <fcntl.h>
  7. #include <unistd.h>
  8. #include <limits.h>
  9. #include <errno.h>
  10. #include <stdlib.h>
  11. #include <stdio.h>
  12. #include <err.h>
  13. #include <string.h>
  14. #include <ctype.h>
  15. static const char *can_build(struct manifest *m)
  16. {
  17. char *msg;
  18. /* FIXME: In safe mode, we'd need complex guesstiparsing. */
  19. if (safe_mode)
  20. return NULL;
  21. msg = get_ported(m, m->dir, true, get_or_compile_info);
  22. if (!msg)
  23. return NULL;
  24. return tal_fmt(m, "'_info ported' says '%s'", msg);
  25. }
  26. static void check_info_ported(struct manifest *m,
  27. unsigned int *timeleft, struct score *score)
  28. {
  29. score->pass = true;
  30. score->score = 1;
  31. }
  32. struct ccanlint info_ported = {
  33. .key = "info_ported",
  34. .can_run = can_build,
  35. .name = "_info indicates support for this platform",
  36. .check = check_info_ported,
  37. .needs = "info_compiles"
  38. };
  39. REGISTER_TEST(info_ported);