Add 12 tests for libnvmm's I/O Assist.

This commit is contained in:
maxv 2019-02-05 13:00:03 +00:00
parent 62aa7e873f
commit ed8fc6e9ad
6 changed files with 650 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: md.amd64,v 1.104 2018/12/24 13:31:22 christos Exp $ # $NetBSD: md.amd64,v 1.105 2019/02/05 13:00:03 maxv Exp $
./usr/lib/i386/12.202++_g.a comp-c-debuglib debuglib,compat,12.202xx ./usr/lib/i386/12.202++_g.a comp-c-debuglib debuglib,compat,12.202xx
./usr/lib/i386/libi386_g.a comp-c-debuglib debuglib,compat ./usr/lib/i386/libi386_g.a comp-c-debuglib debuglib,compat
./usr/lib/i386/libiberty_g.a comp-obsolete obsolete ./usr/lib/i386/libiberty_g.a comp-obsolete obsolete
@ -24,4 +24,5 @@
./usr/libdata/debug/usr/tests/kernel/arch/x86/t_ptrace_wait6.debug tests-obsolete obsolete ./usr/libdata/debug/usr/tests/kernel/arch/x86/t_ptrace_wait6.debug tests-obsolete obsolete
./usr/libdata/debug/usr/tests/kernel/arch/x86/t_ptrace_waitid.debug tests-obsolete obsolete ./usr/libdata/debug/usr/tests/kernel/arch/x86/t_ptrace_waitid.debug tests-obsolete obsolete
./usr/libdata/debug/usr/tests/kernel/arch/x86/t_ptrace_waitpid.debug tests-obsolete obsolete ./usr/libdata/debug/usr/tests/kernel/arch/x86/t_ptrace_waitpid.debug tests-obsolete obsolete
./usr/libdata/debug/usr/tests/lib/libnvmm/h_io_assist.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libnvmm/h_mem_assist.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libnvmm/h_mem_assist.debug tests-lib-debug debug,atf

View File

@ -1,4 +1,4 @@
# $NetBSD: md.amd64,v 1.6 2018/12/23 21:27:45 jakllsch Exp $ # $NetBSD: md.amd64,v 1.7 2019/02/05 13:00:03 maxv Exp $
./usr/tests/kernel/arch/x86/Atffile tests-obsolete obsolete ./usr/tests/kernel/arch/x86/Atffile tests-obsolete obsolete
./usr/tests/kernel/arch/x86/Kyuafile tests-obsolete obsolete ./usr/tests/kernel/arch/x86/Kyuafile tests-obsolete obsolete
./usr/tests/kernel/arch/x86/t_ptrace_wait tests-obsolete obsolete ./usr/tests/kernel/arch/x86/t_ptrace_wait tests-obsolete obsolete
@ -7,5 +7,7 @@
./usr/tests/kernel/arch/x86/t_ptrace_wait6 tests-obsolete obsolete ./usr/tests/kernel/arch/x86/t_ptrace_wait6 tests-obsolete obsolete
./usr/tests/kernel/arch/x86/t_ptrace_waitid tests-obsolete obsolete ./usr/tests/kernel/arch/x86/t_ptrace_waitid tests-obsolete obsolete
./usr/tests/kernel/arch/x86/t_ptrace_waitpid tests-obsolete obsolete ./usr/tests/kernel/arch/x86/t_ptrace_waitpid tests-obsolete obsolete
./usr/tests/lib/libnvmm/h_io_assist tests-lib-tests compattestfile,atf
./usr/tests/lib/libnvmm/t_io_assist tests-lib-tests compattestfile,atf
./usr/tests/lib/libnvmm/h_mem_assist tests-lib-tests compattestfile,atf ./usr/tests/lib/libnvmm/h_mem_assist tests-lib-tests compattestfile,atf
./usr/tests/lib/libnvmm/t_mem_assist tests-lib-tests compattestfile,atf ./usr/tests/lib/libnvmm/t_mem_assist tests-lib-tests compattestfile,atf

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.4 2018/12/24 05:06:45 kre Exp $ # $NetBSD: Makefile,v 1.5 2019/02/05 13:00:03 maxv Exp $
NOMAN= # defined NOMAN= # defined
@ -12,9 +12,14 @@ LDADD+= -lnvmm
BINDIR= ${TESTSDIR} BINDIR= ${TESTSDIR}
.if ${MACHINE} == "amd64" .if ${MACHINE} == "amd64"
# I/O Assist
TESTS_SH= t_io_assist
PROGS= h_io_assist
SRCS.h_io_assist= h_io_assist.c h_io_assist_asm.S
# Mem Assist # Mem Assist
TESTS_SH= t_mem_assist TESTS_SH+= t_mem_assist
PROGS= h_mem_assist PROGS+= h_mem_assist
SRCS.h_mem_assist= h_mem_assist.c h_mem_assist_asm.S SRCS.h_mem_assist= h_mem_assist.c h_mem_assist_asm.S
.endif .endif

