mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-17 14:47:30 -05:00
* Add file locking to support parallel runs.
* Fixed formatting.
* Prevent double locking file.
* Fix SegFault from test 2.
* Remove unnecessary debugging messages.
* Lock the package directory rather than the cache directory.
Only synchronize if CPM_SOURCE_CACHE is defined.
* Lock the version specific cache entry rather than the package specific entry.
* Remove unnecessary arguments in conditional statements.
* Change back to locking entire cache directory.
* Only check CPM_HAS_CACHE_LOCK.
* Lock on a per-package basis rather than the entire cache.
* Clean up the locked file.
* Unlock then remove to fix Windows.
* Specify use of cmake.lock as the lock file.
* - Changed CPM_HAS_CACHE_LOCK to ${CPM_ARGS_NAME}_CPM_HAS_CACHE_LOCK.
- Removed redundant variable initialization.
* Add unit test.
* Actually test if resulting git cache is clean in unit test.
* - Added comments
- Fixed formatting
- Removed unnecessary imports
* convert parallelism test to integration test
* remove comment
* - Removed now unnecessary variable.
- Only delete file instead of unlocking it then deleting it.
* Forgot to change variable name.
* Add similar changes to the missed section.
* Fixed formatting.
* Unlock the file, but do not delete it.
* Only unlock the file if it exists.
* Changed cache.cmake test to ignore non-directory entries.
* Integration test lib make_project:
* keyword args
* 'name' arg to allow multiple projects from the same test
* - Moved checks to function.
- Fixed small grammatical errors.
* - Fix formatting
* Switch to snake case.
---------
Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com>
Co-authored-by: Lars Melchior <lars.melchior@gmail.com>
Co-authored-by: Borislav Stanimirov <b.stanimirov@abv.bg>
57 lines
2.0 KiB
Ruby
57 lines
2.0 KiB
Ruby
require_relative './lib'
|
|
|
|
# Tests of cpm caches and vars when no packages are used
|
|
|
|
class Basics < IntegrationTest
|
|
# Test cpm caches with no cpm-related env vars
|
|
def test_cpm_default
|
|
prj = make_project from_template: 'no-deps'
|
|
prj.create_lists_from_default_template
|
|
assert_success prj.configure
|
|
|
|
@cache = prj.read_cache
|
|
|
|
assert_empty @cache.packages
|
|
|
|
assert_same_path TestLib::CPM_PATH, check_and_get('CPM_FILE')
|
|
assert_same_path File.dirname(TestLib::CPM_PATH), check_and_get('CPM_DIRECTORY')
|
|
|
|
assert_equal 'OFF', check_and_get('CPM_DRY_RUN')
|
|
assert_equal 'CPM:', check_and_get('CPM_INDENT')
|
|
assert_equal '1.0.0-development-version', check_and_get('CPM_VERSION')
|
|
|
|
assert_equal 'OFF', check_and_get('CPM_SOURCE_CACHE', 'PATH')
|
|
assert_equal 'OFF', check_and_get('CPM_DOWNLOAD_ALL', 'BOOL')
|
|
assert_equal 'OFF', check_and_get('CPM_LOCAL_PACKAGES_ONLY', 'BOOL')
|
|
assert_equal 'OFF', check_and_get('CPM_USE_LOCAL_PACKAGES', 'BOOL')
|
|
assert_equal 'OFF', check_and_get('CPM_USE_NAMED_CACHE_DIRECTORIES', 'BOOL')
|
|
|
|
assert_equal 'OFF', check_and_get('CPM_DONT_CREATE_PACKAGE_LOCK', 'BOOL')
|
|
assert_equal 'OFF', check_and_get('CPM_INCLUDE_ALL_IN_PACKAGE_LOCK', 'BOOL')
|
|
assert_same_path File.join(prj.bin_dir, 'cpm-package-lock.cmake'), check_and_get('CPM_PACKAGE_LOCK_FILE')
|
|
|
|
assert_equal 'OFF', check_and_get('CPM_DONT_UPDATE_MODULE_PATH', 'BOOL')
|
|
assert_same_path File.join(prj.bin_dir, 'CPM_modules'), check_and_get('CPM_MODULE_PATH')
|
|
end
|
|
|
|
# Test when env CPM_SOURCE_CACHE is set
|
|
def test_env_cpm_source_cache
|
|
ENV['CPM_SOURCE_CACHE'] = cur_test_dir
|
|
|
|
prj = make_project from_template: 'no-deps'
|
|
prj.create_lists_from_default_template
|
|
assert_success prj.configure
|
|
|
|
@cache = prj.read_cache
|
|
|
|
assert_equal cur_test_dir, check_and_get('CPM_SOURCE_CACHE', 'PATH')
|
|
end
|
|
|
|
def check_and_get(key, type = 'INTERNAL')
|
|
e = @cache.entries[key]
|
|
assert_not_nil e, key
|
|
assert_equal type, e.type, key
|
|
e.val
|
|
end
|
|
end
|