From a0d0bd1dbbca38be23624fd0fc18c9f3ac594705 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Thu, 26 Jan 2012 17:47:13 +0100 Subject: [PATCH] Fix ImagePoolTest::persistence test --- src/image/test/ImagePoolTest.cc | 37 +++++++++++---------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/src/image/test/ImagePoolTest.cc b/src/image/test/ImagePoolTest.cc index 5e56e25485..8015f15cac 100644 --- a/src/image/test/ImagePoolTest.cc +++ b/src/image/test/ImagePoolTest.cc @@ -145,8 +145,7 @@ class ImagePoolTest : public PoolTest CPPUNIT_TEST ( wrong_templates ); CPPUNIT_TEST ( target_generation ); CPPUNIT_TEST ( bus_source_assignment ); -// CPPUNIT_TEST ( public_attribute ); -// CPPUNIT_TEST ( persistence ); + CPPUNIT_TEST ( persistence ); CPPUNIT_TEST ( imagepool_disk_attribute ); CPPUNIT_TEST ( dump ); CPPUNIT_TEST ( dump_where ); @@ -659,7 +658,7 @@ public: /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ -/* + void persistence() { int oid; @@ -672,44 +671,32 @@ public: { "NAME = \"Image 1\"\n" "PERSISTENT = NO\n" - "PUBLIC = NO\n" "PATH = /dev/null\n", "NAME = \"Image 2\"\n" "PERSISTENT = NO\n" - "PUBLIC = YES\n" "PATH = /dev/null\n", "NAME = \"Image 3\"\n" "PERSISTENT = YES\n" - "PUBLIC = NO\n" - "PATH = /dev/null\n", - - "NAME = \"Image 4\"\n" - "PERSISTENT = YES\n" - "PUBLIC = YES\n" "PATH = /dev/null\n", "END" }; - bool results[] = { true, true, true, false }; bool persistent[] = { false, false, true }; int i = 0; while( templates[i] != "END" ) { imp->allocate(0, templates[i], &oid); -//cout << endl << i << " : exp. " << results[i] << " got " << (oid >= 0); - CPPUNIT_ASSERT( (oid >= 0) == results[i] ); - if( oid >= 0 ) - { - img = imp->get( oid, false ); - CPPUNIT_ASSERT( img != 0 ); + CPPUNIT_ASSERT( oid >= 0 ); - CPPUNIT_ASSERT( img->isPersistent() == persistent[i] ); - } + img = imp->get( oid, false ); + CPPUNIT_ASSERT( img != 0 ); + + CPPUNIT_ASSERT( img->isPersistent() == persistent[i] ); i++; } @@ -724,12 +711,12 @@ public: CPPUNIT_ASSERT( img->isPersistent() == true ); // it isn't public, try to unpublish - success = img->publish(false); + success = img->set_permissions(1,1,0, 0,0,0, 0,0,0, error_msg); CPPUNIT_ASSERT( success == 0 ); CPPUNIT_ASSERT( img->isPublic() == false ); // try to publish, should fail because it is persistent - success = img->publish(true); + success = img->set_permissions(1,1,0, 1,0,0, 0,0,0, error_msg); CPPUNIT_ASSERT( success == -1 ); CPPUNIT_ASSERT( img->isPublic() == false ); @@ -740,16 +727,16 @@ public: CPPUNIT_ASSERT( img->isPersistent() == false ); // it isn't public, try to unpublish - success = img->publish(false); + success = img->set_permissions(1,1,0, 0,0,0, 0,0,0, error_msg); CPPUNIT_ASSERT( success == 0 ); CPPUNIT_ASSERT( img->isPublic() == false ); // try to publish, now it should be possible - success = img->publish(true); + success = img->set_permissions(1,1,0, 1,0,0, 0,0,0, error_msg); CPPUNIT_ASSERT( success == 0 ); CPPUNIT_ASSERT( img->isPublic() == true ); } -*/ + /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */