X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=direct%2Ftimothy_tests%2Fquick_tests%2Ftest_yaffs_truncate_ENOENT.c;fp=direct%2Ftimothy_tests%2Fquick_tests%2Ftest_yaffs_truncate_ENOENT.c;h=6258aeae97eae36e98593111b5486e08053b0d48;hb=8f3b332855f68abc47f9da5b0f1877f33f70ba15;hp=0000000000000000000000000000000000000000;hpb=9123fa7a03b5a90b4c292d7f50c98d47413ab234;p=yaffs2.git diff --git a/direct/timothy_tests/quick_tests/test_yaffs_truncate_ENOENT.c b/direct/timothy_tests/quick_tests/test_yaffs_truncate_ENOENT.c new file mode 100644 index 0000000..6258aea --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_truncate_ENOENT.c @@ -0,0 +1,47 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. + * + * Copyright (C) 2002-2010 Aleph One Ltd. + * for Toby Churchill Ltd and Brightstar Engineering + * + * Created by Timothy Manning + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include "test_yaffs_truncate_ENOENT.h" +static int handle=0; + +int test_yaffs_truncate_ENOENT(void){ + int error=0; + int output=0; + handle=test_yaffs_open(); + if (handle>=0){ + output= yaffs_truncate("/yaffs2/non_existing_file",FILE_SIZE_TRUNCATED ); + if (output<0){ + error=yaffs_get_error(); + if (abs(error)==ENOENT){ + return 1; + } + else { + printf("recieved a different error than expected\n"); + return -1; + } + } + else{ + printf("truncated a nonexisting file\n"); + return -1; + } + + } + else { + printf("error opening file"); + return -1; + } +} + +int test_yaffs_truncate_ENOENT_clean(void){ + return 1; +}