View File

@ -0,0 +1,370 @@
/*
* Copyright (c) 2018 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Maxime Villard.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>
#include <string.h>
#include <err.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <machine/segments.h>
#include <machine/psl.h>
#include <machine/pte.h>
#include <x86/specialreg.h>
#include <nvmm.h>
#define PAGE_SIZE 4096
#define IO_SIZE 128
static char iobuf[IO_SIZE];
static uint8_t *databuf;
static uint8_t *instbuf;
static void
init_seg(struct nvmm_x64_state_seg *seg, int type, int sel)
{
seg->selector = sel;
seg->attrib.type = type;
seg->attrib.dpl = 0;
seg->attrib.p = 1;
seg->attrib.avl = 1;
seg->attrib.lng = 1;
seg->attrib.def32 = 0;
seg->attrib.gran = 1;
seg->limit = 0x0000FFFF;
seg->base = 0x00000000;
}
static void
reset_machine(struct nvmm_machine *mach)
{
struct nvmm_x64_state state;
memset(&state, 0, sizeof(state));
/* Default. */
state.gprs[NVMM_X64_GPR_RFLAGS] = PSL_MBO;
init_seg(&state.segs[NVMM_X64_SEG_CS], SDT_MEMERA, GSEL(GCODE_SEL, SEL_KPL));
init_seg(&state.segs[NVMM_X64_SEG_SS], SDT_MEMRWA, GSEL(GDATA_SEL, SEL_KPL));
init_seg(&state.segs[NVMM_X64_SEG_DS], SDT_MEMRWA, GSEL(GDATA_SEL, SEL_KPL));
init_seg(&state.segs[NVMM_X64_SEG_ES], SDT_MEMRWA, GSEL(GDATA_SEL, SEL_KPL));
init_seg(&state.segs[NVMM_X64_SEG_FS], SDT_MEMRWA, GSEL(GDATA_SEL, SEL_KPL));
init_seg(&state.segs[NVMM_X64_SEG_GS], SDT_MEMRWA, GSEL(GDATA_SEL, SEL_KPL));
/* Blank. */
init_seg(&state.segs[NVMM_X64_SEG_GDT], 0, 0);
init_seg(&state.segs[NVMM_X64_SEG_IDT], 0, 0);
init_seg(&state.segs[NVMM_X64_SEG_LDT], SDT_SYSLDT, 0);
init_seg(&state.segs[NVMM_X64_SEG_TR], SDT_SYS386BSY, 0);
/* Protected mode enabled. */
state.crs[NVMM_X64_CR_CR0] = CR0_PG|CR0_PE|CR0_NE|CR0_TS|CR0_MP|CR0_WP|CR0_AM;
/* 64bit mode enabled. */
state.crs[NVMM_X64_CR_CR4] = CR4_PAE;
state.msrs[NVMM_X64_MSR_EFER] = EFER_LME | EFER_SCE | EFER_LMA;
/* Stolen from x86/pmap.c */
#define PATENTRY(n, type) (type << ((n) * 8))
#define PAT_UC 0x0ULL
#define PAT_WC 0x1ULL
#define PAT_WT 0x4ULL
#define PAT_WP 0x5ULL
#define PAT_WB 0x6ULL
#define PAT_UCMINUS 0x7ULL
state.msrs[NVMM_X64_MSR_PAT] =
PATENTRY(0, PAT_WB) | PATENTRY(1, PAT_WT) |
PATENTRY(2, PAT_UCMINUS) | PATENTRY(3, PAT_UC) |
PATENTRY(4, PAT_WB) | PATENTRY(5, PAT_WT) |
PATENTRY(6, PAT_UCMINUS) | PATENTRY(7, PAT_UC);
/* Page tables. */
state.crs[NVMM_X64_CR_CR3] = 0x3000;
state.gprs[NVMM_X64_GPR_RIP] = 0x2000;
if (nvmm_vcpu_setstate(mach, 0, &state, NVMM_X64_STATE_ALL) == -1)
err(errno, "nvmm_vcpu_setstate");
}
static void
map_pages(struct nvmm_machine *mach)
{
pt_entry_t *L4, *L3, *L2, *L1;
instbuf = mmap(NULL, PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE,
-1, 0);
if (instbuf == MAP_FAILED)
err(errno, "mmap");
databuf = mmap(NULL, PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE,
-1, 0);
if (databuf == MAP_FAILED)
err(errno, "mmap");
if (nvmm_hva_map(mach, (uintptr_t)instbuf, PAGE_SIZE) == -1)
err(errno, "nvmm_hva_map");
if (nvmm_hva_map(mach, (uintptr_t)databuf, PAGE_SIZE) == -1)
err(errno, "nvmm_hva_map");
if (nvmm_gpa_map(mach, (uintptr_t)instbuf, 0x2000, PAGE_SIZE, 0) == -1)
err(errno, "nvmm_gpa_map");
if (nvmm_gpa_map(mach, (uintptr_t)databuf, 0x1000, PAGE_SIZE, 0) == -1)
err(errno, "nvmm_gpa_map");
L4 = mmap(NULL, PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE,
-1, 0);
if (L4 == MAP_FAILED)
err(errno, "mmap");
L3 = mmap(NULL, PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE,
-1, 0);
if (L3 == MAP_FAILED)
err(errno, "mmap");
L2 = mmap(NULL, PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE,
-1, 0);
if (L2 == MAP_FAILED)
err(errno, "mmap");
L1 = mmap(NULL, PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE,
-1, 0);
if (L1 == MAP_FAILED)
err(errno, "mmap");
if (nvmm_hva_map(mach, (uintptr_t)L4, PAGE_SIZE) == -1)
err(errno, "nvmm_hva_map");
if (nvmm_hva_map(mach, (uintptr_t)L3, PAGE_SIZE) == -1)
err(errno, "nvmm_hva_map");
if (nvmm_hva_map(mach, (uintptr_t)L2, PAGE_SIZE) == -1)
err(errno, "nvmm_hva_map");
if (nvmm_hva_map(mach, (uintptr_t)L1, PAGE_SIZE) == -1)
err(errno, "nvmm_hva_map");
if (nvmm_gpa_map(mach, (uintptr_t)L4, 0x3000, PAGE_SIZE, 0) == -1)
err(errno, "nvmm_gpa_map");
if (nvmm_gpa_map(mach, (uintptr_t)L3, 0x4000, PAGE_SIZE, 0) == -1)
err(errno, "nvmm_gpa_map");
if (nvmm_gpa_map(mach, (uintptr_t)L2, 0x5000, PAGE_SIZE, 0) == -1)
err(errno, "nvmm_gpa_map");
if (nvmm_gpa_map(mach, (uintptr_t)L1, 0x6000, PAGE_SIZE, 0) == -1)
err(errno, "nvmm_gpa_map");
memset(L4, 0, PAGE_SIZE);
memset(L3, 0, PAGE_SIZE);
memset(L2, 0, PAGE_SIZE);
memset(L1, 0, PAGE_SIZE);
L4[0] = PG_V | PG_RW | 0x4000;
L3[0] = PG_V | PG_RW | 0x5000;
L2[0] = PG_V | PG_RW | 0x6000;
L1[0x2000 / PAGE_SIZE] = PG_V | PG_RW | 0x2000;
L1[0x1000 / PAGE_SIZE] = PG_V | PG_RW | 0x1000;
}
/* -------------------------------------------------------------------------- */
static size_t iobuf_off = 0;
static void
io_callback(struct nvmm_io *io)
{
if (io->port != 123) {
printf("Wrong port\n");
exit(-1);
}
if (io->in) {
memcpy(io->data, iobuf + iobuf_off, io->size);
} else {
memcpy(iobuf + iobuf_off, io->data, io->size);
}
iobuf_off += io->size;
}
static int
handle_io(struct nvmm_machine *mach, struct nvmm_exit *exit)
{
int ret;
ret = nvmm_assist_io(mach, 0, exit);
if (ret == -1) {
err(errno, "nvmm_assist_io");
}
return 0;
}
static void
run_machine(struct nvmm_machine *mach)
{
struct nvmm_exit exit;
while (1) {
if (nvmm_vcpu_run(mach, 0, &exit) == -1)
err(errno, "nvmm_vcpu_run");
switch (exit.reason) {
case NVMM_EXIT_NONE:
break;
case NVMM_EXIT_MSR:
/* Stop here. */
return;
case NVMM_EXIT_IO:
handle_io(mach, &exit);
break;
case NVMM_EXIT_SHUTDOWN:
printf("Shutting down!\n");
return;
default:
printf("Invalid!\n");
return;
}
}
}
/* -------------------------------------------------------------------------- */
struct test {
const char *name;
uint8_t *code_begin;
uint8_t *code_end;
const char *wanted;
bool in;
};
static void
run_test(struct nvmm_machine *mach, const struct test *test)
{
size_t size;
char *res;
size = (size_t)test->code_end - (size_t)test->code_begin;
reset_machine(mach);
iobuf_off = 0;
memset(iobuf, 0, IO_SIZE);
memset(databuf, 0, PAGE_SIZE);
memcpy(instbuf, test->code_begin, size);
if (test->in) {
strcpy(iobuf, test->wanted);
} else {
strcpy(databuf, test->wanted);
}
run_machine(mach);
if (test->in) {
res = databuf;
} else {
res = iobuf;
}
if (!strcmp(res, test->wanted)) {
printf("Test '%s' passed\n", test->name);
} else {
printf("Test '%s' failed, wanted '%s', got '%s'\n", test->name,
test->wanted, res);
}
}
/* -------------------------------------------------------------------------- */
extern uint8_t test1_begin, test1_end;
extern uint8_t test2_begin, test2_end;
extern uint8_t test3_begin, test3_end;
extern uint8_t test4_begin, test4_end;
extern uint8_t test5_begin, test5_end;
extern uint8_t test6_begin, test6_end;
extern uint8_t test7_begin, test7_end;
extern uint8_t test8_begin, test8_end;
extern uint8_t test9_begin, test9_end;
extern uint8_t test10_begin, test10_end;
extern uint8_t test11_begin, test11_end;
extern uint8_t test12_begin, test12_end;
static const struct test tests[] = {
{ "test1 - INB", &test1_begin, &test1_end, "12", true },
{ "test2 - INW", &test2_begin, &test2_end, "1234", true },
{ "test3 - INL", &test3_begin, &test3_end, "12345678", true },
{ "test4 - INSB+REP", &test4_begin, &test4_end, "12345", true },
{ "test5 - INSW+REP", &test5_begin, &test5_end,
"Comment est votre blanquette", true },
{ "test6 - INSL+REP", &test6_begin, &test6_end,
"123456789abcdefghijklmnopqrs", true },
{ "test7 - OUTB", &test7_begin, &test7_end, "12", false },
{ "test8 - OUTW", &test8_begin, &test8_end, "1234", false },
{ "test9 - OUTL", &test9_begin, &test9_end, "12345678", false },
{ "test10 - OUTSB+REP", &test10_begin, &test10_end, "12345", false },
{ "test11 - OUTSW+REP", &test11_begin, &test11_end,
"Ah, Herr Bramard", false },
{ "test12 - OUTSL+REP", &test12_begin, &test12_end,
"123456789abcdefghijklmnopqrs", false },
{ NULL, NULL, NULL, NULL, false }
};
static const struct nvmm_callbacks callbacks = {
.io = io_callback,
.mem = NULL
};
/*
* 0x1000: Data, mapped
* 0x2000: Instructions, mapped
* 0x3000: L4
* 0x4000: L3
* 0x5000: L2
* 0x6000: L1
*/
int main(int argc, char *argv[])
{
struct nvmm_machine mach;
size_t i;
if (nvmm_machine_create(&mach) == -1)
err(errno, "nvmm_machine_create");
if (nvmm_vcpu_create(&mach, 0) == -1)
err(errno, "nvmm_vcpu_create");
nvmm_callbacks_register(&callbacks);
map_pages(&mach);
for (i = 0; tests[i].name != NULL; i++) {
run_test(&mach, &tests[i]);
}
return 0;
}

