Esempio n. 1
0
int
main(int argc, char *argv[])
{
    char * tst;
    char * expected;

    test_init("ompi_numtostr_t");

    tst = opal_ltostr(10);
    expected = malloc(sizeof(long) * 8);
    snprintf(expected, sizeof(long) * 8, "%d", 10);
    if (strcmp(tst, expected) != 0) {
      test_failure("opal_ltostr test failed");
    }
    else {
      test_success();
    }

    free(tst);
    free(expected);

    tst = opal_dtostr(5.32);
    expected = malloc(sizeof(long) * 8);
    snprintf(expected, sizeof(long) * 8, "%f", 5.32);
    if (strcmp(tst, expected) != 0) {
      test_failure("opal_dtostr test failed");
    }
    else {
      test_success();
    }

    test_finalize();

    return 0;
}
int main(int argc, char* argv[])
{
    opal_init(&argc, &argv);

    test_init("opal_os_create_dirpath_t");

    /* All done */

    if (test1()) {
        test_success();
    }
    else {
      test_failure("opal_os_create_dirpath test1 failed");
    }

    if (test2()) {
        test_success();
    }
    else {
      test_failure("opal_os_create_dirpath test2 failed");
    }

    if (test3()) {
        test_success();
    }
    else {
      test_failure("opal_os_create_dirpath test3 failed");
    }

    test_finalize();
    opal_finalize();

    return 0;
}
Esempio n. 3
0
void test_get_temporary_buffer (T *dummy, const char *tname)
{
    RW_ASSERT (0 != tname);

    test_success (dummy, tname);
    test_failure (dummy, tname);
}
Esempio n. 4
0
DEF_TEST(SkSLInvalidUnary, r) {
    test_failure(r,
                 "void main() { mat4 x = mat4(1); ++x; }",
                 "error: 1: '++' cannot operate on 'mat4'\n1 error\n");
    test_failure(r,
                 "void main() { vec3 x = vec3(1); --x; }",
                 "error: 1: '--' cannot operate on 'vec3'\n1 error\n");
    test_failure(r,
                 "void main() { mat4 x = mat4(1); x++; }",
                 "error: 1: '++' cannot operate on 'mat4'\n1 error\n");
    test_failure(r,
                 "void main() { vec3 x = vec3(1); x--; }",
                 "error: 1: '--' cannot operate on 'vec3'\n1 error\n");
    test_failure(r,
                 "void main() { int x = !12; }",
                 "error: 1: '!' cannot operate on 'int'\n1 error\n");
    test_failure(r,
                 "struct foo { } bar; void main() { foo x = +bar; }",
                 "error: 1: '+' cannot operate on 'foo'\n1 error\n");
    test_failure(r,
                 "struct foo { } bar; void main() { foo x = -bar; }",
                 "error: 1: '-' cannot operate on 'foo'\n1 error\n");
    test_success(r,
                 "void main() { vec2 x = vec2(1, 1); x = +x; x = -x; }");
}
Esempio n. 5
0
DEF_TEST(SkSLStaticSwitch, r) {
    test_success(r,
                 "void main() {"
                 "int x = 1;"
                 "@switch (x) {"
                 "case 1: sk_FragColor = vec4(1); break;"
                 "default: sk_FragColor = vec4(0);"
                 "}"
                 "}");
    test_failure(r,
                 "void main() {"
                 "int x = int(sqrt(1));"
                 "@switch (x) {"
                 "case 1: sk_FragColor = vec4(1); break;"
                 "default: sk_FragColor = vec4(0);"
                 "}"
                 "}",
                 "error: 1: static switch has non-static test\n1 error\n");
    test_failure(r,
                 "void main() {"
                 "int x = 1;"
                 "@switch (x) {"
                 "case 1: sk_FragColor = vec4(1); if (sqrt(0) < sqrt(1)) break;"
                 "default: sk_FragColor = vec4(0);"
                 "}"
                 "}",
                 "error: 1: static switch contains non-static conditional break\n1 error\n");
}
Esempio n. 6
0
File: test.c Progetto: Zolok/refos
static int
test_cbpool(void)
{
    test_start("cbpool");
    cbpool_t p;
    cbpool_init(&p, 1024);
    int obj[16];
    for (int i = 0; i < 16; i++) {
        obj[i] = cbpool_alloc(&p, 32);
        test_assert(obj[i] >= 0 && obj[i] <= 1024);
        for (int j = 0; j < 32; j++) {
            test_assert(cbpool_check_single(&p, i  + j) == true);
        }
    }
    for (int i = 0; i < 16; i++) {
        cbpool_free(&p, obj[i], 32);
    }
    uint32_t v = cbpool_alloc(&p, 1024);
    test_assert(v == 0);
    for (int i = 0; i < 1024; i+=2) {
        test_assert(cbpool_check_single(&p, i) == true);
        cbpool_set_single(&p, i, false);
        test_assert(cbpool_check_single(&p, i) == false);
        cbpool_set_single(&p, i, true);
        test_assert(cbpool_check_single(&p, i) == true);
    }
    cbpool_release(&p);
    return test_success();
}
Esempio n. 7
0
DEF_TEST(SkSLDuplicateFunction, r) {
    test_failure(r,
                 "void main() { } void main() { }", 
                 "error: 1: duplicate definition of void main()\n1 error\n");
    test_success(r,
                 "void main(); void main() { }");
}
Esempio n. 8
0
static void
test_filter_or_format(enabler enable)
{
	test_success(archive_read_new, enable, archive_read_free);
	test_failure(archive_write_new, enable, archive_write_free);
	test_failure(archive_read_disk_new, enable, archive_read_free);
	test_failure(archive_write_disk_new, enable, archive_write_free);
}
Esempio n. 9
0
DEF_TEST(SkSLStaticIf, r) {
    test_success(r,
                 "void main() { float x = 5; float y = 10;"
                 "@if (x < y) { sk_FragColor = vec4(1); } }");
    test_failure(r,
                 "void main() { float x = sqrt(25); float y = 10;"
                 "@if (x < y) { sk_FragColor = vec4(1); } }",
                 "error: 1: static if has non-static test\n1 error\n");
}
Esempio n. 10
0
int
test_vspace(int run)
{
    test_start(run == 0 ? "vspace (run 1)" : "vspace (run 2)");
    const int numTestVS = MIN(8, MIN((PID_MAX - 1), PD_MAX));
    int error = -1;

    struct vs_vspace vs[numTestVS];

    /* Allocate ALL the vspaces. */
    for (int i = 0; i < numTestVS; i++) {
        uint32_t bogusPID = (i * 31337 % 1234);
        error = vs_initialise(&vs[i], bogusPID);

        test_assert(error == ESUCCESS);
        test_assert(vs[i].magic == REFOS_VSPACE_MAGIC);
        test_assert(vs[i].ref == 1);
        test_assert(vs[i].pid == bogusPID);
        test_assert(vs[i].kpd != 0);
        test_assert(vs[i].cspace.capPtr != 0);
        test_assert(vs[i].cspaceSize == REFOS_CSPACE_RADIX);
    }

    /* Ref every second one thrice. */
    for (int i = 0; i < numTestVS; i+=2) {
        vs_ref(&vs[i]);
        vs_ref(&vs[i]);
        vs_ref(&vs[i]);
    }

    /* Deref every VS. */
    for (int i = 0; i < numTestVS; i++) {
        vs_unref(&vs[i]);
    }

    /* Check that every second one is still alive. */
    for (int i = 0; i < numTestVS; i++) {
        if (i % 2 == 0) {
            test_assert(vs[i].ref == 3);
            test_assert(vs[i].magic == REFOS_VSPACE_MAGIC);
            vs_unref(&vs[i]);
            test_assert(vs[i].ref == 2);
            test_assert(vs[i].magic == REFOS_VSPACE_MAGIC);
            vs_unref(&vs[i]);
            test_assert(vs[i].ref == 1);
            test_assert(vs[i].magic == REFOS_VSPACE_MAGIC);
            vs_unref(&vs[i]);
            test_assert(vs[i].ref == 0);
            test_assert(vs[i].magic != REFOS_VSPACE_MAGIC);
        } else {
            test_assert(vs[i].ref == 0);
            test_assert(vs[i].magic != REFOS_VSPACE_MAGIC);
        }
    }

    return test_success();
}
Esempio n. 11
0
int main(int argc, char* argv[])
{

  test_init("opal_argv_t");

  if( test1() ) test_success();
  else test_failure("test1 argv test failed");

  if( test2() ) test_success();
  else test_failure("test2 argv test failed");

  if( test3() ) test_success();
  else test_failure("test3 argv test failed");

  if( test4() ) test_success();
  else test_failure("test4 argv test failed");

  if( test5() ) test_success();
  else test_failure("test5 argv test failed");

  if( test6() ) test_success();
  else test_failure("test6 argv test failed");

  if( test7() ) test_success();
  else test_failure("test7 argv test failed");

  if( test8() ) test_success();
  else test_failure("test8 argv test failed");

  if (test9()) {
      test_success();
  } else {
      test_failure("test9 argv test failed");
  }

  if (test10()) {
      test_success();
  } else {
      test_failure("test10 argv test failed");
  }

  /* All done */
  return test_finalize();
}
Esempio n. 12
0
DEF_TEST(SkSLGenericArgumentMismatch, r) {
    test_failure(r,
                 "void main() { float x = sin(1, 2); }", 
                 "error: 1: call to 'sin' expected 1 argument, but found 2\n1 error\n");
    test_failure(r,
                 "void main() { float x = sin(true); }", 
                 "error: 1: no match for sin(bool)\n1 error\n");
    test_success(r,
                 "void main() { float x = sin(1); }");
}
Esempio n. 13
0
DEF_TEST(SkSLDuplicateSymbol, r) {
    test_failure(r,
                 "int main; void main() { }", 
                 "error: 1: symbol 'main' was already defined\n1 error\n");

    test_failure(r,
                 "int x; int x; void main() { }",
                 "error: 1: symbol 'x' was already defined\n1 error\n");

    test_success(r, "int x; void main() { int x; }");
}
Esempio n. 14
0
static void test_req_sent(struct network_test *t)
{
	int s = t->nt_s;
	fd_set fds;
	struct timeval tv;
	char buf[1024];
	int rc;

	FD_ZERO(&fds);
	FD_SET(s, &fds);

	tv.tv_sec  = 0;
	tv.tv_usec = 0;

	if (select(s + 1, &fds, NULL, NULL, &tv) == -1)
		err(1, "select()");

	if (!FD_ISSET(s, &fds))
		return;

	rc = recv(s, buf, sizeof(buf) - 1, 0);
	if (rc == -1) {
		test_finish(t, errno);
		return;
	}

	if (rc == 0) {
		test_finish(t, TEST_ERR_DISCONNECT);
		return;
	}

	buf[rc] = 0;

	if (strncmp(buf, TEST_REPLY, strlen(TEST_REPLY)) != 0) {
		test_finish(t, TEST_ERR_BADINPUT);
		return;
	}

	t->nt_flags = atoi(&buf[rc - 1]);

	if (t->nt_proto == TEST_TCP && t->nt_crypt == 1) {
		test_finish(t, TEST_ERR_UNEXPECTED_CRYPT);
		return;
	}

	if (t->nt_proto == TEST_CRYPT && t->nt_crypt != 1) {
		test_finish(t, TEST_ERR_NO_CRYPT);
		return;
	}

	test_success(t);
}
void doit(void)
{
	global_init();
	gnutls_global_set_log_function(tls_log_func);
	if (debug)
		gnutls_global_set_log_level(99);

	test_failure_client();
	test_failure_server();
	test_success();

	gnutls_global_deinit();
}
Esempio n. 16
0
DEF_TEST(SkSLAssignmentTypeMismatch, r) {
    test_failure(r,
                 "void main() { int x = 1.0; }",
                 "error: 1: expected 'int', but found 'float'\n1 error\n");
    test_failure(r,
                 "void main() { int x; x = 1.0; }",
                 "error: 1: type mismatch: '=' cannot operate on 'int', 'float'\n1 error\n");
    test_success(r,
                 "void main() { vec3 x = vec3(0); x *= 1.0; }");
    test_failure(r,
                 "void main() { ivec3 x = ivec3(0); x *= 1.0; }",
                 "error: 1: type mismatch: '*=' cannot operate on 'ivec3', 'float'\n1 error\n");
}
Esempio n. 17
0
static int
test_file_server_serv_connect()
{
    test_start("fs serv_connect");
    for (int i = 0; i < 5; i++) {
        serv_connection_t c = serv_connect("/fileserv/*");
        test_assert(c.error == ESUCCESS);
        test_assert(c.paramBuffer.err == ESUCCESS);
        strcpy(c.paramBuffer.vaddr, "test");
        serv_disconnect(&c);
    }
    return test_success();
}
Esempio n. 18
0
void test(char* file, bool expect)
{
#ifdef DEBUG
    printf ("test(): file:%s bool:%d\n",
            file, expect);
#endif
    if (expect == opal_path_nfs (file, NULL)) {
        test_success();
    } else {
        char * msg;
        opal_asprintf(&msg, "Mismatch: input \"%s\", expected:%d got:%d\n",
                 file, expect, !expect);
        test_failure(msg);
        free(msg);
    }
}
Esempio n. 19
0
File: test.c Progetto: Zolok/refos
static int
test_cpool(void)
{
    test_start("cpool");
    cpool_t p;
    cpool_init(&p, 1, 10240);
    for (int i = 1; i < 10240; i+=2) {
        int v = cpool_alloc(&p);
        test_assert(v >= 1 && v <= 10240);
        test_assert(cpool_check(&p, v) == false);
    }
    cpool_free(&p, 1);
    int v = cpool_alloc(&p);
    test_assert(v == 1);
    cpool_release(&p);
    return test_success();
}
Esempio n. 20
0
int test_verify_int(int expected_result, int test_result)
{
    int return_value;

    return_value = 1;
    if (expected_result != test_result) {
        test_failure("Comparison failure");
        fprintf(stderr, " Expected result: %d\n", expected_result);
        fprintf(stderr, " Test result: %d\n", test_result);
        fflush(stderr);
        return_value = 0;
    } else {
        test_success();
    }

    return return_value;
}
Esempio n. 21
0
int main(int argc, const char** argv) {

    unsigned long long int seed;

    if (argc < 2) {
        seed = (unsigned long long) std::chrono::system_clock::now().time_since_epoch().count();
    } else {
        seed = std::strtoull(argv[1], nullptr, 10);
    }

    test_failure();
    test_success((uint32_t) seed, (uint32_t) 10000);
    test_addition();
    test_ordering();

    std::cout << "TEST SUCCEEDED" << std::endl;

}
Esempio n. 22
0
File: test.c Progetto: Zolok/refos
static int
test_cqueue(void)
{
    test_start("cqueue");
    cqueue_t q;
    cqueue_init(&q, 62);
    for (int k = 0; k < 100; k++) {
        for (int i = 0; i < 60; i++) {
            cqueue_push(&q, (cqueue_item_t) i);
        }
        for (int i = 0; i < 60; i++) {
            int item = (int) cqueue_pop(&q);
            test_assert(item == i);
        }
    }
    cqueue_free(&q);
    return test_success();
}
Esempio n. 23
0
int
test_pd(void)
{
    test_start("page directory");
    seL4_CPtr p[PD_MAX];
    for (int i = 0; i < PD_MAX; i++) {
        p[i] = pd_assign(&procServ.PDList).kpdObject;
        test_assert(p[i] != 0);
    }
    for (int i = 0; i < PD_MAX; i++) {
        pd_free(&procServ.PDList, p[i]);
    }
    for (int i = 0; i < 2; i++) {
        p[i] = pd_assign(&procServ.PDList).kpdObject;
        test_assert(p[i] != 0);
    }
    for (int i = 0; i < 2; i++) {
        pd_free(&procServ.PDList, p[i]);
    }
    return test_success();
}
Esempio n. 24
0
File: test.c Progetto: Zolok/refos
static int
test_kalloc(void)
{
    test_start("kalloc");

    /* Test that malloc works and the process server can allocate from static heap properly. */
    for (int repeats = 0; repeats < 100; repeats++) {
        int *a = kmalloc(sizeof(int) * 10240);
        assert(a);
        for (int i = 0; i < 10240; i++) a[i] = i;
        for (int i = 0; i < 10240; i++) test_assert(a[i] == i);
        kfree(a);
    }

    /* Test that kernel obj allocation works and that the VKA allocator has been
       bootstrapped properly. */
    vka_object_t obj[100];
    int error = -1;
    for (int repeats = 0; repeats < 100; repeats++) {
        for (int i = 0; i < 100; i++) {
            error = vka_alloc_endpoint(&procServ.vka, &obj[i]);
            test_assert(!error);
            test_assert(obj[i].cptr != 0);
        }
        for (int i = 0; i < 100; i++) {
            vka_free_object(&procServ.vka, &obj[i]);
        }
        for (int i = 0; i < 100; i++) {
            error = vka_alloc_frame(&procServ.vka, seL4_PageBits, &obj[i]);
            test_assert(!error);
            test_assert(obj[i].cptr != 0);
        }
        for (int i = 0; i < 100; i++) {
            vka_free_object(&procServ.vka, &obj[i]);
        }
    }

    return test_success();
}
Esempio n. 25
0
int test_verify_str(const char *expected_result, const char *test_result)
{
    size_t len_expect, len_result;
    int return_value;

    return_value = 1;
    len_expect = expected_result ? strlen(expected_result) : 0;
    len_result = test_result ? strlen(test_result) : 0;

    if ((!(len_expect == len_result)) ||
        (0 != strcmp(expected_result, test_result))) {
        test_failure("Comparison failure");
        fprintf(stderr, " Expected result: %s\n", expected_result);
        fprintf(stderr, " Test result: %s\n", test_result);
        fflush(stderr);
        return_value = 0;
    } else {
        test_success();
    }

    return return_value;
}
Esempio n. 26
0
static int
test_file_server_connect()
{
    test_start("fs connection");

    /* Find the file server. */
    nsv_mountpoint_t mp = nsv_resolve("fileserv/*");
    test_assert(mp.success == true);
    test_assert(mp.serverAnon != 0);

    seL4_CPtr fileservAnon = mp.serverAnon;
    const int fs_test_repeat = 5;

    /* Attempt to ping the file server. */
    for (int i = 0; i < fs_test_repeat; i++) {
        int error = serv_ping(fileservAnon);
        test_assert(error == ESUCCESS);
    }

    /* Repeatedly connect to and disconnect from the file server. */
    for (int i = 0; i < fs_test_repeat; i++) {
        int error;
        seL4_CPtr fileservSession = serv_connect_direct(fileservAnon, REFOS_LIVENESS, &error);
        test_assert(fileservSession && error == ESUCCESS);

        if (fileservSession) {
            serv_disconnect_direct(fileservSession);
            seL4_CNode_Delete(REFOS_CSPACE, fileservSession, REFOS_CDEPTH);
            csfree(fileservSession);
        }
    }

    /* Release the resources stored in the valid mountpoint. */
    nsv_mountpoint_release(&mp);
    test_assert(mp.success == false);
    test_assert(mp.serverAnon == 0);

    return test_success();
}
Esempio n. 27
0
File: test.c Progetto: Zolok/refos
static int
test_chash(void)
{
    test_start("chash");
    chash_t h;
    chash_init(&h, 12);
    for (int i = 0; i < 1024; i++) {
        chash_set(&h, i, (chash_item_t) 0x3F1);
    }
    for (int i = 0; i < 1024; i++) {
        int t = (int) chash_get(&h, i);
        test_assert(t == 0x3F1);
    }
    chash_remove(&h, 123);
    test_assert(chash_get(&h, 123) == NULL);
    int f = chash_find_free(&h, 100, 200);
    test_assert(f == 123);
    for (int i = 0; i < 1024; i++) {
        chash_remove(&h, i);
    }
    chash_release(&h);
    return test_success();
}
Esempio n. 28
0
File: test.c Progetto: Zolok/refos
static int
test_cvector(void)
{
    test_start("cvector");
    // Src: https://gist.github.com/EmilHernvall/953968
    cvector_t v;
    cvector_init(&v);
    cvector_add(&v, (cvector_item_t)1); cvector_add(&v, (cvector_item_t)2);
    cvector_add(&v, (cvector_item_t)3); cvector_add(&v, (cvector_item_t)4);
    cvector_add(&v, (cvector_item_t)5);
    test_assert(cvector_count(&v) == (int)5);
    test_assert(cvector_get(&v, 0) == (cvector_item_t)1);
    test_assert(cvector_get(&v, 1) == (cvector_item_t)2);
    test_assert(cvector_get(&v, 2) == (cvector_item_t)3);
    test_assert(cvector_get(&v, 3) == (cvector_item_t)4);
    test_assert(cvector_get(&v, 4) == (cvector_item_t)5);
    cvector_delete(&v, 1);
    cvector_delete(&v, 3);
    test_assert(cvector_count(&v) == (int)3);
    test_assert(cvector_get(&v, 0) == (cvector_item_t)1);
    test_assert(cvector_get(&v, 1) == (cvector_item_t)3);
    test_assert(cvector_get(&v, 2) == (cvector_item_t)4);
    cvector_free(&v);
    int vcStress = 10000;
    for (int i = 0; i < vcStress; i++) {
        int data = ((i << 2) * 0xcafebabe) ^ 0xdeadbeef;
        cvector_add(&v, (cvector_item_t)data);
        test_assert(cvector_count(&v) == (int)(i + 1));
        test_assert(cvector_get(&v, i) == (cvector_item_t)data);
        data = (data << 7) ^ 0xbaabaabb;
        cvector_set(&v, i, (cvector_item_t)data);
        test_assert(cvector_count(&v) == (int)(i + 1));
        test_assert(cvector_get(&v, i) == (cvector_item_t)data);
    }
    cvector_free(&v);
    return test_success();
}
static void test(bool thread_usage){

    /* local variables */
    opal_pointer_array_t *array;
    value_t *test_data;
    int len_test_data,i,test_len_in_array,error_cnt;
    int ele_index;
    int use_threads,error_code;
    value_t value;

    /* initialize thread levels */
    use_threads=(int)opal_set_using_threads(thread_usage);
    
    array=OBJ_NEW(opal_pointer_array_t);
    assert(array);

    len_test_data=5;
    test_data=malloc(sizeof(value_t)*len_test_data);
    assert(test_data);

    for(i=0 ; i < len_test_data ; i++ ) {
        test_data[i].ivalue = (i+1);
    }

    /* add data to table */
    test_len_in_array=3;
    assert(len_test_data>=test_len_in_array);
    for(i=0 ; i < test_len_in_array ; i++ ) {
        opal_pointer_array_add(array,test_data[i].cvalue);
    }
    /* check to see that test_len_in_array are in array */
    if( (array->size - array->number_free) == test_len_in_array) {
        test_success();
    } else {
        test_failure("check on number of elments in array");
    }

    /* check order of data */
    error_cnt=0;
    for(i=0 ; i < test_len_in_array ; i++ ) {
        value.cvalue = array->addr[i];
        if( (i+1) != value.ivalue ) {
            error_cnt++;
        }
    }
    if( 0 == error_cnt ) {
        test_success();
    } else {
        test_failure(" data check ");
    }

    /* free 2nd element and make sure that value is reset correctly,
     *   and that the lowest_index is also reset correctly */
    ele_index=1;
    error_code=opal_pointer_array_set_item(array,ele_index,NULL);
    if( 0 == error_code ) {
        test_success();
    } else {
        test_failure(" opal_pointer_array_set_item ");
    }
    if( NULL == array->addr[ele_index]){
        test_success();
    } else {
        test_failure(" set pointer value");
    }
    if( ele_index == array->lowest_free ) {
        test_success();
    } else {
        test_failure(" lowest free ");
    }

    /* test opal_pointer_array_get_item */
    array->number_free=array->size;
    array->lowest_free=0;
    for(i=0 ; i < array->size ; i++ ) {
        array->addr[i] = NULL;
    }
    error_cnt=0;
    for(i=0 ; i < array->size ; i++ ) {
        value.ivalue = i + 2;
        ele_index=opal_pointer_array_add(array, value.cvalue);
        if( i != ele_index ) {
            error_cnt++;
        }
    }
    if( 0 == error_cnt ) {
        test_success();
    } else {
        test_failure(" opal_pointer_array_add 2nd ");
    }

    error_cnt=0;
    for(i=0 ; i < array->size ; i++ ) {
        value.cvalue = opal_pointer_array_get_item(array,i);
        if( (i+2) != value.ivalue ) {
            error_cnt++;
        }
    }
    if( 0 == error_cnt ) {
        test_success();
    } else {
        test_failure(" data check - 2nd ");
    }

    free (array);
    free(test_data);
}
Esempio n. 30
0
int unistd_access_test(){
	//check the access to the executable
	int fd;
	int ret;

	test_intro("access", 0, "/app/flash/posix, F_OK");
	ret = access(EXEC_PATH, F_OK);
	if( test_success(ret) < 0 ){ return -1; }

	test_intro("access", "ENOENT", "/nomount/some/file, F_OK");
	ret = access("/nomount/some/file", F_OK);
	if( test_errno(ret, "ENOENT", ENOENT) < 0 ){ return -1; }

	test_intro("access", "ENOENT", "/nomount, F_OK");
	ret = access("/nomount", F_OK);
	if( test_errno(ret, "ENOENT", ENOENT) < 0 ){ return -1; }

	test_intro("access", "ENAMETOOLONG", "/0123456789012345678901234567890123456789012345678901234567890123456789, F_OK");
	ret = access("/0123456789012345678901234567890123456789012345678901234567890123456789", F_OK);
	if( test_errno(ret, "ENAMETOOLONG", ENAMETOOLONG) < 0 ){ return -1; }

	test_intro("access", "ENAMETOOLONG", "/0123456789/01234567890/123456789/0123/4567890/123456789012345/67890123/456/789, F_OK");
	ret = access("/0123456789/01234567890/123456789/0123/4567890/123456789012345/67890123/456/789", F_OK);
	if( test_errno(ret, "ENAMETOOLONG", ENAMETOOLONG) < 0 ){ return -1; }

	//create a file in home
	test_intro("access", 0, "/home/test.txt, W_OK");
	fd = open("/home/test.txt", O_RDWR | O_CREAT, 0666);
	if( fd < 0 ){
		return test_failed_perror();
	}
	if( write(fd, "test", 4) < 0 ){
		close(fd);
		return test_failed_perror();
	}
	if( close(fd) < 0 ){
		return test_failed_perror();
	}
	ret = access("/home/test.txt", W_OK);
	if( test_success(ret) < 0 ){ return -1; }

	test_intro("access", "EACCESS", "app/flash/posix, W_OK");
	ret = access(EXEC_PATH, W_OK);
	if( test_errno(ret, "EACCES", EACCES) < 0 ){ return -1; }


	test_intro("access", "EACCESS", "/, W_OK");
	ret = access("/", W_OK);
	if( test_errno(ret, "EACCES", EACCES) < 0 ){ return -1; }

	test_intro("access", 0, "/app/flash/posix, R_OK");
	ret = access(EXEC_PATH, R_OK);
	if( test_success(ret) < 0 ){ return -1; }


	test_intro("access", "EACCES", "/app/.install, R_OK");
	ret = access("/app/.install", R_OK);
	if( test_errno(ret, "EACCES", EACCES) < 0 ){ return -1; }


	test_intro("access", 0, "/app/flash/posix, X_OK");
	ret = access(EXEC_PATH, X_OK);
	if( test_success(ret) < 0 ){ return -1; }

	test_intro("access", "EACCES", "/app/.install, X_OK");
	ret = access("/app/.install", X_OK);
	if( test_errno(ret, "EACCES", EACCES) < 0 ){ return -1; }


	return 0;
}