aboutsummaryrefslogtreecommitdiff
path: root/zenserver/testing/launch.cpp
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2021-12-14 12:34:47 +0100
committerPer Larsson <[email protected]>2021-12-14 12:34:47 +0100
commitb6c6568e1618f10d2160d836b65e35586e3c740f (patch)
treef6a929cf918850bbba87d0ee67cd3482b2d50e24 /zenserver/testing/launch.cpp
parentFixed bug in z$ service returning partial cache records and enable small obje... (diff)
parentPartial revert b363c5b (diff)
downloadzen-b6c6568e1618f10d2160d836b65e35586e3c740f.tar.xz
zen-b6c6568e1618f10d2160d836b65e35586e3c740f.zip
Merged main.
Diffstat (limited to 'zenserver/testing/launch.cpp')
-rw-r--r--zenserver/testing/launch.cpp65
1 files changed, 43 insertions, 22 deletions
diff --git a/zenserver/testing/launch.cpp b/zenserver/testing/launch.cpp
index 55695ac9c..706594b10 100644
--- a/zenserver/testing/launch.cpp
+++ b/zenserver/testing/launch.cpp
@@ -2,26 +2,29 @@
#include "launch.h"
-#include <zencore/compactbinary.h>
-#include <zencore/compactbinarybuilder.h>
-#include <zencore/filesystem.h>
-#include <zencore/fmtutils.h>
-#include <zencore/iobuffer.h>
-#include <zencore/iohash.h>
-#include <zencore/logging.h>
-#include <zencore/windows.h>
-#include <zenstore/CAS.h>
-
-#include <AccCtrl.h>
-#include <AclAPI.h>
-#include <sddl.h>
-
-#include <UserEnv.h>
-#pragma comment(lib, "UserEnv.lib")
-
-#include <atlbase.h>
-#include <filesystem>
-#include <span>
+#if ZEN_WITH_COMPUTE_SERVICES
+
+# include <zencore/compactbinary.h>
+# include <zencore/compactbinarybuilder.h>
+# include <zencore/filesystem.h>
+# include <zencore/fmtutils.h>
+# include <zencore/iobuffer.h>
+# include <zencore/iohash.h>
+# include <zencore/logging.h>
+# include <zencore/windows.h>
+# include <zenstore/cas.h>
+
+ZEN_THIRD_PARTY_INCLUDES_START
+# include <AccCtrl.h>
+# include <AclAPI.h>
+# include <UserEnv.h>
+# include <atlbase.h>
+# include <sddl.h>
+ZEN_THIRD_PARTY_INCLUDES_END
+# pragma comment(lib, "UserEnv.lib")
+
+# include <filesystem>
+# include <span>
using namespace std::literals;
@@ -127,6 +130,8 @@ BasicJob::ExitCode()
return gsl::narrow_cast<int>(Ec);
}
+////////////////////////////////////////////////////////////////////////////////
+
struct SandboxedJob
{
SandboxedJob() = default;
@@ -317,6 +322,8 @@ SandboxedJob::SpawnJob(std::filesystem::path ExePath)
return true;
}
+////////////////////////////////////////////////////////////////////////////////
+
HttpLaunchService::HttpLaunchService(CasStore& Store, const std::filesystem::path& SandboxBaseDir)
: m_Log(logging::Get("exec"))
, m_CasStore(Store)
@@ -336,13 +343,16 @@ HttpLaunchService::HttpLaunchService(CasStore& Store, const std::filesystem::pat
case HttpVerb::kPost:
break;
+
+ default:
+ break;
}
},
HttpVerb::kGet | HttpVerb::kPost);
// Experimental
-#if 0
+# if 0
m_Router.RegisterRoute(
"jobs/sandbox",
[this](HttpRouterRequest& Req) {
@@ -362,10 +372,13 @@ HttpLaunchService::HttpLaunchService(CasStore& Store, const std::filesystem::pat
Job.SpawnJob("c:\\windows\\system32\\cmd.exe");
}
break;
+
+ default:
+ break;
}
},
HttpVerb::kGet | HttpVerb::kPost);
-#endif
+# endif
m_Router.RegisterRoute(
"jobs/prep",
@@ -413,6 +426,9 @@ HttpLaunchService::HttpLaunchService(CasStore& Store, const std::filesystem::pat
return HttpReq.WriteResponse(HttpResponseCode::OK, Response);
}
break;
+
+ default:
+ break;
}
},
HttpVerb::kPost);
@@ -496,6 +512,9 @@ HttpLaunchService::HttpLaunchService(CasStore& Store, const std::filesystem::pat
return HttpReq.WriteResponse(HttpResponseCode::OK, Response.Save());
}
break;
+
+ default:
+ break;
}
},
HttpVerb::kGet | HttpVerb::kPost);
@@ -530,3 +549,5 @@ HttpLaunchService::CreateNewSandbox()
}
} // namespace zen
+
+#endif // ZEN_WITH_COMPUTE_SERVICES