Skip to content

Commit

Permalink
CTest controller is updated on reconfig (related to issue microsoft#212
Browse files Browse the repository at this point in the history
…).

src/cmake-tools.ts
==================
* CMakeTools.configure now executes CTestDriver.reloadTests

src/driver.ts
=============
* new function CMakeDriver.testfilePath
	Returns the path to CTestTestfile.cmake in the build directory
* CMakeDriver._cleanPriorConfiguration
	Added the removal of CTestTestfile.cmake from the build directory.
  • Loading branch information
TheZogoth committed Jan 15, 2019
1 parent 5f7bca6 commit 65b797d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/cmake-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI {
if (retc === 0) {
await this._refreshCompileDatabase(drv.expansionOptions);
}
await this._ctestController.reloadTests(drv);
this._onReconfiguredEmitter.fire();
return retc;
} finally {
Expand Down
14 changes: 14 additions & 0 deletions src/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ export abstract class CMakeDriver implements vscode.Disposable {
protected async _cleanPriorConfiguration() {
const build_dir = this.binaryDir;
const cache = this.cachePath;
const test_file = this.testFilePath;
const cmake_files = path.join(build_dir, 'CMakeFiles');
if (await fs.exists(cache)) {
log.info('Removing ', cache);
Expand All @@ -281,6 +282,10 @@ export abstract class CMakeDriver implements vscode.Disposable {
log.info('Removing ', cmake_files);
await fs.rmdir(cmake_files);
}
if (await fs.exists(test_file)) {
log.info('Removing ', test_file);
await fs.unlink(test_file);
}
}

/**
Expand Down Expand Up @@ -411,6 +416,15 @@ export abstract class CMakeDriver implements vscode.Disposable {
return util.lightNormalizePath(file);
}

/**
* @brief Get the path to the CTestTestfile.cmake file in the build directory
*/
get testFilePath(): string {
// TODO: Test file path can change if build dir changes at runtime.
const file = path.join(this.binaryDir, 'CTestTestfile.cmake');
return util.lightNormalizePath(file);
}

/**
* Get the current build type, according to the current selected variant.
*
Expand Down

0 comments on commit 65b797d

Please sign in to comment.