| 18667 | } |
| 18668 | |
| 18669 | static bool compare_graphs_fixture_open(compare_graphs_fixture_t *fixture) { |
| 18670 | memset(fixture, 0, sizeof(*fixture)); |
| 18671 | snprintf(fixture->cache, sizeof(fixture->cache), "%s/cbm-compare-525-XXXXXX", cbm_tmpdir()); |
| 18672 | if (!cbm_mkdtemp(fixture->cache)) { |
| 18673 | return false; |
| 18674 | } |
| 18675 | const char *saved = getenv("CBM_CACHE_DIR"); |
| 18676 | fixture->saved_cache = saved ? strdup(saved) : NULL; |
| 18677 | if ((saved && !fixture->saved_cache) || cbm_setenv("CBM_CACHE_DIR", fixture->cache, 1) != 0) { |
| 18678 | free(fixture->saved_cache); |
| 18679 | fixture->saved_cache = NULL; |
| 18680 | (void)th_rmtree(fixture->cache); |
| 18681 | return false; |
| 18682 | } |
| 18683 | snprintf(fixture->base_path, sizeof(fixture->base_path), "%s/base525.db", fixture->cache); |
| 18684 | snprintf(fixture->target_path, sizeof(fixture->target_path), "%s/target525.db", fixture->cache); |
| 18685 | if (!compare_write_fixture_store(fixture->base_path, "base525", false) || |
| 18686 | !compare_write_fixture_store(fixture->target_path, "target525", true)) { |
| 18687 | restore_cache_dir(fixture->saved_cache); |
| 18688 | free(fixture->saved_cache); |
| 18689 | fixture->saved_cache = NULL; |
| 18690 | (void)th_rmtree(fixture->cache); |
| 18691 | return false; |
| 18692 | } |
| 18693 | return true; |
| 18694 | } |
| 18695 | |
| 18696 | static bool compare_graphs_fixture_close(compare_graphs_fixture_t *fixture) { |
| 18697 | restore_cache_dir(fixture->saved_cache); |
no test coverage detected