Example #1
0
        private void UpdateActiveConfiguration(object sender, ElapsedEventArgs elapsedEventArgs)
        {
            if (!this._ctestAdapterEnabled)
            {
                return;
            }
            // set current active configuration
            var p = this._dte.Solution.SolutionBuild;

            if (null == p)
            {
                return;
            }
            var sc = p.ActiveConfiguration;

            if (null == sc)
            {
                return;
            }
            var name = sc.Name;

            if (this._config.ActiveConfiguration == name)
            {
                return;
            }
            this._config.ActiveConfiguration = name;
            CTestAdapterConfig.WriteToDisk(this._config);
            this._containerManager.FindTestContainers();
        }
Example #2
0
        private void OnCMakeCacheChanged()
        {
            var cacheFileName =
                Path.Combine(this._cMakeCacheWatcher.CMakeCacheDirectory, this._cMakeCacheWatcher.CMakeCacheFile);
            var testFileName =
                Path.Combine(this._cMakeCacheWatcher.CMakeCacheDirectory, Constants.CTestTestFileName);

            this._cmakeCache.LoadCMakeCache(cacheFileName);
            var enabled = true;

            if (!this._cmakeCache.IsLoaded)
            {
                this.Log(LogLevel.Warning, "OnCMakeCacheChanged (cache not loaded)");
                enabled = false;
            }
            if (!File.Exists(testFileName))
            {
                this.Log(LogLevel.Warning, "OnCMakeCacheChanged file not found: " + testFileName);
                enabled = false;
            }
            if (this._cmakeCache[Constants.CMakeCacheKey_CTestCommand] == string.Empty)
            {
                this.Log(LogLevel.Warning, "OnCMakeCacheChanged ctest not found in cache");
                enabled = false;
            }
            var ctest = this._cmakeCache[Constants.CMakeCacheKey_CTestCommand];

            if (!File.Exists(ctest))
            {
                this.Log(LogLevel.Warning, "OnCMakeCacheChanged ctest executable not found: " + ctest);
                enabled = false;
            }
            this._config.CTestExecutable         = ctest;
            this._config.CMakeConfigurationTypes = this._cmakeCache[Constants.CMakeCacheKey_CofigurationTypes];
            CTestAdapterConfig.WriteToDisk(this._config);
            if (this._ctestAdapterEnabled != enabled)
            {
                this.CTestAdapterEnabled = enabled;
            }
            this._containerManager.FindTestContainers();
        }