Ignore:
Timestamp:
2010-12-17T21:39:26Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
47a7174f
Parents:
424558a
Message:

Improved the virtchar1 test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/hw/misc/virtchar1.c

    r424558a r0bff73a  
    4545#include <sys/stat.h>
    4646#include <fcntl.h>
     47#include <device/char.h>
    4748#include "../../tester.h"
    4849
    4950#define DEVICE_PATH "/dev/devices/\\virt\\null"
     51#define BUFFER_SIZE 64
    5052
    5153const char *test_virtchar1(void)
     
    5658                TPRINTF(" ...error: %s\n", str_error(fd));
    5759                if (fd == ENOENT) {
    58                         TPRINTF("  (error was ENOENT: " \
     60                        TPRINTF(" (error was ENOENT: " \
    5961                            "have you compiled test drivers?)\n");
    6062                }
     
    7375        TPRINTF(" ...phone is %d\n", phone);
    7476       
     77        TPRINTF("Will try to read...\n");
     78        size_t i;
     79        char buffer[BUFFER_SIZE];
     80        read_dev(phone, buffer, BUFFER_SIZE);
     81        TPRINTF(" ...verifying that we read zeroes only...\n");
     82        for (i = 0; i < BUFFER_SIZE; i++) {
     83                if (buffer[i] != 0) {
     84                        return "Not all bytes are zeroes";
     85                }
     86        }
     87        TPRINTF(" ...data read okay\n");
    7588       
    7689        /* Clean-up. */
    77         TPRINTF("Closing phones and file descriptors...");
     90        TPRINTF("Closing phones and file descriptors");
    7891        ipc_hangup(phone);
    7992        close(fd);
Note: See TracChangeset for help on using the changeset viewer.