static void check_guest_output(const testdef_t *test, int fd)

{

    bool output_ok = false;

    int i, nbr, pos = 0;

    char ch;



    /* Poll serial output... Wait at most 60 seconds */

    for (i = 0; i < 6000; ++i) {

        while ((nbr = read(fd, &ch, 1)) == 1) {

            if (ch == test->expect[pos]) {

                pos += 1;

                if (test->expect[pos] == '\0') {

                    /* We've reached the end of the expected string! */

                    output_ok = true;

                    goto done;

                }

            } else {

                pos = 0;

            }

        }

        g_assert(nbr >= 0);

        g_usleep(10000);

    }



done:

    g_assert(output_ok);

}

static void check_guest_output(const testdef_t *test, int fd)

{

    bool output_ok = false;

    int i, nbr, pos = 0;

    char ch;



    

    for (i = 0; i < 6000; ++i) {

        while ((nbr = read(fd, &ch, 1)) == 1) {

            if (ch == test->expect[pos]) {

                pos += 1;

                if (test->expect[pos] == '\0') {

                    

                    output_ok = true;

                    goto done;

                }

            } else {

                pos = 0;

            }

        }

        g_assert(nbr >= 0);

        g_usleep(10000);

    }



done:

    g_assert(output_ok);

}

    int i, nbr, pos = 0;         while ((nbr = read(fd, &ch, 1)) == 1) {
static void FUNC_0(const testdef_t *VAR_0, int VAR_1)

{

    bool output_ok = false;

    int VAR_2, VAR_3, VAR_4 = 0;

    char VAR_5;



    

    for (VAR_2 = 0; VAR_2 < 6000; ++VAR_2) {

        while ((VAR_3 = read(VAR_1, &VAR_5, 1)) == 1) {

            if (VAR_5 == VAR_0->expect[VAR_4]) {

                VAR_4 += 1;

                if (VAR_0->expect[VAR_4] == '\0') {

                    

                    output_ok = true;

                    goto done;

                }

            } else {

                VAR_4 = 0;

            }

        }

        g_assert(VAR_3 >= 0);

        g_usleep(10000);

    }



done:

    g_assert(output_ok);

}

static void FUNC_0(const testdef_t *VAR_0, int VAR_1)
{ bool output_ok = false; int VAR_2, VAR_3, VAR_4 = 0; char VAR_5; for (VAR_2 = 0; VAR_2 < 6000; ++VAR_2) { while ((VAR_3 = read(VAR_1, &VAR_5, 1)) == 1) { if (VAR_5 == VAR_0->expect[VAR_4]) { VAR_4 += 1; if (VAR_0->expect[VAR_4] == '\0') { output_ok = true; goto done; } } else { VAR_4 = 0; } } g_assert(VAR_3 >= 0); g_usleep(10000); } done:
g_assert(output_ok); }