api-80-tdb_fd.c 801 B

12345678910111213141516171819202122232425262728293031
  1. #include "config.h"
  2. #include "../ntdb.h"
  3. #include "../private.h"
  4. #include "tap-interface.h"
  5. #include "logging.h"
  6. #include "helpapi-external-agent.h"
  7. int main(int argc, char *argv[])
  8. {
  9. unsigned int i;
  10. struct ntdb_context *ntdb;
  11. int flags[] = { NTDB_INTERNAL, NTDB_DEFAULT, NTDB_NOMMAP,
  12. NTDB_INTERNAL|NTDB_CONVERT, NTDB_CONVERT,
  13. NTDB_NOMMAP|NTDB_CONVERT };
  14. plan_tests(sizeof(flags) / sizeof(flags[0]) * 3);
  15. for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
  16. ntdb = ntdb_open("api-80-ntdb_fd.ntdb", flags[i]|MAYBE_NOSYNC,
  17. O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr);
  18. if (!ok1(ntdb))
  19. continue;
  20. if (flags[i] & NTDB_INTERNAL)
  21. ok1(ntdb_fd(ntdb) == -1);
  22. else
  23. ok1(ntdb_fd(ntdb) > 2);
  24. ntdb_close(ntdb);
  25. ok1(tap_log_messages == 0);
  26. }
  27. return exit_status();
  28. }