-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add file locking to support parallel runs. (#427)
* 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 <[email protected]> Co-authored-by: Lars Melchior <[email protected]> Co-authored-by: Borislav Stanimirov <[email protected]>
- Loading branch information
1 parent
d34d2a8
commit 09b056a
Showing
10 changed files
with
60 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require_relative './lib' | ||
|
||
class Parallelism < IntegrationTest | ||
def setup | ||
@cache_dir = File.join(cur_test_dir, 'cpmcache') | ||
ENV['CPM_SOURCE_CACHE'] = @cache_dir | ||
end | ||
|
||
def test_populate_cache_in_parallel | ||
4.times.map { |i| | ||
prj = make_project name: i.to_s, from_template: 'using-fibadder' | ||
prj.create_lists_from_default_template package: 'CPMAddPackage("gh:cpm-cmake/[email protected]")' | ||
prj | ||
}.map { |prj| | ||
Thread.new do | ||
assert_success prj.configure | ||
assert_success prj.build | ||
end | ||
}.map(&:join) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ def setup | |
end | ||
|
||
def test_add_remove_dependency | ||
prj = make_project 'using-fibadder' | ||
prj = make_project from_template: 'using-fibadder' | ||
|
||
################################### | ||
# create | ||
|
@@ -45,7 +45,7 @@ def test_add_remove_dependency | |
end | ||
|
||
def test_second_project | ||
prj = make_project 'using-fibadder' | ||
prj = make_project from_template: 'using-fibadder' | ||
prj.create_lists_from_default_template package: 'CPMAddPackage("gh:cpm-cmake/[email protected]")' | ||
assert_success prj.configure | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters