mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
Address compiler and test failures
This commit is contained in:
parent
39eb3a90ea
commit
dcde103c26
1
.github/workflows/linux-workflow.yaml
vendored
1
.github/workflows/linux-workflow.yaml
vendored
|
@ -20,6 +20,7 @@ jobs:
|
||||||
make -j
|
make -j
|
||||||
- name: Test Project with gTest
|
- name: Test Project with gTest
|
||||||
run: ./test.sh
|
run: ./test.sh
|
||||||
|
timeout-minutes: 5
|
||||||
- name: Check Clang-Formatting
|
- name: Check Clang-Formatting
|
||||||
run: |
|
run: |
|
||||||
chmod +x ./third-party/run-clang-format/run-clang-format.py
|
chmod +x ./third-party/run-clang-format/run-clang-format.py
|
||||||
|
|
|
@ -110,7 +110,9 @@ void ClearPending() {
|
||||||
void SendAck() {
|
void SendAck() {
|
||||||
if (MasterDebug) {
|
if (MasterDebug) {
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
SendFromBufferD(u16(ListenerMessageKind::MSG_ACK), protoBlock.msg_id, AckBufArea + sizeof(GoalMessageHeader), strlen(AckBufArea + sizeof(GoalMessageHeader)));
|
SendFromBufferD(u16(ListenerMessageKind::MSG_ACK), protoBlock.msg_id,
|
||||||
|
AckBufArea + sizeof(GoalMessageHeader),
|
||||||
|
strlen(AckBufArea + sizeof(GoalMessageHeader)));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <third-party/mman/mman.h>
|
#include <third-party/mman/mman.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "runtime.h"
|
#include "runtime.h"
|
||||||
|
@ -55,18 +56,18 @@ namespace {
|
||||||
* SystemThread function for running the DECI2 communication with the GOAL compiler.
|
* SystemThread function for running the DECI2 communication with the GOAL compiler.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void deci2_runner(SystemThreadInterface& interfaces) {
|
void deci2_runner(SystemThreadInterface& iface) {
|
||||||
// TODO-WINDOWS
|
// TODO-WINDOWS
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
// callback function so the server knows when to give up and shutdown
|
// callback function so the server knows when to give up and shutdown
|
||||||
std::function<bool()> shutdown_callback = [&]() { return interface.get_want_exit(); };
|
std::function<bool()> shutdown_callback = [&]() { return iface.get_want_exit(); };
|
||||||
|
|
||||||
// create and register server
|
// create and register server
|
||||||
Deci2Server server(shutdown_callback);
|
Deci2Server server(shutdown_callback);
|
||||||
ee::LIBRARY_sceDeci2_register(&server);
|
ee::LIBRARY_sceDeci2_register(&server);
|
||||||
|
|
||||||
// now its ok to continue with initialization
|
// now its ok to continue with initialization
|
||||||
interface.initialization_complete();
|
iface.initialization_complete();
|
||||||
|
|
||||||
// in our own thread, wait for the EE to register the first protocol driver
|
// in our own thread, wait for the EE to register the first protocol driver
|
||||||
printf("[DECI2] waiting for EE to register protos\n");
|
printf("[DECI2] waiting for EE to register protos\n");
|
||||||
|
@ -78,7 +79,7 @@ void deci2_runner(SystemThreadInterface& interfaces) {
|
||||||
|
|
||||||
printf("[DECI2] waiting for listener...\n");
|
printf("[DECI2] waiting for listener...\n");
|
||||||
bool saw_listener = false;
|
bool saw_listener = false;
|
||||||
while (!interface.get_want_exit()) {
|
while (!iface.get_want_exit()) {
|
||||||
if (server.check_for_listener()) {
|
if (server.check_for_listener()) {
|
||||||
if (!saw_listener) {
|
if (!saw_listener) {
|
||||||
printf("[DECI2] Connected!\n");
|
printf("[DECI2] Connected!\n");
|
||||||
|
|
|
@ -7,12 +7,10 @@
|
||||||
// TODO-WINDOWS
|
// TODO-WINDOWS
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <cstdio>
|
|
||||||
#include <Winsock2.h>
|
|
||||||
#include <io.h>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
@ -20,8 +18,6 @@
|
||||||
#include "common/versions.h"
|
#include "common/versions.h"
|
||||||
#include "Deci2Server.h"
|
#include "Deci2Server.h"
|
||||||
|
|
||||||
typedef int socklen_t;
|
|
||||||
|
|
||||||
Deci2Server::Deci2Server(std::function<bool()> shutdown_callback) {
|
Deci2Server::Deci2Server(std::function<bool()> shutdown_callback) {
|
||||||
buffer = new char[BUFFER_SIZE];
|
buffer = new char[BUFFER_SIZE];
|
||||||
want_exit = std::move(shutdown_callback);
|
want_exit = std::move(shutdown_callback);
|
||||||
|
@ -56,7 +52,7 @@ bool Deci2Server::init() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char opt = 1;
|
int opt = 1;
|
||||||
if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &opt, sizeof(opt))) {
|
if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &opt, sizeof(opt))) {
|
||||||
printf("[Deci2Server] Failed to setsockopt 1\n");
|
printf("[Deci2Server] Failed to setsockopt 1\n");
|
||||||
close(server_fd);
|
close(server_fd);
|
||||||
|
@ -64,7 +60,7 @@ bool Deci2Server::init() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char one = 1;
|
int one = 1;
|
||||||
if (setsockopt(server_fd, SOL_TCP, TCP_NODELAY, &one, sizeof(one))) {
|
if (setsockopt(server_fd, SOL_TCP, TCP_NODELAY, &one, sizeof(one))) {
|
||||||
printf("[Deci2Server] Failed to setsockopt 2\n");
|
printf("[Deci2Server] Failed to setsockopt 2\n");
|
||||||
close(server_fd);
|
close(server_fd);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#ifndef JAK1_DECI2SERVER_H
|
#ifndef JAK1_DECI2SERVER_H
|
||||||
#define JAK1_DECI2SERVER_H
|
#define JAK1_DECI2SERVER_H
|
||||||
|
|
||||||
#include <Winsock2.h>
|
#include <netinet/in.h>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
|
|
|
@ -99,7 +99,6 @@ void SystemThread::start(std::function<void(SystemThreadInterface&)> f) {
|
||||||
* Join a system thread
|
* Join a system thread
|
||||||
*/
|
*/
|
||||||
void SystemThread::join() {
|
void SystemThread::join() {
|
||||||
void* x;
|
|
||||||
thread.join();
|
thread.join();
|
||||||
running = false;
|
running = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <thread>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
|
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
|
||||||
constexpr int MAX_SYSTEM_THREADS = 16;
|
constexpr int MAX_SYSTEM_THREADS = 16;
|
||||||
|
|
|
@ -66,9 +66,7 @@ void TextStream::seek_past_whitespace_and_comments() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Reader::~Reader() {
|
Reader::~Reader() {}
|
||||||
printf("destroying reader\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
Reader::Reader() {
|
Reader::Reader() {
|
||||||
// third-party library used for a fancy line in
|
// third-party library used for a fancy line in
|
||||||
|
@ -634,7 +632,6 @@ bool Reader::try_token_as_hex(const Token& tok, Object& obj) {
|
||||||
* 64-bit signed. Won't accept values between INT64_MAX and UINT64_MAX.
|
* 64-bit signed. Won't accept values between INT64_MAX and UINT64_MAX.
|
||||||
*/
|
*/
|
||||||
bool Reader::try_token_as_integer(const Token& tok, Object& obj) {
|
bool Reader::try_token_as_integer(const Token& tok, Object& obj) {
|
||||||
printf("try token as integer %ld %s\n", tok.text.size(), tok.text.c_str());
|
|
||||||
if (decimal_start(tok.text[0]) && !str_contains(tok.text, '.')) {
|
if (decimal_start(tok.text[0]) && !str_contains(tok.text, '.')) {
|
||||||
// determine if we look like a number or not. If we look like a number, but stoll fails,
|
// determine if we look like a number or not. If we look like a number, but stoll fails,
|
||||||
// it means that the number is too big or too small, and we should error
|
// it means that the number is too big or too small, and we should error
|
||||||
|
@ -648,18 +645,13 @@ bool Reader::try_token_as_integer(const Token& tok, Object& obj) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("going to try stoll...\n");
|
|
||||||
uint64_t v = 0;
|
uint64_t v = 0;
|
||||||
try {
|
try {
|
||||||
std::size_t end = 0;
|
std::size_t end = 0;
|
||||||
v = std::stoll(tok.text, &end);
|
v = std::stoll(tok.text, &end);
|
||||||
printf("stoll didn't throw, got %ld\n", v);
|
|
||||||
if (end != tok.text.size()) {
|
if (end != tok.text.size()) {
|
||||||
printf("didn't read whole thing\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
printf("returning object!\n");
|
|
||||||
obj = Object::make_integer(v);
|
obj = Object::make_integer(v);
|
||||||
return true;
|
return true;
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
|
@ -667,7 +659,6 @@ bool Reader::try_token_as_integer(const Token& tok, Object& obj) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Reader::try_token_as_char(const Token& tok, Object& obj) {
|
bool Reader::try_token_as_char(const Token& tok, Object& obj) {
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <Winsock2.h>
|
|
||||||
#include <io.h>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include "Listener.h"
|
#include "Listener.h"
|
||||||
#include "common/versions.h"
|
#include "common/versions.h"
|
||||||
|
@ -74,7 +72,7 @@ bool Listener::connect_to_target(const std::string& ip, int port) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// set nodelay, which makes small rapid messages faster, but large messages slower
|
// set nodelay, which makes small rapid messages faster, but large messages slower
|
||||||
const char one = 1;
|
int one = 1;
|
||||||
if (setsockopt(socket_fd, SOL_TCP, TCP_NODELAY, &one, sizeof(one))) {
|
if (setsockopt(socket_fd, SOL_TCP, TCP_NODELAY, &one, sizeof(one))) {
|
||||||
printf("[Listener] failed to TCP_NODELAY\n");
|
printf("[Listener] failed to TCP_NODELAY\n");
|
||||||
close(socket_fd);
|
close(socket_fd);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#ifdef __unix__
|
#ifdef __linux__
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "goalc/listener/Listener.h"
|
#include "goalc/listener/Listener.h"
|
||||||
|
|
Loading…
Reference in a new issue