2022-07-06 21:18:08 -04:00
|
|
|
// Test jak1 running without loading debug segments.
|
2020-12-28 18:37:05 -05:00
|
|
|
|
|
|
|
#include "goalc/compiler/Compiler.h"
|
2022-06-22 23:37:46 -04:00
|
|
|
#include "gtest/gtest.h"
|
2020-12-28 18:37:05 -05:00
|
|
|
#include "test/goalc/framework/test_runner.h"
|
|
|
|
|
2022-07-06 21:18:08 -04:00
|
|
|
TEST(Jak1NoDebugSegment, Init) {
|
|
|
|
Compiler compiler(GameVersion::Jak1);
|
2020-12-28 18:37:05 -05:00
|
|
|
compiler.run_front_end_on_string("(build-kernel)");
|
|
|
|
std::thread runtime_thread = std::thread(GoalTest::runtime_with_kernel_no_debug_segment);
|
|
|
|
|
2021-03-01 11:15:24 -05:00
|
|
|
compiler.run_test_from_string("(set! *use-old-listener-print* #t)");
|
|
|
|
|
2020-12-28 18:37:05 -05:00
|
|
|
// this shouldn't crash
|
|
|
|
compiler.run_test_from_string("(inspect *kernel-context*)");
|
|
|
|
|
|
|
|
// these should be equal, both the fallback inspect method
|
2021-02-11 09:49:15 -05:00
|
|
|
EXPECT_TRUE(compiler.run_test_from_string("(printl (eq? (method-of-type kernel-context inspect) "
|
2021-02-03 11:07:47 -05:00
|
|
|
"(method-of-type cpu-thread inspect))) 0") ==
|
2020-12-28 18:37:05 -05:00
|
|
|
std::vector<std::string>{"#t\n0\n"});
|
|
|
|
|
|
|
|
// should be below the debug heap.
|
2021-02-11 09:49:15 -05:00
|
|
|
EXPECT_TRUE(compiler.run_test_from_string("(printl (< (the uint (method-of-type kernel-context "
|
2021-02-03 11:07:47 -05:00
|
|
|
"inspect)) (the uint (-> debug base)))) 0") ==
|
|
|
|
std::vector<std::string>{"#t\n0\n"});
|
2020-12-28 18:37:05 -05:00
|
|
|
|
|
|
|
// debug segment flag should be disabled.
|
2021-02-11 09:49:15 -05:00
|
|
|
EXPECT_TRUE(compiler.run_test_from_string("(printl *debug-segment*) 0") ==
|
2020-12-28 18:37:05 -05:00
|
|
|
std::vector<std::string>{"#f\n0\n"});
|
|
|
|
|
|
|
|
compiler.shutdown_target();
|
|
|
|
runtime_thread.join();
|
|
|
|
}
|