Skip to content

Commit 50f6258

Browse files
committed
test
1 parent adfc794 commit 50f6258

4 files changed

Lines changed: 35 additions & 5 deletions

File tree

build.ps1

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,35 @@ Info "Build project"
7979
$root/DOpusScriptingExtensions.sln
8080
CheckReturnCodeOfPreviousCommand "build failed"
8181

82+
Info "Run unit tests"
83+
& "$buildDir/x64/Release/UnitTest.exe"
84+
CheckReturnCodeOfPreviousCommand "unit tests failed"
85+
86+
Info "Uninstall the existing DOpusScriptingExtensions"
87+
Info "Search if DOpusScriptingExtensions is installed"
88+
$app = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -match "DOpusScriptingExtensions" }
89+
if ($app) {
90+
Info "Uninstall existing DOpusScriptingExtensions installation"
91+
$app.Uninstall()
92+
}
93+
94+
$installerPath = Resolve-Path "$buildDir/x64/Release/Installer.msi"
95+
Info "Install $installerPath"
96+
$msiexecProcess = Start-Process -FilePath "msiexec.exe" `
97+
-ArgumentList @("/i", $installerPath,
98+
"/norestart",
99+
"/L*v", "$buildDir/Installer.log") `
100+
-Wait `
101+
-PassThru
102+
if ($msiexecProcess.ExitCode -ne 0) {
103+
Error "installation failed"
104+
}
105+
82106
Info "Run tests"
83107
cscript $root/src/test/test.js
84108
CheckReturnCodeOfPreviousCommand "tests failed"
85109

86110
Info "Copy installer to the Publish directory and create zip archive"
87111
New-Item -Force -ItemType "directory" $buildDir/Publish > $null
88-
Copy-Item -Force -Path $buildDir/x64/Release/Installer/Installer.msi -Destination $buildDir/Publish/DOpusScriptingExtensions.msi > $null
112+
Copy-Item -Force -Path $buildDir/x64/Release/Installer.msi -Destination $buildDir/Publish/DOpusScriptingExtensions.msi > $null
89113
Compress-Archive -Force -Path $buildDir/Publish/DOpusScriptingExtensions.msi -DestinationPath $buildDir/Publish/DOpusScriptingExtensions.msi.zip

src/DOpusScriptingExtensions/FileLockingInfoProvider/LockedFilesDatabase.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,16 @@ class LockedFilesDatabase final : private boost::noncopyable {
9292
}
9393
}
9494
catch (const std::exception&) {
95-
/* ignore the exception and exit the thread */
95+
9696
}
9797
}
9898

9999
// Examples:
100100
// * "C:\Test\File.txt" -> "c:\test\file.txt"
101+
// * "C:/Test/File.txt" -> "c:\test\file.txt"
101102
// * "C:\Test\Directory" -> "c:\test\directory\"
103+
// * "C:\Test\Directory\\" -> "c:\test\directory\"
104+
// * "C:\Test\Directory\" -> "c:\test\directory\"
102105
static void NormalizeFilePath(std::wstring& path) {
103106
path = std::filesystem::canonical(path);
104107
if (std::filesystem::is_directory(path) && !path.ends_with(L'\\')) {

src/ProcessHandlesService/main.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static void WINAPI ServiceMain(const DWORD /* argc */, LPWSTR* /* argv */) {
3434

3535
SetState(serviceStatusHandle, SERVICE_RUNNING);
3636

37-
SPDLOG_INFO("ServiceMain wait for stop");
37+
SPDLOG_INFO("ServiceMain waiting for stop signal");
3838
g_stopEvent.WaitForNotification();
3939

4040
SPDLOG_INFO("ServiceMain stop signal received");
@@ -49,13 +49,15 @@ int main() {
4949
/* max_files */ 2));
5050
spdlog::flush_every(std::chrono::seconds(2));
5151

52+
SPDLOG_INFO("Initialize ProcessHandlesServiceGrpcImpl");
53+
ProcessHandlesServiceGrpcImpl processHandlesServiceGrpc;
5254
SPDLOG_INFO("Start GRPC server on port 43786");
55+
std::unique_ptr<grpc::Server> grpcServer;
5356
try {
5457
grpc::ServerBuilder builder;
55-
ProcessHandlesServiceGrpcImpl processHandlesServiceGrpc;
5658
builder.AddListeningPort("127.0.0.1:43786", grpc::InsecureServerCredentials());
5759
builder.RegisterService(&processHandlesServiceGrpc);
58-
const auto grpcServer = builder.BuildAndStart();
60+
grpcServer = builder.BuildAndStart();
5961
SPDLOG_INFO("GRPC server started");
6062
} catch (const std::exception& ex) {
6163
SPDLOG_ERROR("Failed to start GRPC server: {}", ex.what());
@@ -66,6 +68,7 @@ int main() {
6668
{ nullptr, nullptr } };
6769

6870
if (!StartServiceCtrlDispatcherW(table)) {
71+
SPDLOG_INFO("Failed to call StartServiceCtrlDispatcherW");
6972
return static_cast<int>(GetLastError());
7073
}
7174

src/Test/test.js

4.54 KB
Binary file not shown.

0 commit comments

Comments
 (0)