Skip to content

Commit 6562b14

Browse files
committed
Tools: Make bootstrap return -1 on error
This has been covering multiple issues as the CI was not failing as it should have been
1 parent 81bc923 commit 6562b14

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

Libraries/Http/HttpServer.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ struct SC_COMPILER_EXPORT HttpServer
143143
/// @param loop The event loop to be used, where to add the listening socket
144144
/// @param address The address of local interface where to listen to
145145
/// @param port The local port where to start listening to
146+
/// @param memory Memory buffers to be used by the http server
146147
/// @return Valid Result if http listening has been started successfully
147148
Result start(AsyncEventLoop& loop, StringSpan address, uint16_t port, Memory& memory);
148149

@@ -182,6 +183,6 @@ struct SC_COMPILER_EXPORT HttpServer
182183

183184
AsyncEventLoop* eventLoop = nullptr;
184185
};
185-
} // namespace SC
186-
187186
//! @}
187+
188+
} // namespace SC

Tests/Libraries/Http/HttpServerTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ void SC::HttpServerTest::httpServerTest()
4646
if (request.getParser().method != HttpParser::Method::HttpGET)
4747
{
4848
SC_TEST_EXPECT(response.startResponse(405));
49-
SC_TEST_EXPECT(response.end(""));
49+
SC_TEST_EXPECT(response.end());
5050
return;
5151
}
5252
if (request.getURL() != "/index.html" and request.getURL() != "/")
5353
{
5454
SC_TEST_EXPECT(response.startResponse(404));
55-
SC_TEST_EXPECT(response.end(""));
55+
SC_TEST_EXPECT(response.end());
5656
return;
5757
}
5858
serverContext.numRequests++;

Tools/SC-build/Build.inl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,13 +334,13 @@ bool SC::Build::Definition::findConfiguration(StringView workspaceName, StringVi
334334
StringView configurationName, Workspace*& workspace, Project*& project,
335335
Configuration*& configuration)
336336
{
337-
size_t workspaceIdx;
337+
size_t workspaceIdx = 0;
338338
SC_TRY(workspaces.find([&](auto& it) { return it.name == workspaceName; }, &workspaceIdx));
339-
workspace = &workspaces[workspaceIdx];
340-
size_t projectIdx;
339+
workspace = &workspaces[workspaceIdx];
340+
size_t projectIdx = 0;
341341
SC_TRY(workspace->projects.find([&](auto& it) { return it.name == projectName; }, &projectIdx));
342-
project = &workspace->projects[projectIdx];
343-
size_t configurationIdx;
342+
project = &workspace->projects[projectIdx];
343+
size_t configurationIdx = 0;
344344
SC_TRY(project->configurations.find([&](auto& it) { return it.name == configurationName; }, &configurationIdx));
345345
configuration = &project->configurations[configurationIdx];
346346
return true;

Tools/ToolsBootstrap.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1368,10 +1368,18 @@ int main(int argc, char* argv[]) {
13681368
}
13691369

13701370
int ret = executeTool(&args, &ci);
1371+
if(ret != 0)
1372+
{
1373+
fprintf(stderr, "Tool \"%s\" execution failed with code %d\n", args.toolName, ret);
1374+
}
1375+
else
1376+
{
1377+
printf("Tool \"%s\" executed successfully\n", args.toolName);
1378+
}
13711379
CompilationInfo_destroy(&ci);
13721380
BootloaderArgs_destroy(&args);
13731381
freeArgs(new_argc, new_argv);
1374-
return ret;
1382+
return ret == 0 ? 0 : -1;
13751383
}
13761384

13771385
int compileWindows(CompilationInfo* ci, int* objsCompiled) {

0 commit comments

Comments
 (0)