> 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:38:51  up 1 day  9:54,  2 users,  load average: 0.42, 0.32, 0.37
This commit is contained in:
tracer-ysyx 2024-01-13 09:38:51 +08:00 committed by xinyangli
parent b7dbbaeedc
commit 5a9ac07d90

View file

@ -47,7 +47,7 @@ void gen_num(void) {
}
void gen_rand_op(void) {
switch(rand() % 3) {
switch(rand() % 4) {
case 0: gen('+'); break;
case 1: gen('-'); break;
case 2: gen('*'); break;
@ -85,16 +85,16 @@ 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);
// ck_assert_msg(addr == reference, "\n\tbuf = %s\n\taddr = %u, reference = %u\n", buf, addr, reference);
while(buf_ptr != buf + buf_start_pos) {
*(--buf_ptr) = '\0';