summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-01-18 15:51:04 +0100
committerDavid Robillard <d@drobilla.net>2020-01-18 15:51:04 +0100
commit152589e302a18f8db4e3690341e9e764cd16971c (patch)
treed88f578eb127ebb8e590cd95e4c899e98d5f3fd8 /test
parent807627ebaac9a763255e498c7a91bd556e424bf3 (diff)
downloadlilv-152589e302a18f8db4e3690341e9e764cd16971c.tar.gz
lilv-152589e302a18f8db4e3690341e9e764cd16971c.tar.bz2
lilv-152589e302a18f8db4e3690341e9e764cd16971c.zip
Delete all temporary state bundles saved by the test suite
Diffstat (limited to 'test')
-rw-r--r--test/lilv_test.c44
1 files changed, 35 insertions, 9 deletions
diff --git a/test/lilv_test.c b/test/lilv_test.c
index 8836cda..9d7d42f 100644
--- a/test/lilv_test.c
+++ b/test/lilv_test.c
@@ -1806,14 +1806,19 @@ test_state(void)
scratch_dir, copy_dir, link_dir, "state/fstate.lv2",
get_port_value, world, 0, ffeatures);
- // Get another instance state
- LilvState* fstate2 = lilv_state_new_from_instance(
- plugin, instance, &map,
- scratch_dir, copy_dir, link_dir, "state/fstate2.lv2",
- get_port_value, world, 0, ffeatures);
+ {
+ // Get another instance state
+ LilvState* fstate2 = lilv_state_new_from_instance(
+ plugin, instance, &map,
+ scratch_dir, copy_dir, link_dir, "state/fstate2.lv2",
+ get_port_value, world, 0, ffeatures);
- // Should be identical
- TEST_ASSERT(lilv_state_equals(fstate, fstate2));
+ // Check that it is identical
+ TEST_ASSERT(lilv_state_equals(fstate, fstate2));
+
+ lilv_state_delete(world, fstate2);
+ lilv_state_free(fstate2);
+ }
// Run, writing more to rec file
lilv_instance_run(instance, 2);
@@ -1878,8 +1883,28 @@ test_state(void)
TEST_ASSERT(lilv_state_equals(fstate72, fstate7));
TEST_ASSERT(!lilv_state_equals(fstate6, fstate72));
- // Delete saved state
+ // Delete saved state we still have a state in memory that points to
lilv_state_delete(world, fstate7);
+ lilv_state_delete(world, fstate6);
+ lilv_state_delete(world, fstate5);
+ lilv_state_delete(world, fstate3);
+ lilv_state_delete(world, fstate);
+ lilv_state_delete(world, state2);
+ lilv_state_delete(world, state);
+
+ // Delete remaining states on disk we've lost a reference to
+ const char* const old_state_paths[] = {"state/state.lv2/state.ttl",
+ "state/state.lv2/state2.ttl",
+ "state/fstate.lv2/fstate.ttl",
+ NULL};
+
+ for (const char*const* p = old_state_paths; *p; ++p) {
+ const char* path = *p;
+ LilvState* old_state =
+ lilv_state_new_from_file(world, &map, NULL, path);
+ lilv_state_delete(world, old_state);
+ lilv_state_free(old_state);
+ }
lilv_instance_deactivate(instance);
lilv_instance_free(instance);
@@ -1893,7 +1918,6 @@ test_state(void)
lilv_state_free(state4);
lilv_state_free(state5);
lilv_state_free(fstate);
- lilv_state_free(fstate2);
lilv_state_free(fstate3);
lilv_state_free(fstate4);
lilv_state_free(fstate5);
@@ -1901,6 +1925,8 @@ test_state(void)
lilv_state_free(fstate7);
lilv_state_free(fstate72);
+ rmdir("state");
+
// Free URI map
for (size_t i = 0; i < n_uris; ++i) {
free(uris[i]);