info_ported.c 999 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 UNNEEDED,
  27. unsigned int *timeleft UNNEEDED,
  28. struct score *score)
  29. {
  30. score->pass = true;
  31. score->score = 1;
  32. }
  33. struct ccanlint info_ported = {
  34. .key = "info_ported",
  35. .can_run = can_build,
  36. .name = "_info indicates support for this platform",
  37. .check = check_info_ported,
  38. .needs = "info_compiles"
  39. };
  40. REGISTER_TEST(info_ported);