From 8bbef2865455754425a84b86680a89bff8aa7691 Mon Sep 17 00:00:00 2001 From: gcontini <1121667+gcontini@users.noreply.github.com> Date: 周六, 19 10月 2019 08:50:45 +0800 Subject: [PATCH] issue #64 , issue #56 (part) --- test/functional/volid_test.cpp | 32 ++++++++++++++++++++++---------- 1 files changed, 22 insertions(+), 10 deletions(-) diff --git a/test/functional/volid_test.cpp b/test/functional/volid_test.cpp index f63d2b3..3ab5348 100644 --- a/test/functional/volid_test.cpp +++ b/test/functional/volid_test.cpp @@ -1,6 +1,5 @@ -#define BOOST_TEST_MODULE standard_license_test -//#define BOOST_TEST_MAIN -//#undef BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE test_volid + #include <boost/test/unit_test.hpp> #include <fstream> #include <stdio.h> @@ -36,10 +35,9 @@ LicenseInfo license; LicenseLocation licenseLocation; - licenseLocation.openFileNearModule = false; licenseLocation.licenseFileLocation = licLocation.c_str(); - licenseLocation.environmentVariableName = ""; - const EVENT_TYPE result = acquire_license("TEST", licenseLocation, &license); + licenseLocation.licenseData = ""; + const EVENT_TYPE result = acquire_license("TEST", &licenseLocation, &license); BOOST_CHECK_EQUAL(result, LICENSE_OK); BOOST_CHECK_EQUAL(license.has_expiry, false); BOOST_CHECK_EQUAL(license.linked_to_pc, true); @@ -52,11 +50,11 @@ for (int i = 0; i < num_strategies; i++) { FUNCTION_RETURN generate_ok = generate_user_pc_signature(identifier_out, strategies[i]); - BOOST_ASSERT(generate_ok == FUNC_RET_OK); if (generate_ok != FUNC_RET_OK) { BOOST_ERROR( "Generating identifier for strategy " << strategies[i] << " failed with: " << generate_ok); idfile << "0000-0000-0000-0000" << endl; + BOOST_ASSERT(generate_ok == FUNC_RET_OK); } else idfile << identifier_out << endl; } @@ -66,12 +64,26 @@ BOOST_AUTO_TEST_CASE(generated_identifiers_stability) { const string idfileLocation(PROJECT_TEST_TEMP_DIR "/identifiers_file"); std::vector<IDENTIFICATION_STRATEGY> strategies; - if (getVirtualization() != CONTAINER) { - strategies = { DEFAULT, DISK_LABEL, DISK_NUM, ETHERNET }; + size_t disk_num; + getDiskInfos(NULL, &disk_num); + if (disk_num >0) { + strategies = { DEFAULT, DISK_NUM, DISK_LABEL }; } else { - strategies = { DEFAULT, ETHERNET }; + BOOST_TEST_CHECKPOINT("if no disk default strategy fails see #49"); + //strategies = { DEFAULT }; + strategies = {}; } + size_t adapters; + getAdapterInfos(nullptr, &adapters); + if(adapters > 0){ + strategies.push_back(ETHERNET); + } + int num_strategies = strategies.size(); + if(num_strategies == 0) { + //see issue #49 can't use default + return; + } std::ifstream test_idfile_exist(idfileLocation); if (!test_idfile_exist.good()) { generate_reference_file(idfileLocation, strategies.data(), -- Gitblit v1.9.1