> compile NEMU

ysyx_22040000 李心杨
Linux calcite 6.1.69 #1-NixOS SMP PREEMPT_DYNAMIC Wed Dec 20 16:00:29 UTC 2023 x86_64 GNU/Linux
 09:39:21  up 1 day  9:55,  2 users,  load average: 0.44, 0.34, 0.38
This commit is contained in:
tracer-ysyx 2024-01-13 09:39:21 +08:00 committed by xinyangli
parent 5a9ac07d90
commit 694c54c044

View file

@ -70,10 +70,10 @@ void gen_rand_expr(void) {
START_TEST(test_expr_random_100) {
srand(time(0) + _i * 100);
gen_rand_expr();
yy_scan_string(buf + buf_start_pos);
uint32_t addr;
ck_assert(!yyparse(&addr));
yylex_destroy();
// yy_scan_string(buf + buf_start_pos);
// uint32_t addr;
// ck_assert(!yyparse(&addr));
// yylex_destroy();
sprintf(code_buf, code_format, ref_buf);
@ -85,14 +85,14 @@ START_TEST(test_expr_random_100) {
int ret = system("gcc /tmp/.code.c -o /tmp/.expr");
ck_assert_msg(!ret, "system ret: %d, error: %s", ret, strerror(ret));
// fp = popen("/tmp/.expr", "r");
// ck_assert(fp != NULL);
fp = popen("/tmp/.expr", "r");
ck_assert(fp != NULL);
// uint32_t reference;
// ret = fscanf(fp, "%u", &reference);
// ck_assert(ret == 1);
// pclose(fp);
// // fprintf(stderr, "\n\tbuf = %s\n\taddr = %u, reference = %u", buf, addr, reference);
uint32_t reference;
ret = fscanf(fp, "%u", &reference);
ck_assert(ret == 1);
pclose(fp);
// fprintf(stderr, "\n\tbuf = %s\n\taddr = %u, reference = %u", buf, addr, reference);
// ck_assert_msg(addr == reference, "\n\tbuf = %s\n\taddr = %u, reference = %u\n", buf, addr, reference);