projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'origin/64_and_32_bit_time_tests'
[yaffs2.git]
/
direct
/
test-framework
/
unit_tests
/
is_yaffs_working_tests
/
test_1_yaffs_mount.c
diff --git
a/direct/test-framework/timothy_tests/is_yaffs_working_tests/test_1_yaffs_mount.c
b/direct/test-framework/unit_tests/is_yaffs_working_tests/test_1_yaffs_mount.c
similarity index 69%
rename from
direct/test-framework/timothy_tests/is_yaffs_working_tests/test_1_yaffs_mount.c
rename to
direct/test-framework/unit_tests/is_yaffs_working_tests/test_1_yaffs_mount.c
index 0d908b11cf04cb3d890e0ff2eba6455891ce3c68..34d658315333be6d2d04a5f473398aaca9fe041f 100644
(file)
--- a/
direct/test-framework/timothy_tests/is_yaffs_working_tests/test_1_yaffs_mount.c
+++ b/
direct/test-framework/unit_tests/is_yaffs_working_tests/test_1_yaffs_mount.c
@@
-12,8
+12,8
@@
#include "yaffsfs.h"
#include "yaffsfs.h"
-#define YAFFS_MOUNT_POINT "/y
affs
2/"
-#define FILE_PATH "/y
affs
2/foo.txt"
+#define YAFFS_MOUNT_POINT "/y
flash
2/"
+#define FILE_PATH "/y
flash
2/foo.txt"
int random_seed;
int simulate_power_failure = 0;
int random_seed;
int simulate_power_failure = 0;
@@
-30,67
+30,69
@@
int main()
output = yaffs_mount(YAFFS_MOUNT_POINT);
if (output>=0){
output = yaffs_mount(YAFFS_MOUNT_POINT);
if (output>=0){
- printf("yaffs
mounted: %s\n",YAFFS_MOUNT_POINT);
+ printf("yaffs
correctly mounted: %s\n",YAFFS_MOUNT_POINT);
} else {
} else {
- printf("error\n yaffs failed to mount: %s\nerror\n",YAFFS_MOUNT_POINT);
- return (0);
+ printf("error\n yaffs failed to mount: %s\n with error code %d\n",YAFFS_MOUNT_POINT, yaffs_get_error());
+
+ return (-1);
}
//now create a file.
output = yaffs_open(FILE_PATH,O_CREAT | O_RDWR, S_IREAD | S_IWRITE);
if (output>=0){
}
//now create a file.
output = yaffs_open(FILE_PATH,O_CREAT | O_RDWR, S_IREAD | S_IWRITE);
if (output>=0){
- printf("
file created: %s\n",FILE_PATH);
+ printf("
yaffs correctly created a the file: %s\n",FILE_PATH);
} else {
printf("error\n yaffs failed to create the file: %s\nerror\n",FILE_PATH);
} else {
printf("error\n yaffs failed to create the file: %s\nerror\n",FILE_PATH);
- return (
0
);
+ return (
-1
);
}
output2 = yaffs_close(output);
if (output2>=0){
}
output2 = yaffs_close(output);
if (output2>=0){
- printf("
file closed: %s\n",FILE_PATH);
+ printf("
yaffs correctly closed the file: %s\n",FILE_PATH);
} else {
printf("error\n yaffs failed to close the file: %s\nerror\n",FILE_PATH);
} else {
printf("error\n yaffs failed to close the file: %s\nerror\n",FILE_PATH);
- return (
0
);
+ return (
-1
);
}
//unmount and remount the mount point.
output = yaffs_unmount(YAFFS_MOUNT_POINT);
if (output>=0){
}
//unmount and remount the mount point.
output = yaffs_unmount(YAFFS_MOUNT_POINT);
if (output>=0){
- printf("yaffs
unmounted: %s\n",YAFFS_MOUNT_POINT);
+ printf("yaffs
correctly unmounted: %s\n",YAFFS_MOUNT_POINT);
} else {
printf("error\n yaffs failed to unmount: %s\nerror\n",YAFFS_MOUNT_POINT);
} else {
printf("error\n yaffs failed to unmount: %s\nerror\n",YAFFS_MOUNT_POINT);
- return (
0
);
+ return (
-1
);
}
output = yaffs_mount(YAFFS_MOUNT_POINT);
if (output>=0){
}
output = yaffs_mount(YAFFS_MOUNT_POINT);
if (output>=0){
- printf("yaffs
mounted: %s\n",YAFFS_MOUNT_POINT);
+ printf("yaffs
correctly mounted: %s\n",YAFFS_MOUNT_POINT);
} else {
printf("error\n yaffs failed to mount: %s\nerror\n",YAFFS_MOUNT_POINT);
} else {
printf("error\n yaffs failed to mount: %s\nerror\n",YAFFS_MOUNT_POINT);
- return (
0
);
+ return (
-1
);
}
//now open the existing file.
output = yaffs_open(FILE_PATH, O_RDWR, S_IREAD | S_IWRITE);
if (output>=0){
}
//now open the existing file.
output = yaffs_open(FILE_PATH, O_RDWR, S_IREAD | S_IWRITE);
if (output>=0){
- printf("
file created: %s\n",FILE_PATH);
+ printf("
yaffs correctly opened the file: %s\n",FILE_PATH);
} else {
printf("error\n yaffs failed to create the file: %s\nerror\n",FILE_PATH);
} else {
printf("error\n yaffs failed to create the file: %s\nerror\n",FILE_PATH);
- return (
0
);
+ return (
-1
);
}
//close the file.
output2 = yaffs_close(output);
if (output2>=0){
}
//close the file.
output2 = yaffs_close(output);
if (output2>=0){
- printf("
file closed: %s\n",FILE_PATH);
+ printf("
yaffs correctly closed the file: %s\n",FILE_PATH);
} else {
printf("error\n yaffs failed to close the file: %s\nerror\n",FILE_PATH);
} else {
printf("error\n yaffs failed to close the file: %s\nerror\n",FILE_PATH);
- return (
0
);
+ return (
-1
);
}
//unmount the mount point.
output = yaffs_unmount(YAFFS_MOUNT_POINT);
if (output>=0){
}
//unmount the mount point.
output = yaffs_unmount(YAFFS_MOUNT_POINT);
if (output>=0){
- printf("yaffs
unmounted: %s\n",YAFFS_MOUNT_POINT);
+ printf("yaffs
correctly unmounted: %s\n",YAFFS_MOUNT_POINT);
} else {
printf("error\n yaffs failed to unmount: %s\nerror\n",YAFFS_MOUNT_POINT);
} else {
printf("error\n yaffs failed to unmount: %s\nerror\n",YAFFS_MOUNT_POINT);
- return (
0
);
+ return (
-1
);
}
printf("test passed. yay!\n");
}
printf("test passed. yay!\n");
+ return(0);
}
}