info_ported.c 936 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. /* FIXME: In safe mode, we'd need complex guesstiparsing. */
  18. if (safe_mode)
  19. return NULL;
  20. if (get_ported(m, m->dir, true, get_or_compile_info))
  21. return NULL;
  22. return "'_info ported' says not supported";
  23. }
  24. static void check_info_ported(struct manifest *m,
  25. unsigned int *timeleft, struct score *score)
  26. {
  27. score->pass = true;
  28. score->score = 1;
  29. }
  30. struct ccanlint info_ported = {
  31. .key = "info_ported",
  32. .can_run = can_build,
  33. .name = "_info indicates support for this platform",
  34. .check = check_info_ported,
  35. .needs = "info_exists"
  36. };
  37. REGISTER_TEST(info_ported);