View File

@ -0,0 +1,217 @@
/*
* Copyright (c) 2019 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Maxime Villard.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
.globl test1_begin, test1_end
.globl test2_begin, test2_end
.globl test3_begin, test3_end
.globl test4_begin, test4_end
.globl test5_begin, test5_end
.globl test6_begin, test6_end
.globl test7_begin, test7_end
.globl test8_begin, test8_end
.globl test9_begin, test9_end
.globl test10_begin, test10_end
.globl test11_begin, test11_end
.globl test12_begin, test12_end
.text
.code64
#define TEST_END \
movq $0xFFFFFFFFFFFFFFFF,%rcx; \
rdmsr ;
/*
* IN
*/
.align 64
test1_begin:
movq $0x1000,%rbx
inb $123
movb %al,(%rbx)
incq %rbx
movq $123,%rdx
inb %dx
movb %al,(%rbx)
TEST_END
test1_end:
.align 64
test2_begin:
movq $0x1000,%rbx
inw $123
movw %ax,(%rbx)
addq $2,%rbx
movq $123,%rdx
inw %dx
movw %ax,(%rbx)
TEST_END
test2_end:
.align 64
test3_begin:
movq $0x1000,%rbx
inl $123
movl %eax,(%rbx)
addq $4,%rbx
movq $123,%rdx
inl %dx
movl %eax,(%rbx)
TEST_END
test3_end:
.align 64
test4_begin:
movq $0x1000,%rdi
movq $5,%rcx
movq $123,%rdx
rep
insb
TEST_END
test4_end:
.align 64
test5_begin:
movq $0x1000,%rdi
movq $14,%rcx
movq $123,%rdx
rep
insw
TEST_END
test5_end:
.align 64
test6_begin:
movq $0x1000,%rdi
movq $7,%rcx
movq $123,%rdx
rep
insl
TEST_END
test6_end:
/*
* OUT
*/
.align 64
test7_begin:
movq $0x1000,%rbx
movb (%rbx),%al
outb $123
incq %rbx
movb (%rbx),%al
movq $123,%rdx
outb %dx
TEST_END
test7_end:
.align 64
test8_begin:
movq $0x1000,%rbx
movw (%rbx),%ax
outw $123
addq $2,%rbx
movw (%rbx),%ax
movq $123,%rdx
outw %dx
TEST_END
test8_end:
.align 64
test9_begin:
movq $0x1000,%rbx
movl (%rbx),%eax
outl $123
addq $4,%rbx
movl (%rbx),%eax
movq $123,%rdx
outl %dx
TEST_END
test9_end:
.align 64
test10_begin:
movq $0x1000,%rsi
movq $5,%rcx
movq $123,%rdx
rep
outsb
TEST_END
test10_end:
.align 64
test11_begin:
movq $0x1000,%rsi
movq $8,%rcx
movq $123,%rdx
rep
outsw
TEST_END
test11_end:
.align 64
test12_begin:
movq $0x1000,%rsi
movq $7,%rcx
movq $123,%rdx
rep
outsl
TEST_END
test12_end:

View File

@ -0,0 +1,50 @@
# $NetBSD: t_io_assist.sh,v 1.1 2019/02/05 13:00:03 maxv Exp $
#
# Copyright (c) 2019 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
atf_test_case io_assist
io_assist_head()
{
atf_set "descr" "Check the I/O Assist provided in libnvmm"
}
io_assist_body()
{
$(atf_get_srcdir)/h_io_assist
exitcode=$?
if [ $exitcode -eq 6 ] ; then
atf_skip "NVMM driver not loaded"
elif [ $exitcode -ne 0 ] ; then
atf_fail "I/O Assist failed with errno $exitcode"
fi
}
atf_init_test_cases()
{
atf_add_test_case io_assist
}