| 757 | } ui_delete_fixture_t; |
| 758 | |
| 759 | static int ui_delete_fixture_init(ui_delete_fixture_t *fx) { |
| 760 | memset(fx, 0, sizeof(*fx)); |
| 761 | char *tmp = th_mktempdir("cbm_httpd_delete"); |
| 762 | if (!tmp) |
| 763 | return -1; |
| 764 | snprintf(fx->tmpdir, sizeof(fx->tmpdir), "%s", tmp); |
| 765 | snprintf(fx->cache_dir, sizeof(fx->cache_dir), "%s/cache", fx->tmpdir); |
| 766 | snprintf(fx->root_dir, sizeof(fx->root_dir), "%s/root", fx->tmpdir); |
| 767 | |
| 768 | const char *saved = getenv("CBM_CACHE_DIR"); |
| 769 | fx->saved_cache_dir = saved ? strdup(saved) : NULL; |
| 770 | if (th_mkdir_p(fx->cache_dir) != 0 || th_mkdir_p(fx->root_dir) != 0) { |
| 771 | return -1; |
| 772 | } |
| 773 | cbm_setenv("CBM_CACHE_DIR", fx->cache_dir, 1); |
| 774 | |
| 775 | fx->store = cbm_store_open_memory(); |
| 776 | fx->watcher = cbm_watcher_new(fx->store, NULL, NULL); |
| 777 | return fx->store && fx->watcher ? 0 : -1; |
| 778 | } |
| 779 | |
| 780 | static void ui_delete_fixture_cleanup(ui_delete_fixture_t *fx) { |
| 781 | if (fx->watcher) |
no test coverage detected