From 3cd28f32ca1b05e39ee0f6e889beef8199a46026 Mon Sep 17 00:00:00 2001 From: zhushengle Date: Tue, 22 Mar 2022 17:56:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=E6=97=A0=E6=95=88?= =?UTF-8?q?=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhushengle Change-Id: I8d932d850705f2ef9d54a53403fef2a44e77a2fc --- testsuites/unittest/fs/config.gni | 29 - testsuites/unittest/fs/jffs/It_vfs_jffs.h | 1159 --- testsuites/unittest/fs/jffs/config.gni | 801 -- .../unittest/fs/jffs/full/It_jffs_001.cpp | 84 - .../unittest/fs/jffs/full/It_jffs_002.cpp | 54 - .../unittest/fs/jffs/full/It_jffs_003.cpp | 78 - .../unittest/fs/jffs/full/It_jffs_004.cpp | 60 - .../unittest/fs/jffs/full/It_jffs_005.cpp | 66 - .../unittest/fs/jffs/full/It_jffs_006.cpp | 71 - .../unittest/fs/jffs/full/It_jffs_007.cpp | 91 - .../unittest/fs/jffs/full/It_jffs_008.cpp | 68 - .../unittest/fs/jffs/full/It_jffs_009.cpp | 65 - .../unittest/fs/jffs/full/It_jffs_010.cpp | 65 - .../unittest/fs/jffs/full/It_jffs_011.cpp | 70 - .../unittest/fs/jffs/full/It_jffs_012.cpp | 64 - .../unittest/fs/jffs/full/It_jffs_013.cpp | 65 - .../unittest/fs/jffs/full/It_jffs_014.cpp | 54 - .../unittest/fs/jffs/full/It_jffs_015.cpp | 54 - .../unittest/fs/jffs/full/It_jffs_016.cpp | 72 - .../unittest/fs/jffs/full/It_jffs_017.cpp | 99 - .../unittest/fs/jffs/full/It_jffs_018.cpp | 70 - .../unittest/fs/jffs/full/It_jffs_019.cpp | 70 - .../unittest/fs/jffs/full/It_jffs_020.cpp | 70 - .../unittest/fs/jffs/full/It_jffs_021.cpp | 84 - .../unittest/fs/jffs/full/It_jffs_022.cpp | 71 - .../unittest/fs/jffs/full/It_jffs_023.cpp | 86 - .../unittest/fs/jffs/full/It_jffs_024.cpp | 94 - .../unittest/fs/jffs/full/It_jffs_025.cpp | 62 - .../unittest/fs/jffs/full/It_jffs_026.cpp | 60 - .../unittest/fs/jffs/full/It_jffs_027.cpp | 54 - .../unittest/fs/jffs/full/It_jffs_028.cpp | 92 - .../unittest/fs/jffs/full/It_jffs_029.cpp | 66 - .../unittest/fs/jffs/full/It_jffs_030.cpp | 72 - .../unittest/fs/jffs/full/It_jffs_031.cpp | 78 - .../unittest/fs/jffs/full/It_jffs_032.cpp | 70 - .../unittest/fs/jffs/full/It_jffs_033.cpp | 70 - .../unittest/fs/jffs/full/It_jffs_034.cpp | 93 - .../unittest/fs/jffs/full/It_jffs_035.cpp | 91 - .../unittest/fs/jffs/full/It_jffs_036.cpp | 67 - .../unittest/fs/jffs/full/It_jffs_037.cpp | 76 - .../unittest/fs/jffs/full/It_jffs_038.cpp | 64 - .../unittest/fs/jffs/full/It_jffs_039.cpp | 63 - .../unittest/fs/jffs/full/It_jffs_040.cpp | 218 - .../unittest/fs/jffs/full/It_jffs_041.cpp | 223 - .../unittest/fs/jffs/full/It_jffs_042.cpp | 77 - .../unittest/fs/jffs/full/It_jffs_043.cpp | 98 - .../unittest/fs/jffs/full/It_jffs_044.cpp | 195 - .../fs/jffs/full/It_test_faccessat_001.cpp | 69 - .../fs/jffs/full/It_test_faccessat_002.cpp | 64 - .../fs/jffs/full/It_test_fstatat_001.cpp | 144 - .../fs/jffs/full/It_test_fstatat_002.cpp | 198 - .../fs/jffs/full/It_test_fstatfs_001.cpp | 68 - .../fs/jffs/full/It_test_fstatfs_002.cpp | 142 - .../unittest/fs/jffs/full/It_vfs_jffs_004.cpp | 179 - .../unittest/fs/jffs/full/It_vfs_jffs_006.cpp | 125 - .../unittest/fs/jffs/full/It_vfs_jffs_007.cpp | 184 - .../unittest/fs/jffs/full/It_vfs_jffs_008.cpp | 135 - .../unittest/fs/jffs/full/It_vfs_jffs_009.cpp | 135 - .../unittest/fs/jffs/full/It_vfs_jffs_010.cpp | 140 - .../unittest/fs/jffs/full/It_vfs_jffs_011.cpp | 134 - .../unittest/fs/jffs/full/It_vfs_jffs_012.cpp | 146 - .../unittest/fs/jffs/full/It_vfs_jffs_013.cpp | 138 - .../unittest/fs/jffs/full/It_vfs_jffs_014.cpp | 127 - .../unittest/fs/jffs/full/It_vfs_jffs_015.cpp | 124 - .../unittest/fs/jffs/full/It_vfs_jffs_016.cpp | 109 - .../unittest/fs/jffs/full/It_vfs_jffs_017.cpp | 79 - .../unittest/fs/jffs/full/It_vfs_jffs_018.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_019.cpp | 115 - .../unittest/fs/jffs/full/It_vfs_jffs_020.cpp | 92 - .../unittest/fs/jffs/full/It_vfs_jffs_023.cpp | 97 - .../unittest/fs/jffs/full/It_vfs_jffs_024.cpp | 91 - .../unittest/fs/jffs/full/It_vfs_jffs_025.cpp | 88 - .../unittest/fs/jffs/full/It_vfs_jffs_028.cpp | 103 - .../unittest/fs/jffs/full/It_vfs_jffs_029.cpp | 107 - .../unittest/fs/jffs/full/It_vfs_jffs_030.cpp | 103 - .../unittest/fs/jffs/full/It_vfs_jffs_031.cpp | 91 - .../unittest/fs/jffs/full/It_vfs_jffs_032.cpp | 117 - .../unittest/fs/jffs/full/It_vfs_jffs_033.cpp | 106 - .../unittest/fs/jffs/full/It_vfs_jffs_037.cpp | 104 - .../unittest/fs/jffs/full/It_vfs_jffs_038.cpp | 79 - .../unittest/fs/jffs/full/It_vfs_jffs_039.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_040.cpp | 101 - .../unittest/fs/jffs/full/It_vfs_jffs_041.cpp | 90 - .../unittest/fs/jffs/full/It_vfs_jffs_042.cpp | 84 - .../unittest/fs/jffs/full/It_vfs_jffs_043.cpp | 53 - .../unittest/fs/jffs/full/It_vfs_jffs_044.cpp | 59 - .../unittest/fs/jffs/full/It_vfs_jffs_045.cpp | 97 - .../unittest/fs/jffs/full/It_vfs_jffs_046.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_048.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_049.cpp | 88 - .../unittest/fs/jffs/full/It_vfs_jffs_050.cpp | 101 - .../unittest/fs/jffs/full/It_vfs_jffs_051.cpp | 276 - .../unittest/fs/jffs/full/It_vfs_jffs_053.cpp | 110 - .../unittest/fs/jffs/full/It_vfs_jffs_055.cpp | 73 - .../unittest/fs/jffs/full/It_vfs_jffs_056.cpp | 136 - .../unittest/fs/jffs/full/It_vfs_jffs_057.cpp | 89 - .../unittest/fs/jffs/full/It_vfs_jffs_058.cpp | 90 - .../unittest/fs/jffs/full/It_vfs_jffs_059.cpp | 91 - .../unittest/fs/jffs/full/It_vfs_jffs_060.cpp | 59 - .../unittest/fs/jffs/full/It_vfs_jffs_061.cpp | 66 - .../unittest/fs/jffs/full/It_vfs_jffs_062.cpp | 70 - .../unittest/fs/jffs/full/It_vfs_jffs_063.cpp | 120 - .../unittest/fs/jffs/full/It_vfs_jffs_064.cpp | 57 - .../unittest/fs/jffs/full/It_vfs_jffs_065.cpp | 88 - .../unittest/fs/jffs/full/It_vfs_jffs_066.cpp | 81 - .../unittest/fs/jffs/full/It_vfs_jffs_067.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_068.cpp | 135 - .../unittest/fs/jffs/full/It_vfs_jffs_069.cpp | 100 - .../unittest/fs/jffs/full/It_vfs_jffs_070.cpp | 109 - .../unittest/fs/jffs/full/It_vfs_jffs_071.cpp | 116 - .../unittest/fs/jffs/full/It_vfs_jffs_072.cpp | 71 - .../unittest/fs/jffs/full/It_vfs_jffs_073.cpp | 72 - .../unittest/fs/jffs/full/It_vfs_jffs_074.cpp | 96 - .../unittest/fs/jffs/full/It_vfs_jffs_076.cpp | 76 - .../unittest/fs/jffs/full/It_vfs_jffs_077.cpp | 78 - .../unittest/fs/jffs/full/It_vfs_jffs_078.cpp | 86 - .../unittest/fs/jffs/full/It_vfs_jffs_079.cpp | 89 - .../unittest/fs/jffs/full/It_vfs_jffs_080.cpp | 88 - .../unittest/fs/jffs/full/It_vfs_jffs_081.cpp | 76 - .../unittest/fs/jffs/full/It_vfs_jffs_082.cpp | 78 - .../unittest/fs/jffs/full/It_vfs_jffs_083.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_084.cpp | 91 - .../unittest/fs/jffs/full/It_vfs_jffs_085.cpp | 96 - .../unittest/fs/jffs/full/It_vfs_jffs_086.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_088.cpp | 75 - .../unittest/fs/jffs/full/It_vfs_jffs_090.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_092.cpp | 84 - .../unittest/fs/jffs/full/It_vfs_jffs_093.cpp | 105 - .../unittest/fs/jffs/full/It_vfs_jffs_096.cpp | 85 - .../unittest/fs/jffs/full/It_vfs_jffs_097.cpp | 109 - .../unittest/fs/jffs/full/It_vfs_jffs_099.cpp | 142 - .../unittest/fs/jffs/full/It_vfs_jffs_100.cpp | 142 - .../unittest/fs/jffs/full/It_vfs_jffs_101.cpp | 175 - .../unittest/fs/jffs/full/It_vfs_jffs_102.cpp | 178 - .../unittest/fs/jffs/full/It_vfs_jffs_104.cpp | 156 - .../unittest/fs/jffs/full/It_vfs_jffs_105.cpp | 177 - .../unittest/fs/jffs/full/It_vfs_jffs_106.cpp | 177 - .../unittest/fs/jffs/full/It_vfs_jffs_107.cpp | 153 - .../unittest/fs/jffs/full/It_vfs_jffs_116.cpp | 119 - .../unittest/fs/jffs/full/It_vfs_jffs_117.cpp | 125 - .../unittest/fs/jffs/full/It_vfs_jffs_118.cpp | 121 - .../unittest/fs/jffs/full/It_vfs_jffs_119.cpp | 121 - .../unittest/fs/jffs/full/It_vfs_jffs_120.cpp | 121 - .../unittest/fs/jffs/full/It_vfs_jffs_121.cpp | 121 - .../unittest/fs/jffs/full/It_vfs_jffs_122.cpp | 98 - .../unittest/fs/jffs/full/It_vfs_jffs_123.cpp | 99 - .../unittest/fs/jffs/full/It_vfs_jffs_124.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_125.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_126.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_127.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_128.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_129.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_130.cpp | 81 - .../unittest/fs/jffs/full/It_vfs_jffs_131.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_132.cpp | 81 - .../unittest/fs/jffs/full/It_vfs_jffs_133.cpp | 79 - .../unittest/fs/jffs/full/It_vfs_jffs_134.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_135.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_136.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_137.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_138.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_139.cpp | 79 - .../unittest/fs/jffs/full/It_vfs_jffs_140.cpp | 79 - .../unittest/fs/jffs/full/It_vfs_jffs_141.cpp | 79 - .../unittest/fs/jffs/full/It_vfs_jffs_142.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_143.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_144.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_145.cpp | 81 - .../unittest/fs/jffs/full/It_vfs_jffs_146.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_147.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_148.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_149.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_150.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_151.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_152.cpp | 81 - .../unittest/fs/jffs/full/It_vfs_jffs_153.cpp | 81 - .../unittest/fs/jffs/full/It_vfs_jffs_154.cpp | 81 - .../unittest/fs/jffs/full/It_vfs_jffs_155.cpp | 64 - .../unittest/fs/jffs/full/It_vfs_jffs_156.cpp | 64 - .../unittest/fs/jffs/full/It_vfs_jffs_157.cpp | 65 - .../unittest/fs/jffs/full/It_vfs_jffs_158.cpp | 65 - .../unittest/fs/jffs/full/It_vfs_jffs_159.cpp | 64 - .../unittest/fs/jffs/full/It_vfs_jffs_160.cpp | 65 - .../unittest/fs/jffs/full/It_vfs_jffs_161.cpp | 64 - .../unittest/fs/jffs/full/It_vfs_jffs_162.cpp | 65 - .../unittest/fs/jffs/full/It_vfs_jffs_163.cpp | 65 - .../unittest/fs/jffs/full/It_vfs_jffs_164.cpp | 79 - .../unittest/fs/jffs/full/It_vfs_jffs_165.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_166.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_167.cpp | 76 - .../unittest/fs/jffs/full/It_vfs_jffs_168.cpp | 76 - .../unittest/fs/jffs/full/It_vfs_jffs_169.cpp | 73 - .../unittest/fs/jffs/full/It_vfs_jffs_170.cpp | 81 - .../unittest/fs/jffs/full/It_vfs_jffs_171.cpp | 77 - .../unittest/fs/jffs/full/It_vfs_jffs_172.cpp | 77 - .../unittest/fs/jffs/full/It_vfs_jffs_173.cpp | 78 - .../unittest/fs/jffs/full/It_vfs_jffs_174.cpp | 106 - .../unittest/fs/jffs/full/It_vfs_jffs_175.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_176.cpp | 75 - .../unittest/fs/jffs/full/It_vfs_jffs_177.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_178.cpp | 101 - .../unittest/fs/jffs/full/It_vfs_jffs_179.cpp | 101 - .../unittest/fs/jffs/full/It_vfs_jffs_180.cpp | 96 - .../unittest/fs/jffs/full/It_vfs_jffs_182.cpp | 94 - .../unittest/fs/jffs/full/It_vfs_jffs_183.cpp | 94 - .../unittest/fs/jffs/full/It_vfs_jffs_184.cpp | 94 - .../unittest/fs/jffs/full/It_vfs_jffs_185.cpp | 93 - .../unittest/fs/jffs/full/It_vfs_jffs_187.cpp | 95 - .../unittest/fs/jffs/full/It_vfs_jffs_188.cpp | 69 - .../unittest/fs/jffs/full/It_vfs_jffs_189.cpp | 71 - .../unittest/fs/jffs/full/It_vfs_jffs_190.cpp | 66 - .../unittest/fs/jffs/full/It_vfs_jffs_191.cpp | 66 - .../unittest/fs/jffs/full/It_vfs_jffs_192.cpp | 66 - .../unittest/fs/jffs/full/It_vfs_jffs_193.cpp | 71 - .../unittest/fs/jffs/full/It_vfs_jffs_194.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_195.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_196.cpp | 74 - .../unittest/fs/jffs/full/It_vfs_jffs_197.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_198.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_199.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_200.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_201.cpp | 103 - .../unittest/fs/jffs/full/It_vfs_jffs_202.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_203.cpp | 66 - .../unittest/fs/jffs/full/It_vfs_jffs_204.cpp | 84 - .../unittest/fs/jffs/full/It_vfs_jffs_205.cpp | 77 - .../unittest/fs/jffs/full/It_vfs_jffs_206.cpp | 86 - .../unittest/fs/jffs/full/It_vfs_jffs_207.cpp | 111 - .../unittest/fs/jffs/full/It_vfs_jffs_208.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_209.cpp | 100 - .../unittest/fs/jffs/full/It_vfs_jffs_210.cpp | 99 - .../unittest/fs/jffs/full/It_vfs_jffs_211.cpp | 85 - .../unittest/fs/jffs/full/It_vfs_jffs_212.cpp | 66 - .../unittest/fs/jffs/full/It_vfs_jffs_213.cpp | 66 - .../unittest/fs/jffs/full/It_vfs_jffs_214.cpp | 66 - .../unittest/fs/jffs/full/It_vfs_jffs_215.cpp | 70 - .../unittest/fs/jffs/full/It_vfs_jffs_216.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_217.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_218.cpp | 81 - .../unittest/fs/jffs/full/It_vfs_jffs_219.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_220.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_221.cpp | 66 - .../unittest/fs/jffs/full/It_vfs_jffs_222.cpp | 66 - .../unittest/fs/jffs/full/It_vfs_jffs_223.cpp | 85 - .../unittest/fs/jffs/full/It_vfs_jffs_224.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_225.cpp | 75 - .../unittest/fs/jffs/full/It_vfs_jffs_226.cpp | 70 - .../unittest/fs/jffs/full/It_vfs_jffs_227.cpp | 70 - .../unittest/fs/jffs/full/It_vfs_jffs_228.cpp | 70 - .../unittest/fs/jffs/full/It_vfs_jffs_229.cpp | 70 - .../unittest/fs/jffs/full/It_vfs_jffs_230.cpp | 71 - .../unittest/fs/jffs/full/It_vfs_jffs_231.cpp | 72 - .../unittest/fs/jffs/full/It_vfs_jffs_232.cpp | 71 - .../unittest/fs/jffs/full/It_vfs_jffs_233.cpp | 70 - .../unittest/fs/jffs/full/It_vfs_jffs_234.cpp | 65 - .../unittest/fs/jffs/full/It_vfs_jffs_235.cpp | 65 - .../unittest/fs/jffs/full/It_vfs_jffs_236.cpp | 70 - .../unittest/fs/jffs/full/It_vfs_jffs_237.cpp | 66 - .../unittest/fs/jffs/full/It_vfs_jffs_238.cpp | 66 - .../unittest/fs/jffs/full/It_vfs_jffs_239.cpp | 65 - .../unittest/fs/jffs/full/It_vfs_jffs_240.cpp | 65 - .../unittest/fs/jffs/full/It_vfs_jffs_241.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_242.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_243.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_244.cpp | 73 - .../unittest/fs/jffs/full/It_vfs_jffs_245.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_246.cpp | 63 - .../unittest/fs/jffs/full/It_vfs_jffs_247.cpp | 76 - .../unittest/fs/jffs/full/It_vfs_jffs_248.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_249.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_250.cpp | 63 - .../unittest/fs/jffs/full/It_vfs_jffs_251.cpp | 66 - .../unittest/fs/jffs/full/It_vfs_jffs_252.cpp | 81 - .../unittest/fs/jffs/full/It_vfs_jffs_253.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_254.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_255.cpp | 69 - .../unittest/fs/jffs/full/It_vfs_jffs_256.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_257.cpp | 69 - .../unittest/fs/jffs/full/It_vfs_jffs_258.cpp | 70 - .../unittest/fs/jffs/full/It_vfs_jffs_259.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_260.cpp | 69 - .../unittest/fs/jffs/full/It_vfs_jffs_261.cpp | 69 - .../unittest/fs/jffs/full/It_vfs_jffs_262.cpp | 71 - .../unittest/fs/jffs/full/It_vfs_jffs_263.cpp | 71 - .../unittest/fs/jffs/full/It_vfs_jffs_264.cpp | 84 - .../unittest/fs/jffs/full/It_vfs_jffs_265.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_266.cpp | 72 - .../unittest/fs/jffs/full/It_vfs_jffs_267.cpp | 88 - .../unittest/fs/jffs/full/It_vfs_jffs_268.cpp | 78 - .../unittest/fs/jffs/full/It_vfs_jffs_269.cpp | 76 - .../unittest/fs/jffs/full/It_vfs_jffs_270.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_271.cpp | 95 - .../unittest/fs/jffs/full/It_vfs_jffs_272.cpp | 86 - .../unittest/fs/jffs/full/It_vfs_jffs_273.cpp | 103 - .../unittest/fs/jffs/full/It_vfs_jffs_274.cpp | 76 - .../unittest/fs/jffs/full/It_vfs_jffs_275.cpp | 71 - .../unittest/fs/jffs/full/It_vfs_jffs_276.cpp | 71 - .../unittest/fs/jffs/full/It_vfs_jffs_277.cpp | 70 - .../unittest/fs/jffs/full/It_vfs_jffs_278.cpp | 70 - .../unittest/fs/jffs/full/It_vfs_jffs_279.cpp | 71 - .../unittest/fs/jffs/full/It_vfs_jffs_280.cpp | 72 - .../unittest/fs/jffs/full/It_vfs_jffs_281.cpp | 81 - .../unittest/fs/jffs/full/It_vfs_jffs_282.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_283.cpp | 70 - .../unittest/fs/jffs/full/It_vfs_jffs_284.cpp | 85 - .../unittest/fs/jffs/full/It_vfs_jffs_285.cpp | 74 - .../unittest/fs/jffs/full/It_vfs_jffs_286.cpp | 72 - .../unittest/fs/jffs/full/It_vfs_jffs_287.cpp | 70 - .../unittest/fs/jffs/full/It_vfs_jffs_288.cpp | 72 - .../unittest/fs/jffs/full/It_vfs_jffs_289.cpp | 72 - .../unittest/fs/jffs/full/It_vfs_jffs_290.cpp | 77 - .../unittest/fs/jffs/full/It_vfs_jffs_291.cpp | 76 - .../unittest/fs/jffs/full/It_vfs_jffs_292.cpp | 72 - .../unittest/fs/jffs/full/It_vfs_jffs_293.cpp | 72 - .../unittest/fs/jffs/full/It_vfs_jffs_294.cpp | 86 - .../unittest/fs/jffs/full/It_vfs_jffs_295.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_296.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_297.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_298.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_299.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_300.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_301.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_302.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_303.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_304.cpp | 77 - .../unittest/fs/jffs/full/It_vfs_jffs_305.cpp | 72 - .../unittest/fs/jffs/full/It_vfs_jffs_306.cpp | 78 - .../unittest/fs/jffs/full/It_vfs_jffs_307.cpp | 78 - .../unittest/fs/jffs/full/It_vfs_jffs_308.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_309.cpp | 78 - .../unittest/fs/jffs/full/It_vfs_jffs_310.cpp | 78 - .../unittest/fs/jffs/full/It_vfs_jffs_311.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_312.cpp | 66 - .../unittest/fs/jffs/full/It_vfs_jffs_313.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_314.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_315.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_316.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_317.cpp | 74 - .../unittest/fs/jffs/full/It_vfs_jffs_318.cpp | 86 - .../unittest/fs/jffs/full/It_vfs_jffs_319.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_320.cpp | 86 - .../unittest/fs/jffs/full/It_vfs_jffs_321.cpp | 78 - .../unittest/fs/jffs/full/It_vfs_jffs_322.cpp | 91 - .../unittest/fs/jffs/full/It_vfs_jffs_323.cpp | 91 - .../unittest/fs/jffs/full/It_vfs_jffs_324.cpp | 89 - .../unittest/fs/jffs/full/It_vfs_jffs_325.cpp | 88 - .../unittest/fs/jffs/full/It_vfs_jffs_326.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_327.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_328.cpp | 76 - .../unittest/fs/jffs/full/It_vfs_jffs_329.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_330.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_331.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_332.cpp | 78 - .../unittest/fs/jffs/full/It_vfs_jffs_333.cpp | 78 - .../unittest/fs/jffs/full/It_vfs_jffs_334.cpp | 78 - .../unittest/fs/jffs/full/It_vfs_jffs_335.cpp | 78 - .../unittest/fs/jffs/full/It_vfs_jffs_336.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_337.cpp | 78 - .../unittest/fs/jffs/full/It_vfs_jffs_338.cpp | 78 - .../unittest/fs/jffs/full/It_vfs_jffs_339.cpp | 96 - .../unittest/fs/jffs/full/It_vfs_jffs_340.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_342.cpp | 90 - .../unittest/fs/jffs/full/It_vfs_jffs_343.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_344.cpp | 91 - .../unittest/fs/jffs/full/It_vfs_jffs_346.cpp | 81 - .../unittest/fs/jffs/full/It_vfs_jffs_352.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_353.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_354.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_355.cpp | 86 - .../unittest/fs/jffs/full/It_vfs_jffs_356.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_357.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_358.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_359.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_360.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_361.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_362.cpp | 79 - .../unittest/fs/jffs/full/It_vfs_jffs_364.cpp | 78 - .../unittest/fs/jffs/full/It_vfs_jffs_365.cpp | 78 - .../unittest/fs/jffs/full/It_vfs_jffs_366.cpp | 76 - .../unittest/fs/jffs/full/It_vfs_jffs_367.cpp | 76 - .../unittest/fs/jffs/full/It_vfs_jffs_368.cpp | 79 - .../unittest/fs/jffs/full/It_vfs_jffs_369.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_370.cpp | 76 - .../unittest/fs/jffs/full/It_vfs_jffs_371.cpp | 76 - .../unittest/fs/jffs/full/It_vfs_jffs_372.cpp | 77 - .../unittest/fs/jffs/full/It_vfs_jffs_373.cpp | 79 - .../unittest/fs/jffs/full/It_vfs_jffs_374.cpp | 76 - .../unittest/fs/jffs/full/It_vfs_jffs_375.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_376.cpp | 74 - .../unittest/fs/jffs/full/It_vfs_jffs_377.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_378.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_379.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_380.cpp | 84 - .../unittest/fs/jffs/full/It_vfs_jffs_381.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_382.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_383.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_384.cpp | 84 - .../unittest/fs/jffs/full/It_vfs_jffs_385.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_386.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_387.cpp | 91 - .../unittest/fs/jffs/full/It_vfs_jffs_388.cpp | 80 - .../unittest/fs/jffs/full/It_vfs_jffs_389.cpp | 74 - .../unittest/fs/jffs/full/It_vfs_jffs_390.cpp | 88 - .../unittest/fs/jffs/full/It_vfs_jffs_391.cpp | 88 - .../unittest/fs/jffs/full/It_vfs_jffs_392.cpp | 97 - .../unittest/fs/jffs/full/It_vfs_jffs_393.cpp | 89 - .../unittest/fs/jffs/full/It_vfs_jffs_394.cpp | 89 - .../unittest/fs/jffs/full/It_vfs_jffs_395.cpp | 82 - .../unittest/fs/jffs/full/It_vfs_jffs_396.cpp | 79 - .../unittest/fs/jffs/full/It_vfs_jffs_397.cpp | 79 - .../unittest/fs/jffs/full/It_vfs_jffs_398.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_399.cpp | 79 - .../unittest/fs/jffs/full/It_vfs_jffs_400.cpp | 81 - .../unittest/fs/jffs/full/It_vfs_jffs_401.cpp | 79 - .../unittest/fs/jffs/full/It_vfs_jffs_402.cpp | 79 - .../unittest/fs/jffs/full/It_vfs_jffs_403.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_404.cpp | 95 - .../unittest/fs/jffs/full/It_vfs_jffs_405.cpp | 95 - .../unittest/fs/jffs/full/It_vfs_jffs_406.cpp | 94 - .../unittest/fs/jffs/full/It_vfs_jffs_407.cpp | 95 - .../unittest/fs/jffs/full/It_vfs_jffs_408.cpp | 94 - .../unittest/fs/jffs/full/It_vfs_jffs_409.cpp | 92 - .../unittest/fs/jffs/full/It_vfs_jffs_410.cpp | 101 - .../unittest/fs/jffs/full/It_vfs_jffs_411.cpp | 89 - .../unittest/fs/jffs/full/It_vfs_jffs_412.cpp | 95 - .../unittest/fs/jffs/full/It_vfs_jffs_413.cpp | 108 - .../unittest/fs/jffs/full/It_vfs_jffs_414.cpp | 112 - .../unittest/fs/jffs/full/It_vfs_jffs_415.cpp | 170 - .../unittest/fs/jffs/full/It_vfs_jffs_416.cpp | 161 - .../unittest/fs/jffs/full/It_vfs_jffs_417.cpp | 161 - .../unittest/fs/jffs/full/It_vfs_jffs_418.cpp | 161 - .../unittest/fs/jffs/full/It_vfs_jffs_419.cpp | 161 - .../unittest/fs/jffs/full/It_vfs_jffs_420.cpp | 161 - .../unittest/fs/jffs/full/It_vfs_jffs_421.cpp | 161 - .../unittest/fs/jffs/full/It_vfs_jffs_422.cpp | 161 - .../unittest/fs/jffs/full/It_vfs_jffs_423.cpp | 161 - .../unittest/fs/jffs/full/It_vfs_jffs_424.cpp | 171 - .../unittest/fs/jffs/full/It_vfs_jffs_425.cpp | 175 - .../unittest/fs/jffs/full/It_vfs_jffs_426.cpp | 175 - .../unittest/fs/jffs/full/It_vfs_jffs_427.cpp | 175 - .../unittest/fs/jffs/full/It_vfs_jffs_428.cpp | 175 - .../unittest/fs/jffs/full/It_vfs_jffs_429.cpp | 175 - .../unittest/fs/jffs/full/It_vfs_jffs_430.cpp | 175 - .../unittest/fs/jffs/full/It_vfs_jffs_431.cpp | 175 - .../unittest/fs/jffs/full/It_vfs_jffs_432.cpp | 175 - .../unittest/fs/jffs/full/It_vfs_jffs_433.cpp | 101 - .../unittest/fs/jffs/full/It_vfs_jffs_434.cpp | 79 - .../unittest/fs/jffs/full/It_vfs_jffs_435.cpp | 75 - .../unittest/fs/jffs/full/It_vfs_jffs_454.cpp | 88 - .../unittest/fs/jffs/full/It_vfs_jffs_455.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_456.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_457.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_458.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_459.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_460.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_461.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_462.cpp | 90 - .../unittest/fs/jffs/full/It_vfs_jffs_487.cpp | 90 - .../unittest/fs/jffs/full/It_vfs_jffs_488.cpp | 119 - .../unittest/fs/jffs/full/It_vfs_jffs_489.cpp | 112 - .../unittest/fs/jffs/full/It_vfs_jffs_490.cpp | 133 - .../unittest/fs/jffs/full/It_vfs_jffs_491.cpp | 133 - .../unittest/fs/jffs/full/It_vfs_jffs_492.cpp | 166 - .../unittest/fs/jffs/full/It_vfs_jffs_493.cpp | 133 - .../unittest/fs/jffs/full/It_vfs_jffs_494.cpp | 135 - .../unittest/fs/jffs/full/It_vfs_jffs_495.cpp | 133 - .../unittest/fs/jffs/full/It_vfs_jffs_496.cpp | 135 - .../unittest/fs/jffs/full/It_vfs_jffs_497.cpp | 133 - .../unittest/fs/jffs/full/It_vfs_jffs_498.cpp | 135 - .../unittest/fs/jffs/full/It_vfs_jffs_499.cpp | 135 - .../unittest/fs/jffs/full/It_vfs_jffs_500.cpp | 135 - .../unittest/fs/jffs/full/It_vfs_jffs_501.cpp | 137 - .../unittest/fs/jffs/full/It_vfs_jffs_502.cpp | 119 - .../unittest/fs/jffs/full/It_vfs_jffs_503.cpp | 112 - .../unittest/fs/jffs/full/It_vfs_jffs_504.cpp | 135 - .../unittest/fs/jffs/full/It_vfs_jffs_505.cpp | 125 - .../unittest/fs/jffs/full/It_vfs_jffs_506.cpp | 174 - .../unittest/fs/jffs/full/It_vfs_jffs_507.cpp | 142 - .../unittest/fs/jffs/full/It_vfs_jffs_508.cpp | 141 - .../unittest/fs/jffs/full/It_vfs_jffs_509.cpp | 141 - .../unittest/fs/jffs/full/It_vfs_jffs_510.cpp | 141 - .../unittest/fs/jffs/full/It_vfs_jffs_511.cpp | 140 - .../unittest/fs/jffs/full/It_vfs_jffs_512.cpp | 139 - .../unittest/fs/jffs/full/It_vfs_jffs_513.cpp | 141 - .../unittest/fs/jffs/full/It_vfs_jffs_514.cpp | 141 - .../unittest/fs/jffs/full/It_vfs_jffs_515.cpp | 144 - .../unittest/fs/jffs/full/It_vfs_jffs_516.cpp | 88 - .../unittest/fs/jffs/full/It_vfs_jffs_517.cpp | 84 - .../unittest/fs/jffs/full/It_vfs_jffs_518.cpp | 72 - .../unittest/fs/jffs/full/It_vfs_jffs_519.cpp | 72 - .../unittest/fs/jffs/full/It_vfs_jffs_520.cpp | 91 - .../unittest/fs/jffs/full/It_vfs_jffs_521.cpp | 89 - .../unittest/fs/jffs/full/It_vfs_jffs_522.cpp | 94 - .../unittest/fs/jffs/full/It_vfs_jffs_523.cpp | 89 - .../unittest/fs/jffs/full/It_vfs_jffs_524.cpp | 94 - .../unittest/fs/jffs/full/It_vfs_jffs_526.cpp | 90 - .../unittest/fs/jffs/full/It_vfs_jffs_528.cpp | 114 - .../unittest/fs/jffs/full/It_vfs_jffs_529.cpp | 88 - .../unittest/fs/jffs/full/It_vfs_jffs_530.cpp | 96 - .../unittest/fs/jffs/full/It_vfs_jffs_531.cpp | 85 - .../unittest/fs/jffs/full/It_vfs_jffs_532.cpp | 85 - .../unittest/fs/jffs/full/It_vfs_jffs_533.cpp | 85 - .../unittest/fs/jffs/full/It_vfs_jffs_534.cpp | 101 - .../unittest/fs/jffs/full/It_vfs_jffs_541.cpp | 91 - .../unittest/fs/jffs/full/It_vfs_jffs_542.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_543.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_544.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_545.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_546.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_547.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_548.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_549.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_550.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_551.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_552.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_553.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_554.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_555.cpp | 84 - .../unittest/fs/jffs/full/It_vfs_jffs_556.cpp | 84 - .../unittest/fs/jffs/full/It_vfs_jffs_557.cpp | 84 - .../unittest/fs/jffs/full/It_vfs_jffs_560.cpp | 88 - .../unittest/fs/jffs/full/It_vfs_jffs_562.cpp | 75 - .../unittest/fs/jffs/full/It_vfs_jffs_563.cpp | 74 - .../unittest/fs/jffs/full/It_vfs_jffs_564.cpp | 74 - .../unittest/fs/jffs/full/It_vfs_jffs_565.cpp | 90 - .../unittest/fs/jffs/full/It_vfs_jffs_566.cpp | 77 - .../unittest/fs/jffs/full/It_vfs_jffs_567.cpp | 83 - .../unittest/fs/jffs/full/It_vfs_jffs_568.cpp | 79 - .../unittest/fs/jffs/full/It_vfs_jffs_569.cpp | 84 - .../unittest/fs/jffs/full/It_vfs_jffs_570.cpp | 84 - .../unittest/fs/jffs/full/It_vfs_jffs_571.cpp | 88 - .../unittest/fs/jffs/full/It_vfs_jffs_572.cpp | 84 - .../unittest/fs/jffs/full/It_vfs_jffs_573.cpp | 84 - .../unittest/fs/jffs/full/It_vfs_jffs_574.cpp | 125 - .../unittest/fs/jffs/full/It_vfs_jffs_583.cpp | 68 - .../unittest/fs/jffs/full/It_vfs_jffs_584.cpp | 71 - .../unittest/fs/jffs/full/It_vfs_jffs_586.cpp | 92 - .../unittest/fs/jffs/full/It_vfs_jffs_589.cpp | 88 - .../unittest/fs/jffs/full/It_vfs_jffs_590.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_591.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_592.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_593.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_594.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_595.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_596.cpp | 87 - .../unittest/fs/jffs/full/It_vfs_jffs_603.cpp | 90 - .../unittest/fs/jffs/full/It_vfs_jffs_636.cpp | 89 - .../unittest/fs/jffs/full/It_vfs_jffs_643.cpp | 119 - .../unittest/fs/jffs/full/It_vfs_jffs_644.cpp | 112 - .../unittest/fs/jffs/full/It_vfs_jffs_645.cpp | 133 - .../unittest/fs/jffs/full/It_vfs_jffs_646.cpp | 133 - .../unittest/fs/jffs/full/It_vfs_jffs_648.cpp | 133 - .../unittest/fs/jffs/full/It_vfs_jffs_649.cpp | 135 - .../unittest/fs/jffs/full/It_vfs_jffs_650.cpp | 133 - .../unittest/fs/jffs/full/It_vfs_jffs_651.cpp | 135 - .../unittest/fs/jffs/full/It_vfs_jffs_652.cpp | 133 - .../unittest/fs/jffs/full/It_vfs_jffs_653.cpp | 135 - .../unittest/fs/jffs/full/It_vfs_jffs_654.cpp | 135 - .../unittest/fs/jffs/full/It_vfs_jffs_655.cpp | 135 - .../unittest/fs/jffs/full/It_vfs_jffs_656.cpp | 137 - .../unittest/fs/jffs/full/It_vfs_jffs_663.cpp | 119 - .../unittest/fs/jffs/full/It_vfs_jffs_664.cpp | 112 - .../unittest/fs/jffs/full/It_vfs_jffs_665.cpp | 135 - .../unittest/fs/jffs/full/It_vfs_jffs_666.cpp | 125 - .../unittest/fs/jffs/full/It_vfs_jffs_668.cpp | 142 - .../unittest/fs/jffs/full/It_vfs_jffs_669.cpp | 141 - .../unittest/fs/jffs/full/It_vfs_jffs_670.cpp | 141 - .../unittest/fs/jffs/full/It_vfs_jffs_671.cpp | 141 - .../unittest/fs/jffs/full/It_vfs_jffs_672.cpp | 140 - .../unittest/fs/jffs/full/It_vfs_jffs_673.cpp | 139 - .../unittest/fs/jffs/full/It_vfs_jffs_674.cpp | 141 - .../unittest/fs/jffs/full/It_vfs_jffs_675.cpp | 141 - .../unittest/fs/jffs/full/It_vfs_jffs_676.cpp | 144 - .../unittest/fs/jffs/full/It_vfs_jffs_690.cpp | 88 - .../unittest/fs/jffs/full/It_vfs_jffs_694.cpp | 84 - .../unittest/fs/jffs/full/It_vfs_jffs_696.cpp | 72 - .../unittest/fs/jffs/full/It_vfs_jffs_697.cpp | 72 - .../unittest/fs/jffs/full/It_vfs_jffs_700.cpp | 67 - .../unittest/fs/jffs/full/It_vfs_jffs_701.cpp | 72 - .../unittest/fs/jffs/full/It_vfs_jffs_807.cpp | 130 - .../unittest/fs/jffs/full/It_vfs_jffs_808.cpp | 116 - .../fs/jffs/full/It_vfs_test_link_001.cpp | 116 - .../fs/jffs/full/It_vfs_test_link_002.cpp | 97 - .../fs/jffs/full/It_vfs_test_link_003.cpp | 110 - .../fs/jffs/full/It_vfs_test_linkat_001.cpp | 134 - .../fs/jffs/full/It_vfs_test_linkat_002.cpp | 205 - .../fs/jffs/full/It_vfs_test_linkat_003.cpp | 183 - .../full/It_vfs_test_mount_rdonly_001.cpp | 93 - .../full/It_vfs_test_mount_rdonly_002.cpp | 79 - .../full/It_vfs_test_mount_rdonly_003.cpp | 95 - .../fs/jffs/full/It_vfs_test_readlink_001.cpp | 101 - .../fs/jffs/full/It_vfs_test_symlink_001.cpp | 103 - .../fs/jffs/full/It_vfs_test_symlink_002.cpp | 81 - .../fs/jffs/full/It_vfs_test_symlink_003.cpp | 128 - .../jffs/full/It_vfs_test_symlinkat_001.cpp | 143 - .../fs/jffs/full/it_test_fs_jffs_001.cpp | 222 - .../fs/jffs/full/it_test_fs_jffs_002.cpp | 118 - .../fs/jffs/full/it_test_fs_jffs_003.cpp | 138 - .../fs/jffs/full/it_test_fs_jffs_004.cpp | 123 - .../fs/jffs/full/it_test_fs_jffs_100.cpp | 70 - .../fs/jffs/full/it_test_fs_jffs_101.cpp | 107 - .../fs/jffs/full/it_test_fs_jffs_102.cpp | 139 - .../fs/jffs/full/it_test_fs_jffs_103.cpp | 164 - .../fs/jffs/full/it_test_fs_jffs_106.cpp | 85 - .../fs/jffs/full/it_test_fs_jffs_112.cpp | 86 - .../fs/jffs/full/it_test_fs_jffs_113.cpp | 128 - .../pressure/It_fs_jffs_performance_001.cpp | 107 - .../pressure/It_fs_jffs_performance_002.cpp | 109 - .../pressure/It_fs_jffs_performance_003.cpp | 109 - .../pressure/It_fs_jffs_performance_004.cpp | 107 - .../pressure/It_fs_jffs_performance_005.cpp | 113 - .../pressure/It_fs_jffs_performance_006.cpp | 113 - .../pressure/It_fs_jffs_performance_007.cpp | 114 - .../pressure/It_fs_jffs_performance_008.cpp | 114 - .../pressure/It_fs_jffs_performance_009.cpp | 127 - .../pressure/It_fs_jffs_performance_010.cpp | 137 - .../pressure/It_fs_jffs_performance_011.cpp | 380 - .../pressure/It_fs_jffs_performance_012.cpp | 361 - .../pressure/It_fs_jffs_performance_013.cpp | 123 - .../jffs/pressure/It_fs_jffs_pressure_001.cpp | 128 - .../jffs/pressure/It_fs_jffs_pressure_002.cpp | 195 - .../jffs/pressure/It_fs_jffs_pressure_003.cpp | 105 - .../jffs/pressure/It_fs_jffs_pressure_004.cpp | 119 - .../jffs/pressure/It_fs_jffs_pressure_005.cpp | 179 - .../jffs/pressure/It_fs_jffs_pressure_006.cpp | 129 - .../jffs/pressure/It_fs_jffs_pressure_007.cpp | 146 - .../jffs/pressure/It_fs_jffs_pressure_008.cpp | 110 - .../jffs/pressure/It_fs_jffs_pressure_009.cpp | 114 - .../jffs/pressure/It_fs_jffs_pressure_010.cpp | 125 - .../jffs/pressure/It_fs_jffs_pressure_011.cpp | 128 - .../jffs/pressure/It_fs_jffs_pressure_012.cpp | 153 - .../jffs/pressure/It_fs_jffs_pressure_014.cpp | 129 - .../jffs/pressure/It_fs_jffs_pressure_015.cpp | 118 - .../jffs/pressure/It_fs_jffs_pressure_016.cpp | 125 - .../jffs/pressure/It_fs_jffs_pressure_017.cpp | 121 - .../jffs/pressure/It_fs_jffs_pressure_018.cpp | 129 - .../jffs/pressure/It_fs_jffs_pressure_019.cpp | 156 - .../jffs/pressure/It_fs_jffs_pressure_020.cpp | 107 - .../jffs/pressure/It_fs_jffs_pressure_021.cpp | 129 - .../jffs/pressure/It_fs_jffs_pressure_022.cpp | 120 - .../jffs/pressure/It_fs_jffs_pressure_023.cpp | 153 - .../jffs/pressure/It_fs_jffs_pressure_024.cpp | 156 - .../jffs/pressure/It_fs_jffs_pressure_025.cpp | 141 - .../jffs/pressure/It_fs_jffs_pressure_026.cpp | 147 - .../jffs/pressure/It_fs_jffs_pressure_027.cpp | 105 - .../jffs/pressure/It_fs_jffs_pressure_028.cpp | 198 - .../jffs/pressure/It_fs_jffs_pressure_029.cpp | 206 - .../jffs/pressure/It_fs_jffs_pressure_030.cpp | 229 - .../jffs/pressure/It_fs_jffs_pressure_031.cpp | 287 - .../jffs/pressure/It_fs_jffs_pressure_032.cpp | 280 - .../jffs/pressure/It_fs_jffs_pressure_033.cpp | 350 - .../jffs/pressure/It_fs_jffs_pressure_034.cpp | 320 - .../jffs/pressure/It_fs_jffs_pressure_035.cpp | 357 - .../jffs/pressure/It_fs_jffs_pressure_036.cpp | 369 - .../jffs/pressure/It_fs_jffs_pressure_037.cpp | 363 - .../jffs/pressure/It_fs_jffs_pressure_038.cpp | 254 - .../jffs/pressure/It_fs_jffs_pressure_039.cpp | 360 - .../jffs/pressure/It_fs_jffs_pressure_040.cpp | 341 - .../jffs/pressure/It_fs_jffs_pressure_041.cpp | 363 - .../jffs/pressure/It_fs_jffs_pressure_042.cpp | 356 - .../jffs/pressure/It_fs_jffs_pressure_043.cpp | 408 - .../jffs/pressure/It_fs_jffs_pressure_044.cpp | 172 - .../jffs/pressure/It_fs_jffs_pressure_045.cpp | 157 - .../jffs/pressure/It_fs_jffs_pressure_046.cpp | 184 - .../jffs/pressure/It_fs_jffs_pressure_047.cpp | 192 - .../jffs/pressure/It_fs_jffs_pressure_048.cpp | 147 - .../jffs/pressure/It_fs_jffs_pressure_049.cpp | 139 - .../jffs/pressure/It_fs_jffs_pressure_050.cpp | 198 - .../jffs/pressure/It_fs_jffs_pressure_051.cpp | 166 - .../jffs/pressure/It_fs_jffs_pressure_052.cpp | 199 - .../jffs/pressure/It_fs_jffs_pressure_053.cpp | 283 - .../jffs/pressure/It_fs_jffs_pressure_301.cpp | 106 - .../jffs/pressure/It_fs_jffs_pressure_302.cpp | 102 - .../jffs/pressure/It_fs_jffs_pressure_303.cpp | 101 - .../jffs/pressure/It_fs_jffs_pressure_304.cpp | 118 - .../jffs/pressure/It_fs_jffs_pressure_305.cpp | 91 - .../jffs/pressure/It_fs_jffs_pressure_306.cpp | 80 - .../jffs/pressure/It_fs_jffs_pressure_307.cpp | 126 - .../jffs/pressure/It_fs_jffs_pressure_308.cpp | 102 - .../jffs/pressure/It_fs_jffs_pressure_309.cpp | 103 - .../jffs/pressure/It_fs_jffs_pressure_310.cpp | 202 - .../jffs/pressure/It_fs_jffs_pressure_311.cpp | 199 - .../jffs/pressure/It_fs_jffs_pressure_312.cpp | 82 - .../jffs/pressure/It_fs_jffs_pressure_313.cpp | 87 - .../jffs/pressure/It_fs_jffs_pressure_314.cpp | 113 - .../jffs/pressure/It_fs_jffs_pressure_315.cpp | 118 - .../pressure/It_vfs_jffs_multipthread_001.cpp | 400 - .../pressure/It_vfs_jffs_multipthread_002.cpp | 480 - .../pressure/It_vfs_jffs_multipthread_003.cpp | 541 -- .../pressure/It_vfs_jffs_multipthread_004.cpp | 504 -- .../pressure/It_vfs_jffs_multipthread_005.cpp | 325 - .../pressure/It_vfs_jffs_multipthread_006.cpp | 615 -- .../pressure/It_vfs_jffs_multipthread_007.cpp | 569 -- .../pressure/It_vfs_jffs_multipthread_008.cpp | 553 -- .../pressure/It_vfs_jffs_multipthread_009.cpp | 414 - .../pressure/It_vfs_jffs_multipthread_010.cpp | 556 -- .../pressure/It_vfs_jffs_multipthread_011.cpp | 663 -- .../pressure/It_vfs_jffs_multipthread_012.cpp | 634 -- .../pressure/It_vfs_jffs_multipthread_013.cpp | 451 - .../pressure/It_vfs_jffs_multipthread_014.cpp | 618 -- .../pressure/It_vfs_jffs_multipthread_015.cpp | 668 -- .../pressure/It_vfs_jffs_multipthread_016.cpp | 649 -- .../pressure/It_vfs_jffs_multipthread_017.cpp | 450 - .../pressure/It_vfs_jffs_multipthread_018.cpp | 650 -- .../pressure/It_vfs_jffs_multipthread_019.cpp | 449 - .../pressure/It_vfs_jffs_multipthread_020.cpp | 443 - .../pressure/It_vfs_jffs_multipthread_021.cpp | 424 - .../pressure/It_vfs_jffs_multipthread_022.cpp | 465 - .../pressure/It_vfs_jffs_multipthread_023.cpp | 465 - .../pressure/It_vfs_jffs_multipthread_024.cpp | 427 - .../pressure/It_vfs_jffs_multipthread_025.cpp | 283 - .../pressure/It_vfs_jffs_multipthread_026.cpp | 263 - .../pressure/It_vfs_jffs_multipthread_027.cpp | 384 - .../pressure/It_vfs_jffs_multipthread_028.cpp | 311 - .../pressure/It_vfs_jffs_multipthread_029.cpp | 385 - .../pressure/It_vfs_jffs_multipthread_030.cpp | 373 - .../pressure/It_vfs_jffs_multipthread_031.cpp | 259 - .../pressure/It_vfs_jffs_multipthread_032.cpp | 372 - .../pressure/It_vfs_jffs_multipthread_033.cpp | 427 - .../pressure/It_vfs_jffs_multipthread_034.cpp | 252 - .../pressure/It_vfs_jffs_multipthread_035.cpp | 430 - .../pressure/It_vfs_jffs_multipthread_036.cpp | 429 - .../pressure/It_vfs_jffs_multipthread_037.cpp | 252 - .../pressure/It_vfs_jffs_multipthread_038.cpp | 432 - .../pressure/It_vfs_jffs_multipthread_039.cpp | 437 - .../pressure/It_vfs_jffs_multipthread_040.cpp | 453 - .../pressure/It_vfs_jffs_multipthread_041.cpp | 452 - .../pressure/It_vfs_jffs_multipthread_042.cpp | 458 - .../pressure/It_vfs_jffs_multipthread_043.cpp | 442 - .../pressure/It_vfs_jffs_multipthread_044.cpp | 457 - .../pressure/It_vfs_jffs_multipthread_045.cpp | 458 - .../pressure/It_vfs_jffs_multipthread_046.cpp | 442 - .../pressure/It_vfs_jffs_multipthread_047.cpp | 457 - .../pressure/It_vfs_jffs_multipthread_048.cpp | 453 - .../pressure/It_vfs_jffs_multipthread_049.cpp | 437 - .../pressure/It_vfs_jffs_multipthread_050.cpp | 452 - .../pressure/It_vfs_jffs_multipthread_051.cpp | 136 - .../pressure/It_vfs_jffs_multipthread_052.cpp | 174 - .../pressure/It_vfs_jffs_multipthread_053.cpp | 176 - .../pressure/It_vfs_jffs_multipthread_054.cpp | 185 - .../pressure/It_vfs_jffs_multipthread_055.cpp | 178 - .../pressure/It_vfs_jffs_multipthread_056.cpp | 175 - .../pressure/It_vfs_jffs_multipthread_057.cpp | 171 - .../pressure/It_vfs_jffs_multipthread_058.cpp | 171 - .../pressure/It_vfs_jffs_multipthread_059.cpp | 184 - .../pressure/It_vfs_jffs_multipthread_060.cpp | 182 - .../pressure/It_vfs_jffs_multipthread_061.cpp | 180 - .../pressure/It_vfs_jffs_multipthread_062.cpp | 176 - .../pressure/It_vfs_jffs_multipthread_063.cpp | 172 - .../fs/jffs/smoke/It_vfs_jffs_001.cpp | 94 - .../fs/jffs/smoke/It_vfs_jffs_002.cpp | 117 - .../fs/jffs/smoke/It_vfs_jffs_003.cpp | 115 - .../fs/jffs/smoke/It_vfs_jffs_005.cpp | 157 - .../fs/jffs/smoke/It_vfs_jffs_021.cpp | 101 - .../fs/jffs/smoke/It_vfs_jffs_022.cpp | 143 - .../fs/jffs/smoke/It_vfs_jffs_026.cpp | 121 - .../fs/jffs/smoke/It_vfs_jffs_027.cpp | 121 - .../fs/jffs/smoke/It_vfs_jffs_034.cpp | 82 - .../fs/jffs/smoke/It_vfs_jffs_035.cpp | 114 - .../fs/jffs/smoke/It_vfs_jffs_094.cpp | 65 - .../fs/jffs/smoke/It_vfs_jffs_095.cpp | 81 - .../fs/jffs/smoke/It_vfs_jffs_103.cpp | 132 - .../fs/jffs/smoke/It_vfs_jffs_535.cpp | 133 - .../fs/jffs/smoke/It_vfs_jffs_Dac_001.cpp | 528 -- .../fs/jffs/smoke/it_test_fs_jffs_005.cpp | 68 - .../fs/jffs/smoke/it_test_fs_jffs_008.cpp | 174 - .../fs/jffs/smoke/it_test_fs_jffs_010.cpp | 147 - .../fs/jffs/smoke/it_test_fs_jffs_104.cpp | 122 - .../fs/jffs/smoke/it_test_fs_jffs_105.cpp | 126 - .../fs/jffs/smoke/it_test_fs_jffs_107.cpp | 84 - .../fs/jffs/smoke/it_test_fs_jffs_108.cpp | 115 - .../fs/jffs/smoke/it_test_fs_jffs_109.cpp | 104 - .../fs/jffs/smoke/it_test_fs_jffs_110.cpp | 102 - .../fs/jffs/smoke/it_test_fs_jffs_111.cpp | 103 - .../fs/jffs/smoke/it_test_fs_jffs_201.cpp | 60 - .../fs/jffs/smoke/it_test_fs_jffs_202.cpp | 72 - .../fs/jffs/smoke/it_test_fs_jffs_203.cpp | 96 - .../fs/jffs/smoke/it_test_fs_jffs_204.cpp | 70 - testsuites/unittest/fs/jffs/vfs_jffs_test.cpp | 8051 ----------------- testsuites/unittest/fs/proc/It_vfs_proc.cpp | 54 - testsuites/unittest/fs/proc/It_vfs_proc.h | 80 - testsuites/unittest/fs/proc/config.gni | 44 - .../unittest/fs/proc/full/It_vfs_proc_001.cpp | 84 - .../unittest/fs/proc/full/It_vfs_proc_002.cpp | 61 - .../unittest/fs/proc/full/It_vfs_proc_003.cpp | 58 - .../unittest/fs/proc/full/It_vfs_proc_004.cpp | 58 - .../unittest/fs/proc/full/It_vfs_proc_005.cpp | 58 - .../unittest/fs/proc/full/It_vfs_proc_006.cpp | 58 - testsuites/unittest/fs/vfat/It_vfs_fat.h | 337 - testsuites/unittest/fs/vfat/VfsFatTest.cpp | 1466 --- testsuites/unittest/fs/vfat/config.gni | 172 - .../unittest/fs/vfat/full/It_vfs_fat_066.cpp | 333 - .../unittest/fs/vfat/full/It_vfs_fat_068.cpp | 109 - .../unittest/fs/vfat/full/It_vfs_fat_072.cpp | 112 - .../unittest/fs/vfat/full/It_vfs_fat_073.cpp | 117 - .../unittest/fs/vfat/full/It_vfs_fat_074.cpp | 130 - .../unittest/fs/vfat/full/It_vfs_fat_496.cpp | 83 - .../unittest/fs/vfat/full/It_vfs_fat_497.cpp | 80 - .../unittest/fs/vfat/full/It_vfs_fat_498.cpp | 81 - .../unittest/fs/vfat/full/It_vfs_fat_499.cpp | 81 - .../unittest/fs/vfat/full/It_vfs_fat_500.cpp | 81 - .../unittest/fs/vfat/full/It_vfs_fat_501.cpp | 83 - .../unittest/fs/vfat/full/It_vfs_fat_502.cpp | 82 - .../unittest/fs/vfat/full/It_vfs_fat_503.cpp | 81 - .../unittest/fs/vfat/full/It_vfs_fat_504.cpp | 68 - .../unittest/fs/vfat/full/It_vfs_fat_506.cpp | 59 - .../unittest/fs/vfat/full/It_vfs_fat_507.cpp | 51 - .../unittest/fs/vfat/full/It_vfs_fat_508.cpp | 54 - .../unittest/fs/vfat/full/It_vfs_fat_509.cpp | 51 - .../unittest/fs/vfat/full/It_vfs_fat_510.cpp | 51 - .../unittest/fs/vfat/full/It_vfs_fat_511.cpp | 81 - .../unittest/fs/vfat/full/It_vfs_fat_512.cpp | 81 - .../unittest/fs/vfat/full/It_vfs_fat_513.cpp | 52 - .../unittest/fs/vfat/full/It_vfs_fat_514.cpp | 58 - .../unittest/fs/vfat/full/It_vfs_fat_515.cpp | 65 - .../unittest/fs/vfat/full/It_vfs_fat_516.cpp | 73 - .../unittest/fs/vfat/full/It_vfs_fat_517.cpp | 62 - .../unittest/fs/vfat/full/It_vfs_fat_518.cpp | 62 - .../unittest/fs/vfat/full/It_vfs_fat_519.cpp | 76 - .../unittest/fs/vfat/full/It_vfs_fat_662.cpp | 89 - .../unittest/fs/vfat/full/It_vfs_fat_663.cpp | 92 - .../unittest/fs/vfat/full/It_vfs_fat_664.cpp | 113 - .../unittest/fs/vfat/full/It_vfs_fat_665.cpp | 89 - .../unittest/fs/vfat/full/It_vfs_fat_666.cpp | 87 - .../unittest/fs/vfat/full/It_vfs_fat_667.cpp | 87 - .../unittest/fs/vfat/full/It_vfs_fat_668.cpp | 89 - .../unittest/fs/vfat/full/It_vfs_fat_669.cpp | 101 - .../unittest/fs/vfat/full/It_vfs_fat_670.cpp | 101 - .../unittest/fs/vfat/full/It_vfs_fat_671.cpp | 87 - .../unittest/fs/vfat/full/It_vfs_fat_672.cpp | 126 - .../unittest/fs/vfat/full/It_vfs_fat_673.cpp | 126 - .../unittest/fs/vfat/full/It_vfs_fat_674.cpp | 132 - .../unittest/fs/vfat/full/It_vfs_fat_675.cpp | 132 - .../unittest/fs/vfat/full/It_vfs_fat_676.cpp | 144 - .../unittest/fs/vfat/full/It_vfs_fat_677.cpp | 204 - .../unittest/fs/vfat/full/It_vfs_fat_678.cpp | 153 - .../unittest/fs/vfat/full/It_vfs_fat_679.cpp | 121 - .../unittest/fs/vfat/full/It_vfs_fat_680.cpp | 176 - .../unittest/fs/vfat/full/It_vfs_fat_681.cpp | 151 - .../unittest/fs/vfat/full/It_vfs_fat_682.cpp | 128 - .../unittest/fs/vfat/full/It_vfs_fat_683.cpp | 173 - .../unittest/fs/vfat/full/It_vfs_fat_684.cpp | 173 - .../unittest/fs/vfat/full/It_vfs_fat_685.cpp | 141 - .../unittest/fs/vfat/full/It_vfs_fat_686.cpp | 172 - .../unittest/fs/vfat/full/It_vfs_fat_687.cpp | 152 - .../unittest/fs/vfat/full/It_vfs_fat_692.cpp | 102 - .../unittest/fs/vfat/full/It_vfs_fat_693.cpp | 106 - .../unittest/fs/vfat/full/It_vfs_fat_694.cpp | 89 - .../unittest/fs/vfat/full/It_vfs_fat_870.cpp | 183 - .../unittest/fs/vfat/full/It_vfs_fat_872.cpp | 182 - .../unittest/fs/vfat/full/It_vfs_fat_873.cpp | 167 - .../unittest/fs/vfat/full/It_vfs_fat_874.cpp | 184 - .../unittest/fs/vfat/full/It_vfs_fat_875.cpp | 184 - .../unittest/fs/vfat/full/It_vfs_fat_902.cpp | 86 - .../unittest/fs/vfat/full/It_vfs_fat_903.cpp | 88 - .../unittest/fs/vfat/full/It_vfs_fat_904.cpp | 249 - .../unittest/fs/vfat/full/It_vfs_fat_909.cpp | 141 - .../pressure/It_fs_fat_performance_001.cpp | 126 - .../pressure/It_fs_fat_performance_002.cpp | 114 - .../pressure/It_fs_fat_performance_003.cpp | 102 - .../pressure/It_fs_fat_performance_004.cpp | 102 - .../pressure/It_fs_fat_performance_005.cpp | 121 - .../pressure/It_fs_fat_performance_006.cpp | 119 - .../pressure/It_fs_fat_performance_007.cpp | 109 - .../pressure/It_fs_fat_performance_008.cpp | 109 - .../pressure/It_fs_fat_performance_013.cpp | 143 - .../pressure/It_fs_fat_performance_014.cpp | 159 - .../pressure/It_fs_fat_performance_015.cpp | 380 - .../pressure/It_fs_fat_performance_016.cpp | 383 - .../vfat/pressure/It_fs_fat_pressure_029.cpp | 292 - .../vfat/pressure/It_fs_fat_pressure_030.cpp | 175 - .../vfat/pressure/It_fs_fat_pressure_031.cpp | 256 - .../vfat/pressure/It_fs_fat_pressure_038.cpp | 389 - .../vfat/pressure/It_fs_fat_pressure_040.cpp | 418 - .../vfat/pressure/It_fs_fat_pressure_041.cpp | 413 - .../vfat/pressure/It_fs_fat_pressure_042.cpp | 428 - .../vfat/pressure/It_fs_fat_pressure_301.cpp | 141 - .../vfat/pressure/It_fs_fat_pressure_302.cpp | 97 - .../vfat/pressure/It_fs_fat_pressure_303.cpp | 101 - .../vfat/pressure/It_fs_fat_pressure_305.cpp | 97 - .../vfat/pressure/It_fs_fat_pressure_306.cpp | 117 - .../vfat/pressure/It_fs_fat_pressure_309.cpp | 89 - .../pressure/It_vfs_fat_mutipthread_003.cpp | 546 -- .../pressure/It_vfs_fat_mutipthread_004.cpp | 509 -- .../pressure/It_vfs_fat_mutipthread_005.cpp | 427 - .../pressure/It_vfs_fat_mutipthread_006.cpp | 710 -- .../pressure/It_vfs_fat_mutipthread_008.cpp | 555 -- .../pressure/It_vfs_fat_mutipthread_009.cpp | 404 - .../pressure/It_vfs_fat_mutipthread_010.cpp | 574 -- .../pressure/It_vfs_fat_mutipthread_012.cpp | 630 -- .../pressure/It_vfs_fat_mutipthread_014.cpp | 633 -- .../pressure/It_vfs_fat_mutipthread_016.cpp | 666 -- .../pressure/It_vfs_fat_mutipthread_017.cpp | 447 - .../pressure/It_vfs_fat_mutipthread_018.cpp | 646 -- .../pressure/It_vfs_fat_mutipthread_019.cpp | 448 - .../pressure/It_vfs_fat_mutipthread_020.cpp | 444 - .../pressure/It_vfs_fat_mutipthread_021.cpp | 428 - .../pressure/It_vfs_fat_mutipthread_022.cpp | 469 - .../pressure/It_vfs_fat_mutipthread_023.cpp | 445 - .../pressure/It_vfs_fat_mutipthread_024.cpp | 427 - .../pressure/It_vfs_fat_mutipthread_027.cpp | 381 - .../pressure/It_vfs_fat_mutipthread_029.cpp | 381 - .../pressure/It_vfs_fat_mutipthread_030.cpp | 380 - .../pressure/It_vfs_fat_mutipthread_032.cpp | 381 - .../pressure/It_vfs_fat_mutipthread_033.cpp | 423 - .../pressure/It_vfs_fat_mutipthread_035.cpp | 426 - .../pressure/It_vfs_fat_mutipthread_036.cpp | 426 - .../pressure/It_vfs_fat_mutipthread_038.cpp | 432 - .../pressure/It_vfs_fat_mutipthread_039.cpp | 438 - .../pressure/It_vfs_fat_mutipthread_040.cpp | 456 - .../pressure/It_vfs_fat_mutipthread_041.cpp | 456 - .../pressure/It_vfs_fat_mutipthread_042.cpp | 459 - .../pressure/It_vfs_fat_mutipthread_043.cpp | 441 - .../pressure/It_vfs_fat_mutipthread_044.cpp | 458 - .../pressure/It_vfs_fat_mutipthread_045.cpp | 459 - .../pressure/It_vfs_fat_mutipthread_046.cpp | 379 - .../pressure/It_vfs_fat_mutipthread_047.cpp | 459 - .../pressure/It_vfs_fat_mutipthread_048.cpp | 460 - .../pressure/It_vfs_fat_mutipthread_049.cpp | 441 - .../pressure/It_vfs_fat_mutipthread_050.cpp | 459 - .../unittest/fs/vfat/smoke/It_vfs_fat_026.cpp | 179 - 921 files changed, 142380 deletions(-) delete mode 100644 testsuites/unittest/fs/jffs/It_vfs_jffs.h delete mode 100644 testsuites/unittest/fs/jffs/config.gni delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_001.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_002.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_003.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_004.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_005.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_006.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_007.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_008.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_009.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_010.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_011.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_012.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_013.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_014.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_015.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_016.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_017.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_018.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_019.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_020.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_021.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_022.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_023.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_024.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_025.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_026.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_027.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_028.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_029.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_030.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_031.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_032.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_033.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_034.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_035.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_036.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_037.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_038.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_039.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_040.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_041.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_042.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_043.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_jffs_044.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_test_faccessat_001.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_test_faccessat_002.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_test_fstatat_001.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_test_fstatat_002.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_test_fstatfs_001.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_test_fstatfs_002.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_004.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_006.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_007.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_008.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_009.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_010.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_011.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_012.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_013.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_014.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_015.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_016.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_017.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_018.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_019.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_020.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_023.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_024.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_025.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_028.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_029.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_030.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_031.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_032.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_033.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_037.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_038.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_039.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_040.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_041.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_042.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_043.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_044.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_045.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_046.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_048.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_049.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_050.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_051.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_053.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_055.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_056.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_057.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_058.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_059.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_060.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_061.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_062.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_063.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_064.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_065.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_066.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_067.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_068.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_069.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_070.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_071.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_072.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_073.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_074.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_076.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_077.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_078.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_079.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_080.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_081.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_082.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_083.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_084.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_085.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_086.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_088.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_090.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_092.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_093.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_096.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_097.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_099.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_100.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_101.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_102.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_104.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_105.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_106.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_107.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_116.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_117.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_118.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_119.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_120.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_121.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_122.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_123.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_124.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_125.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_126.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_127.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_128.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_129.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_130.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_131.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_132.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_133.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_134.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_135.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_136.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_137.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_138.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_139.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_140.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_141.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_142.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_143.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_144.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_145.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_146.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_147.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_148.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_149.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_150.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_151.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_152.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_153.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_154.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_155.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_156.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_157.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_158.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_159.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_160.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_161.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_162.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_163.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_164.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_165.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_166.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_167.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_168.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_169.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_170.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_171.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_172.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_173.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_174.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_175.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_176.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_177.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_178.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_179.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_180.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_182.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_183.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_184.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_185.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_187.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_188.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_189.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_190.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_191.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_192.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_193.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_194.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_195.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_196.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_197.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_198.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_199.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_200.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_201.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_202.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_203.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_204.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_205.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_206.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_207.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_208.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_209.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_210.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_211.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_212.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_213.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_214.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_215.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_216.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_217.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_218.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_219.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_220.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_221.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_222.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_223.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_224.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_225.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_226.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_227.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_228.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_229.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_230.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_231.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_232.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_233.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_234.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_235.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_236.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_237.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_238.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_239.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_240.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_241.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_242.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_243.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_244.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_245.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_246.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_247.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_248.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_249.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_250.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_251.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_252.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_253.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_254.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_255.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_256.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_257.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_258.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_259.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_260.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_261.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_262.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_263.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_264.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_265.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_266.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_267.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_268.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_269.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_270.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_271.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_272.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_273.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_274.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_275.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_276.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_277.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_278.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_279.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_280.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_281.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_282.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_283.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_284.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_285.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_286.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_287.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_288.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_289.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_290.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_291.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_292.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_293.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_294.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_295.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_296.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_297.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_298.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_299.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_300.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_301.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_302.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_303.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_304.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_305.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_306.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_307.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_308.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_309.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_310.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_311.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_312.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_313.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_314.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_315.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_316.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_317.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_318.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_319.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_320.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_321.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_322.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_323.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_324.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_325.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_326.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_327.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_328.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_329.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_330.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_331.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_332.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_333.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_334.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_335.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_336.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_337.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_338.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_339.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_340.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_342.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_343.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_344.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_346.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_352.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_353.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_354.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_355.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_356.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_357.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_358.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_359.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_360.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_361.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_362.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_364.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_365.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_366.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_367.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_368.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_369.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_370.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_371.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_372.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_373.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_374.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_375.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_376.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_377.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_378.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_379.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_380.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_381.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_382.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_383.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_384.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_385.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_386.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_387.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_388.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_389.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_390.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_391.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_392.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_393.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_394.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_395.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_396.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_397.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_398.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_399.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_400.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_401.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_402.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_403.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_404.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_405.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_406.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_407.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_408.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_409.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_410.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_411.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_412.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_413.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_414.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_415.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_416.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_417.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_418.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_419.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_420.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_421.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_422.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_423.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_424.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_425.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_426.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_427.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_428.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_429.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_430.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_431.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_432.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_433.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_434.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_435.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_454.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_455.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_456.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_457.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_458.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_459.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_460.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_461.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_462.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_487.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_488.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_489.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_490.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_491.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_492.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_493.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_494.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_495.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_496.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_497.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_498.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_499.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_500.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_501.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_502.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_503.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_504.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_505.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_506.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_507.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_508.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_509.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_510.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_511.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_512.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_513.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_514.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_515.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_516.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_517.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_518.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_519.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_520.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_521.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_522.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_523.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_524.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_526.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_528.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_529.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_530.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_531.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_532.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_533.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_534.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_541.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_542.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_543.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_544.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_545.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_546.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_547.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_548.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_549.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_550.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_551.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_552.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_553.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_554.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_555.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_556.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_557.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_560.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_562.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_563.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_564.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_565.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_566.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_567.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_568.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_569.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_570.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_571.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_572.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_573.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_574.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_583.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_584.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_586.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_589.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_590.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_591.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_592.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_593.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_594.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_595.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_596.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_603.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_636.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_643.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_644.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_645.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_646.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_648.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_649.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_650.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_651.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_652.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_653.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_654.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_655.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_656.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_663.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_664.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_665.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_666.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_668.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_669.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_670.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_671.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_672.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_673.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_674.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_675.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_676.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_690.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_694.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_696.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_697.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_700.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_701.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_807.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_jffs_808.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_test_link_001.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_test_link_002.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_test_link_003.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_test_linkat_001.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_test_linkat_002.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_test_linkat_003.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_001.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_002.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_003.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_test_readlink_001.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_test_symlink_001.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_test_symlink_002.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_test_symlink_003.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/It_vfs_test_symlinkat_001.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/it_test_fs_jffs_001.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/it_test_fs_jffs_002.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/it_test_fs_jffs_003.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/it_test_fs_jffs_004.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/it_test_fs_jffs_100.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/it_test_fs_jffs_101.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/it_test_fs_jffs_102.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/it_test_fs_jffs_103.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/it_test_fs_jffs_106.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/it_test_fs_jffs_112.cpp delete mode 100644 testsuites/unittest/fs/jffs/full/it_test_fs_jffs_113.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_001.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_002.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_003.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_004.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_005.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_006.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_007.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_008.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_009.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_010.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_011.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_012.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_013.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_001.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_002.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_003.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_004.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_005.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_006.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_007.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_008.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_009.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_010.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_011.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_012.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_014.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_015.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_016.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_017.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_018.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_019.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_020.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_021.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_022.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_023.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_024.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_025.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_026.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_027.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_028.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_029.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_030.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_031.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_032.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_033.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_034.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_035.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_036.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_037.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_038.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_039.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_040.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_041.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_042.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_043.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_044.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_045.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_046.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_047.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_048.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_049.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_050.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_051.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_052.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_053.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_301.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_302.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_303.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_304.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_305.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_306.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_307.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_308.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_309.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_310.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_311.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_312.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_313.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_314.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_315.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_001.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_002.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_003.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_004.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_005.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_006.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_007.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_008.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_009.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_010.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_011.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_012.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_013.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_014.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_015.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_016.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_017.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_018.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_019.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_020.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_021.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_022.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_023.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_024.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_025.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_026.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_027.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_028.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_029.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_030.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_031.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_032.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_033.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_034.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_035.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_036.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_037.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_038.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_039.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_040.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_041.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_042.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_043.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_044.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_045.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_046.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_047.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_048.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_049.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_050.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_051.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_052.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_053.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_054.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_055.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_056.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_057.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_058.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_059.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_060.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_061.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_062.cpp delete mode 100644 testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_063.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_001.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_002.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_003.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_005.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_021.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_022.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_026.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_027.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_034.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_035.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_094.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_095.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_103.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_535.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_Dac_001.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_005.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_008.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_010.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_104.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_105.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_107.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_108.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_109.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_110.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_111.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_201.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_202.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_203.cpp delete mode 100644 testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_204.cpp delete mode 100644 testsuites/unittest/fs/jffs/vfs_jffs_test.cpp delete mode 100644 testsuites/unittest/fs/proc/It_vfs_proc.cpp delete mode 100644 testsuites/unittest/fs/proc/It_vfs_proc.h delete mode 100644 testsuites/unittest/fs/proc/config.gni delete mode 100644 testsuites/unittest/fs/proc/full/It_vfs_proc_001.cpp delete mode 100644 testsuites/unittest/fs/proc/full/It_vfs_proc_002.cpp delete mode 100644 testsuites/unittest/fs/proc/full/It_vfs_proc_003.cpp delete mode 100644 testsuites/unittest/fs/proc/full/It_vfs_proc_004.cpp delete mode 100644 testsuites/unittest/fs/proc/full/It_vfs_proc_005.cpp delete mode 100644 testsuites/unittest/fs/proc/full/It_vfs_proc_006.cpp delete mode 100644 testsuites/unittest/fs/vfat/It_vfs_fat.h delete mode 100644 testsuites/unittest/fs/vfat/VfsFatTest.cpp delete mode 100644 testsuites/unittest/fs/vfat/config.gni delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_066.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_068.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_072.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_073.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_074.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_496.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_497.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_498.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_499.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_500.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_501.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_502.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_503.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_504.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_506.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_507.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_508.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_509.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_510.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_511.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_512.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_513.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_514.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_515.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_516.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_517.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_518.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_519.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_662.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_663.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_664.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_665.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_666.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_667.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_668.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_669.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_670.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_671.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_672.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_673.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_674.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_675.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_676.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_677.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_678.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_679.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_680.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_681.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_682.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_683.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_684.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_685.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_686.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_687.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_692.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_693.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_694.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_870.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_872.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_873.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_874.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_875.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_902.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_903.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_904.cpp delete mode 100644 testsuites/unittest/fs/vfat/full/It_vfs_fat_909.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_001.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_002.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_003.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_004.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_005.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_006.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_007.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_008.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_013.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_014.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_015.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_016.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_029.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_030.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_031.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_038.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_040.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_041.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_042.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_301.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_302.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_303.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_305.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_306.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_309.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_003.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_004.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_005.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_006.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_008.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_009.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_010.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_012.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_014.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_016.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_017.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_018.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_019.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_020.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_021.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_022.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_023.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_024.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_027.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_029.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_030.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_032.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_033.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_035.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_036.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_038.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_039.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_040.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_041.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_042.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_043.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_044.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_045.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_046.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_047.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_048.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_049.cpp delete mode 100644 testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_050.cpp delete mode 100644 testsuites/unittest/fs/vfat/smoke/It_vfs_fat_026.cpp diff --git a/testsuites/unittest/fs/config.gni b/testsuites/unittest/fs/config.gni index 4c4521b3..a4b70375 100644 --- a/testsuites/unittest/fs/config.gni +++ b/testsuites/unittest/fs/config.gni @@ -41,32 +41,3 @@ sources_smoke = [] sources_pressure = [] sources_full = [] - -# jffs module -if (LOSCFG_USER_TEST_FS_JFFS == true) { - import("./jffs/config.gni") - common_include_dirs += jffs_include_dirs - sources_entry += jffs_sources_entry - sources_smoke += jffs_sources_smoke - sources_pressure += jffs_sources_pressure - sources_full += jffs_sources_full -} - -# proc module -if (LOSCFG_USER_TEST_FS_PROC == true) { - import("./proc/config.gni") - common_include_dirs += proc_include_dirs - sources_entry += proc_sources_entry - sources_smoke += proc_sources_smoke - sources_full += proc_sources_full -} - -# vfat module -if (LOSCFG_USER_TEST_FS_VFAT == true) { - import("./vfat/config.gni") - common_include_dirs += vfat_include_dirs - sources_entry += vfat_sources_entry - sources_smoke += vfat_sources_smoke - sources_pressure += vfat_sources_pressure - sources_full += vfat_sources_full -} diff --git a/testsuites/unittest/fs/jffs/It_vfs_jffs.h b/testsuites/unittest/fs/jffs/It_vfs_jffs.h deleted file mode 100644 index d103c95a..00000000 --- a/testsuites/unittest/fs/jffs/It_vfs_jffs.h +++ /dev/null @@ -1,1159 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 -#include -#include "sys/capability.h" -#include "sys/ioctl.h" -#include "sys/select.h" -#include "sys/stat.h" -#include "sys/statfs.h" -#include "sys/types.h" -#include "sys/uio.h" -#include "syslog.h" - -#include "fcntl.h" -#include "stdlib.h" -#include "time.h" -#include "unistd.h" -#include "utime.h" - -#include "dirent.h" -#include "ftw.h" -#include "libgen.h" -#include "limits.h" -#include "los_typedef.h" -#include "osTest.h" -#include "pthread.h" -#include "sched.h" -#include "semaphore.h" -#include "signal.h" -#include "wchar.h" - -constexpr int F_RDO = 0x01; /* Read only */ -constexpr int F_HID = 0x02; /* Hidden */ -constexpr int F_SYS = 0x04; /* System */ -constexpr int F_ARC = 0x20; /* Archive */ -constexpr int CONFIG_NFILE_DESCRIPTORS = 512; -constexpr int LOS_WAIT_FOREVER = 0xFFFFFFFF; -#if 0 -constexpr int DT_UNKNOWN = 0; -constexpr int DT_FIFO = 1; -constexpr int DT_CHR = 2; -constexpr int DT_DIR = 4; -constexpr int DT_BLK = 6; -constexpr int DT_REG = 8; -constexpr int DT_LNK = 10; -constexpr int DT_SOCK = 12; -constexpr int DT_WHT = 14; -constexpr int MS_RDONLY = 1; -#endif - -#if 0 -constexpr const char* JFFS_MAIN_DIR0 = "/storage"; -constexpr const char* JFFS_MOUNT_DIR0 = "/storage"; -constexpr const char* JFFS_MAIN_DIR1 = "/storage1"; -constexpr const char* JFFS_PATH_NAME0 = "/storage/test"; -constexpr const char* JFFS_PATH_NAME01 = "/storage/test1"; -constexpr const char* JFFS_PATH_NAME02 = "/storage/test2"; -constexpr const char* JFFS_PATH_NAME00 = "/storage/test/test00"; -constexpr const char* JFFS_PATH_NAME11 = "/storage/test1/test11"; -constexpr const char* JFFS_PATH_NAME22 = "/storage/test2/test22"; -constexpr const char* JFFS_PATH_NAME_0 = "/storage/test/test0"; -constexpr const char* JFFS_PATH_NAME_01 = "/storage/test/test0/test1"; -constexpr const char* JFFS_PATH_NAME1 = "/storage1/test"; -constexpr const char* JFFS_DEV_PATH0 = "/dev/spinorblk2"; -constexpr const char* JFFS_DEV_PATH1 = "/dev/spinorblk1"; -constexpr const char* JFFS_FILESYS_TYPE = "jffs2"; -constexpr const char* JFFS_CHINESE_NAME1 = "锟斤拷锟较猴拷"; -constexpr const char* JFFS_BASE_DIR = "/"; -#endif - -#define JFFS_FILE_MODE 0755 -#define JFFS_MAIN_DIR0 "/storage" -#define JFFS_MOUNT_DIR0 "/storage" -#define JFFS_MAIN_DIR1 "/storage1" -#define JFFS_PATH_NAME0 "/storage/test" -#define JFFS_PATH_NAME01 "/storage/test1" -#define JFFS_PATH_NAME02 "/storage/test2" -#define JFFS_PATH_NAME03 "/storage/test3" -#define JFFS_PATH_NAME04 "/storage/test4" -#define JFFS_PATH_NAME00 "/storage/test/test00" -#define JFFS_PATH_NAME11 "/storage/test1/test11" -#define JFFS_PATH_NAME22 "/storage/test2/test22" -#define JFFS_PATH_NAME_0 "/storage/test/test0" -#define JFFS_PATH_NAME_01 "/storage/test/test0/test1" -#define JFFS_PATH_NAME1 "/storage1/test" -#define JFFS_DEV_PATH0 "/dev/spinorblk2" -#define JFFS_DEV_PATH1 "/dev/spinorblk1" -#define JFFS_FILESYS_TYPE "jffs2" -#define JFFS_CHINESE_NAME1 "锟斤拷锟较猴拷" -#define JFFS_BASE_DIR "/" - -constexpr int MSECS_PER_SEC = 1000; -constexpr int USECS_PER_SEC = 1000000; -constexpr int BYTES_PER_KBYTE = 1024; -constexpr int BYTES_PER_MBYTE = (1024 * 1024); -constexpr int BYTES_PER_GBYTES = (1024 * 1024 * 1024); - -constexpr int FILE_BUF_SIZE = 260; -constexpr int HIGHEST_AUTHORITY = 0777; -constexpr int JFFS_MAX_NUM_TEST = 1000; -constexpr int JFFS_NAME_LIMITTED_SIZE = 300; -constexpr int JFFS_STANDARD_NAME_LENGTH = 50; - -constexpr int JFFS_LONG_ARRAY_LENGTH = 100; -constexpr int JFFS_MIDDLE_ARRAY_LENGTH = 50; -constexpr int JFFS_SHORT_ARRAY_LENGTH = 10; -constexpr int JFFS_WR_CAP_SIZE_TEST = 0x100000; // the size is 1MB for each speed calculation -constexpr int JFFS_MAX_DEF_BUF_NUM = 21; - -constexpr int JFFS_FILE_LIMITTED_NUM = 200; - -constexpr int JFFS_FILE_SIZE_TEST = 100 * 1024 * 1024; // *1024 -constexpr int JFFS_PERFORMANCE_W_R_SIZE = 5 * 1024 * 1024; -constexpr int JFFS_FILE_PER_WRITE_SIZE = 5 * 1024 * 1024; -constexpr int JFFS_PRESSURE_W_R_SIZE1 = 1 * 1024 * 1024; -constexpr int JFFS_PRESSURE_W_R_SIZE2 = 5 * 1024 * 1024; -constexpr int JFFS_PRESSURE_W_R_SIZE3 = 10 * 1024 * 1024; -constexpr int JFFS_PRESSURE_W_R_SIZE4 = 50 * 1024 * 1024; -constexpr int JFFS_PRESSURE_W_R_SIZE5 = 100 * 1024 * 1024; -constexpr int JFFS_PRESSURE_W_R_SIZE = JFFS_PRESSURE_W_R_SIZE3; -constexpr int JFFS_THREAD_NUM_TEST = 3; - -constexpr int SLEEP_TIME = 10; -constexpr int TASK_PRIO_TEST2 = TASK_PRIO_TEST - 2; - -constexpr int JFFS_MIDDLE_CYCLES = 3; -constexpr int JFFS_MIDDLE_NUM = 6; -constexpr int JFFS_MAX_CYCLES = 5; -constexpr int JFFS_CREATFILE_NUM = 5; -constexpr int JFFS_WR_TYPE_TEST1 = 0; // 0:use fwrite and fread for test -constexpr int JFFS_WR_TYPE_TEST2 = 1; // 1:use write and read for test -constexpr int JFFS_WR_TYPE_TEST = JFFS_WR_TYPE_TEST2; - -constexpr int JFFS_PRESSURE_CYCLES = 10; -constexpr int JFFS_MAXIMUM_OPERATIONS = 10; -constexpr int JFFS_MAXIMUM_SIZES = 10; -constexpr int JFFS_MAX_THREADS = 3; -#define JFFS_NO_ERROR 0 -#define JFFS_IS_ERROR -1 -#define JFFS_TO_NULL NULL - -constexpr int JFFS_UTIME_SUPPORT = -1; // 0 means utime is supported,-1 means utime is not supported -constexpr int JFFS_BASE_ADDR = 0x1900000; -constexpr int JFFS_MTD_SIZE = 0x200000; -constexpr int JFFS_SECOND_MDT = 1; - -constexpr int JFFS2NUM_JFFS2_GC_THREAD_PRIORITY = 10; -constexpr int JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1 = JFFS2NUM_JFFS2_GC_THREAD_PRIORITY - 1; -constexpr int JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2 = JFFS2NUM_JFFS2_GC_THREAD_PRIORITY - 2; -constexpr int JFFS2NUM_JFFS2_GC_THREAD_PRIORITY3 = JFFS2NUM_JFFS2_GC_THREAD_PRIORITY - 3; -constexpr int JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4 = JFFS2NUM_JFFS2_GC_THREAD_PRIORITY - 4; -constexpr int JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5 = JFFS2NUM_JFFS2_GC_THREAD_PRIORITY - 5; - - -constexpr int JFFS_PRESSURE_MTD_SIZE = 0x6A00000; /* The size is 106MB */ -#if defined TEST3516A || defined TEST3516EV200 -constexpr int JFFS_PRESSURE_ADDRESS_BEGIN = 0xe00000; -constexpr int JFFS_PRESSURE_ADDRESS_END = 0X7f00000; -#elif defined TEST3518E || defined TEST3516CV300 -constexpr int JFFS_PRESSURE_ADDRESS_BEGIN = 0xe00000; -constexpr int JFFS_PRESSURE_ADDRESS_END = 0X7f00000; -#endif - -extern INT32 g_jffsFilesMax; -extern INT32 g_jffsFlag; -extern INT32 g_jffsFlagF01; -extern INT32 g_jffsFlagF02; -extern INT32 g_jffsFd; -extern DIR *g_jffsDir; -extern BOOL isCpuAffiMaskTest; -extern INT32 g_TestCnt; - -extern INT32 g_jffsFd11[JFFS_MAXIMUM_SIZES]; -extern INT32 g_jffsFd12[JFFS_MAXIMUM_SIZES][JFFS_MAXIMUM_SIZES]; - -extern CHAR g_jffsPathname1[JFFS_STANDARD_NAME_LENGTH]; -extern CHAR g_jffsPathname2[JFFS_STANDARD_NAME_LENGTH]; -extern CHAR g_jffsPathname3[JFFS_STANDARD_NAME_LENGTH]; -extern CHAR g_jffsPathname4[JFFS_STANDARD_NAME_LENGTH]; - -extern CHAR g_jffsPathname6[JFFS_NAME_LIMITTED_SIZE]; -extern CHAR g_jffsPathname7[JFFS_NAME_LIMITTED_SIZE]; -extern CHAR g_jffsPathname8[JFFS_NAME_LIMITTED_SIZE]; - -extern CHAR g_jffsPathname11[JFFS_MAXIMUM_SIZES][JFFS_NAME_LIMITTED_SIZE]; -extern CHAR g_jffsPathname12[JFFS_MAXIMUM_SIZES][JFFS_NAME_LIMITTED_SIZE]; -extern CHAR g_jffsPathname13[JFFS_MAXIMUM_SIZES][JFFS_NAME_LIMITTED_SIZE]; - -extern struct iovec g_jffsIov[10]; - -extern pthread_mutex_t g_jffs2GlobalLock1; -extern pthread_mutex_t g_jffs2GlobalLock2; - -INT32 JffsFixWrite(CHAR *path, INT64 fileSize, INT32 writeSize, INT32 interfaceType); -INT32 JffsFixRead(CHAR *path, INT64 fileSize, INT32 readSize, INT32 interfaceType); -INT32 JffsMultiWrite(CHAR *path, INT64 fileSize, INT32 writeSize, int oflags, INT32 interfaceType); -INT32 JffsMultiRead(CHAR *path, INT64 fileSize, INT32 readSize, int oflags, INT32 interfaceType); -INT32 JffsRandWrite(CHAR *path, INT64 fileSize, INT32 interfaceType); -INT32 JffsRandRead(CHAR *path, INT64 fileSize, INT32 interfaceType); - -INT32 JffsDeleteDirs(char *str, int n); -INT32 JffsDeletefile(int fd, char *pathname); -INT32 JffsStrcat2(char *pathname, char *str, int len); -INT32 JffsScandirFree(struct dirent **namelist, int n); -INT32 JffsStatPrintf(struct stat sb); -INT32 JffsStatfsPrintf(struct statfs buf); -INT32 JffsStat64Printf(struct stat64 sb); - -extern int open64(const char *__path, int __oflag, ...); -extern int fcntl64(int fd, int cmd, ...); - -extern int osShellCmdPartitionShow(int argc, char **argv); - -extern int alphasort(const struct dirent **a, const struct dirent **b); -extern int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, - const void *data); -extern int umount(const char *target); -extern bool IS_MOUNTPT(const char *dev); -extern int chattr(const char *path, mode_t mode); - -extern VOID ItSuite_Vfs_Jffs(VOID); - -#if defined(LOSCFG_USER_TEST_SMOKE) -VOID ItTestDac001(VOID); -VOID ItFsJffs001(VOID); -VOID ItFsJffs002(VOID); -VOID ItFsJffs003(VOID); -VOID ItFsJffs005(VOID); -VOID ItFsJffs021(VOID); -VOID ItFsJffs022(VOID); -VOID ItFsJffs026(VOID); -VOID ItFsJffs027(VOID); -VOID ItFsJffs034(VOID); -VOID ItFsJffs035(VOID); -VOID ItFsJffs094(VOID); -VOID ItFsJffs095(VOID); -VOID ItFsJffs103(VOID); -VOID ItFsJffs535(VOID); -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -VOID IO_TEST_FACCESSAT_001(void); -VOID IO_TEST_FACCESSAT_002(void); -VOID IO_TEST_FSTATFS_001(void); -VOID IO_TEST_FSTATFS_002(void); -VOID IO_TEST_FSTATAT_001(void); -VOID IO_TEST_FSTATAT_002(void); -void ItTestFsJffs001(void); -void ItTestFsJffs002(void); -void ItTestFsJffs003(void); -void ItTestFsJffs004(void); -void ItTestFsJffs100(void); -void ItTestFsJffs101(void); -void ItTestFsJffs102(void); -void ItTestFsJffs103(void); -void ItTestFsJffs106(void); -void ItTestFsJffs112(void); -void ItTestFsJffs113(void); -VOID ItJffs001(VOID); -VOID ItJffs002(VOID); -VOID ItJffs003(VOID); -VOID ItJffs004(VOID); -VOID ItJffs005(VOID); -VOID ItJffs006(VOID); -VOID ItJffs007(VOID); -VOID ItJffs008(VOID); -VOID ItJffs009(VOID); -VOID ItJffs010(VOID); -VOID ItJffs011(VOID); -VOID ItJffs012(VOID); -VOID ItJffs013(VOID); -VOID ItJffs014(VOID); -VOID ItJffs015(VOID); -VOID ItJffs016(VOID); -VOID ItJffs017(VOID); -VOID ItJffs018(VOID); -VOID ItJffs019(VOID); -VOID ItJffs020(VOID); -VOID ItJffs021(VOID); -VOID ItJffs022(VOID); -VOID ItJffs023(VOID); -VOID ItJffs024(VOID); -VOID ItJffs025(VOID); -VOID ItJffs026(VOID); -VOID ItJffs027(VOID); -VOID ItJffs028(VOID); -VOID ItJffs029(VOID); -VOID ItJffs030(VOID); -VOID ItJffs031(VOID); -VOID ItJffs032(VOID); -VOID ItJffs033(VOID); -VOID ItJffs034(VOID); -VOID ItJffs035(VOID); -VOID ItJffs036(VOID); -VOID ItJffs037(VOID); -VOID ItJffs038(VOID); -VOID ItJffs039(VOID); -VOID ItJffs040(VOID); -VOID ItJffs041(VOID); -VOID ItJffs042(VOID); -VOID ItJffs043(VOID); -VOID ItJffs044(VOID); - -VOID ItFsJffs004(VOID); -VOID ItFsJffs006(VOID); -VOID ItFsJffs007(VOID); -VOID ItFsJffs008(VOID); -VOID ItFsJffs009(VOID); -VOID ItFsJffs010(VOID); -VOID ItFsJffs011(VOID); -VOID ItFsJffs012(VOID); -VOID ItFsJffs013(VOID); -VOID ItFsJffs014(VOID); -VOID ItFsJffs015(VOID); -VOID ItFsJffs016(VOID); -VOID ItFsJffs017(VOID); -VOID ItFsJffs018(VOID); -VOID ItFsJffs019(VOID); -VOID ItFsJffs020(VOID); -VOID ItFsJffs023(VOID); -VOID ItFsJffs024(VOID); -VOID ItFsJffs025(VOID); -VOID ItFsJffs028(VOID); -VOID ItFsJffs029(VOID); -VOID ItFsJffs030(VOID); -VOID ItFsJffs031(VOID); -VOID ItFsJffs032(VOID); -VOID ItFsJffs033(VOID); -VOID ItFsJffs037(VOID); -VOID ItFsJffs038(VOID); -VOID ItFsJffs039(VOID); -VOID ItFsJffs040(VOID); -VOID ItFsJffs041(VOID); -VOID ItFsJffs042(VOID); -VOID ItFsJffs043(VOID); -VOID ItFsJffs044(VOID); -VOID ItFsJffs045(VOID); -VOID ItFsJffs046(VOID); -VOID ItFsJffs047(VOID); -VOID ItFsJffs048(VOID); -VOID ItFsJffs049(VOID); -VOID ItFsJffs050(VOID); -VOID ItFsJffs052(VOID); -VOID ItFsJffs053(VOID); -VOID ItFsJffs054(VOID); -VOID ItFsJffs055(VOID); -VOID ItFsJffs056(VOID); -VOID ItFsJffs057(VOID); -VOID ItFsJffs058(VOID); -VOID ItFsJffs059(VOID); -VOID ItFsJffs060(VOID); -VOID ItFsJffs061(VOID); -VOID ItFsJffs062(VOID); -VOID ItFsJffs063(VOID); -VOID ItFsJffs064(VOID); -VOID ItFsJffs065(VOID); -VOID ItFsJffs066(VOID); -VOID ItFsJffs067(VOID); -VOID ItFsJffs068(VOID); -VOID ItFsJffs069(VOID); -VOID ItFsJffs070(VOID); -VOID ItFsJffs071(VOID); -VOID ItFsJffs072(VOID); -VOID ItFsJffs073(VOID); -VOID ItFsJffs074(VOID); -VOID ItFsJffs075(VOID); -VOID ItFsJffs076(VOID); -VOID ItFsJffs077(VOID); -VOID ItFsJffs078(VOID); -VOID ItFsJffs079(VOID); -VOID ItFsJffs080(VOID); -VOID ItFsJffs081(VOID); -VOID ItFsJffs082(VOID); -VOID ItFsJffs083(VOID); -VOID ItFsJffs084(VOID); -VOID ItFsJffs085(VOID); -VOID ItFsJffs086(VOID); -VOID ItFsJffs088(VOID); -VOID ItFsJffs089(VOID); -VOID ItFsJffs090(VOID); -VOID ItFsJffs091(VOID); -VOID ItFsJffs092(VOID); -VOID ItFsJffs093(VOID); -VOID ItFsJffs096(VOID); -VOID ItFsJffs097(VOID); -VOID ItFsJffs098(VOID); -VOID ItFsJffs099(VOID); -VOID ItFsJffs100(VOID); -VOID ItFsJffs101(VOID); -VOID ItFsJffs102(VOID); -VOID ItFsJffs104(VOID); -VOID ItFsJffs105(VOID); -VOID ItFsJffs106(VOID); -VOID ItFsJffs107(VOID); -VOID ItFsJffs109(VOID); -VOID ItFsJffs110(VOID); -VOID ItFsJffs111(VOID); -VOID ItFsJffs112(VOID); -VOID ItFsJffs113(VOID); -VOID ItFsJffs114(VOID); -VOID ItFsJffs115(VOID); -VOID ItFsJffs116(VOID); -VOID ItFsJffs117(VOID); -VOID ItFsJffs118(VOID); -VOID ItFsJffs119(VOID); -VOID ItFsJffs120(VOID); -VOID ItFsJffs121(VOID); -VOID ItFsJffs122(VOID); -VOID ItFsJffs123(VOID); -VOID ItFsJffs124(VOID); -VOID ItFsJffs125(VOID); -VOID ItFsJffs126(VOID); -VOID ItFsJffs127(VOID); -VOID ItFsJffs128(VOID); -VOID ItFsJffs129(VOID); -VOID ItFsJffs130(VOID); -VOID ItFsJffs131(VOID); -VOID ItFsJffs132(VOID); -VOID ItFsJffs133(VOID); -VOID ItFsJffs134(VOID); -VOID ItFsJffs135(VOID); -VOID ItFsJffs136(VOID); -VOID ItFsJffs137(VOID); -VOID ItFsJffs138(VOID); -VOID ItFsJffs139(VOID); -VOID ItFsJffs140(VOID); -VOID ItFsJffs141(VOID); -VOID ItFsJffs142(VOID); -VOID ItFsJffs143(VOID); -VOID ItFsJffs144(VOID); -VOID ItFsJffs145(VOID); -VOID ItFsJffs146(VOID); -VOID ItFsJffs147(VOID); -VOID ItFsJffs148(VOID); -VOID ItFsJffs149(VOID); -VOID ItFsJffs150(VOID); -VOID ItFsJffs151(VOID); -VOID ItFsJffs152(VOID); -VOID ItFsJffs153(VOID); -VOID ItFsJffs154(VOID); -VOID ItFsJffs155(VOID); -VOID ItFsJffs156(VOID); -VOID ItFsJffs157(VOID); -VOID ItFsJffs158(VOID); -VOID ItFsJffs159(VOID); -VOID ItFsJffs160(VOID); -VOID ItFsJffs161(VOID); -VOID ItFsJffs162(VOID); -VOID ItFsJffs163(VOID); -VOID ItFsJffs164(VOID); -VOID ItFsJffs165(VOID); -VOID ItFsJffs166(VOID); -VOID ItFsJffs167(VOID); -VOID ItFsJffs168(VOID); -VOID ItFsJffs169(VOID); -VOID ItFsJffs170(VOID); -VOID ItFsJffs171(VOID); -VOID ItFsJffs172(VOID); -VOID ItFsJffs173(VOID); -VOID ItFsJffs174(VOID); -VOID ItFsJffs175(VOID); -VOID ItFsJffs176(VOID); -VOID ItFsJffs177(VOID); -VOID ItFsJffs178(VOID); -VOID ItFsJffs179(VOID); -VOID ItFsJffs180(VOID); -VOID ItFsJffs182(VOID); -VOID ItFsJffs183(VOID); -VOID ItFsJffs184(VOID); -VOID ItFsJffs185(VOID); -VOID ItFsJffs187(VOID); -VOID ItFsJffs188(VOID); -VOID ItFsJffs189(VOID); -VOID ItFsJffs190(VOID); -VOID ItFsJffs191(VOID); -VOID ItFsJffs192(VOID); -VOID ItFsJffs193(VOID); -VOID ItFsJffs194(VOID); -VOID ItFsJffs195(VOID); -VOID ItFsJffs196(VOID); -VOID ItFsJffs197(VOID); -VOID ItFsJffs198(VOID); -VOID ItFsJffs199(VOID); -VOID ItFsJffs200(VOID); -VOID ItFsJffs201(VOID); -VOID ItFsJffs202(VOID); -VOID ItFsJffs203(VOID); -VOID ItFsJffs204(VOID); -VOID ItFsJffs205(VOID); -VOID ItFsJffs206(VOID); -VOID ItFsJffs207(VOID); -VOID ItFsJffs208(VOID); -VOID ItFsJffs209(VOID); -VOID ItFsJffs210(VOID); -VOID ItFsJffs211(VOID); -VOID ItFsJffs212(VOID); -VOID ItFsJffs213(VOID); -VOID ItFsJffs214(VOID); -VOID ItFsJffs215(VOID); -VOID ItFsJffs216(VOID); -VOID ItFsJffs217(VOID); -VOID ItFsJffs218(VOID); -VOID ItFsJffs219(VOID); -VOID ItFsJffs220(VOID); -VOID ItFsJffs221(VOID); -VOID ItFsJffs222(VOID); -VOID ItFsJffs223(VOID); -VOID ItFsJffs224(VOID); -VOID ItFsJffs225(VOID); -VOID ItFsJffs226(VOID); -VOID ItFsJffs227(VOID); -VOID ItFsJffs228(VOID); -VOID ItFsJffs229(VOID); -VOID ItFsJffs230(VOID); -VOID ItFsJffs231(VOID); -VOID ItFsJffs232(VOID); -VOID ItFsJffs233(VOID); -VOID ItFsJffs234(VOID); -VOID ItFsJffs235(VOID); -VOID ItFsJffs236(VOID); -VOID ItFsJffs237(VOID); -VOID ItFsJffs238(VOID); -VOID ItFsJffs239(VOID); -VOID ItFsJffs240(VOID); -VOID ItFsJffs241(VOID); -VOID ItFsJffs242(VOID); -VOID ItFsJffs243(VOID); -VOID ItFsJffs244(VOID); -VOID ItFsJffs245(VOID); -VOID ItFsJffs246(VOID); -VOID ItFsJffs247(VOID); -VOID ItFsJffs248(VOID); -VOID ItFsJffs249(VOID); -VOID ItFsJffs250(VOID); -VOID ItFsJffs251(VOID); -VOID ItFsJffs252(VOID); -VOID ItFsJffs253(VOID); -VOID ItFsJffs254(VOID); -VOID ItFsJffs255(VOID); -VOID ItFsJffs256(VOID); -VOID ItFsJffs257(VOID); -VOID ItFsJffs258(VOID); -VOID ItFsJffs259(VOID); -VOID ItFsJffs260(VOID); -VOID ItFsJffs261(VOID); -VOID ItFsJffs262(VOID); -VOID ItFsJffs263(VOID); -VOID ItFsJffs264(VOID); -VOID ItFsJffs265(VOID); -VOID ItFsJffs266(VOID); -VOID ItFsJffs267(VOID); -VOID ItFsJffs268(VOID); -VOID ItFsJffs269(VOID); -VOID ItFsJffs270(VOID); -VOID ItFsJffs271(VOID); -VOID ItFsJffs272(VOID); -VOID ItFsJffs273(VOID); -VOID ItFsJffs274(VOID); -VOID ItFsJffs275(VOID); -VOID ItFsJffs276(VOID); -VOID ItFsJffs277(VOID); -VOID ItFsJffs278(VOID); -VOID ItFsJffs279(VOID); -VOID ItFsJffs280(VOID); -VOID ItFsJffs281(VOID); -VOID ItFsJffs282(VOID); -VOID ItFsJffs283(VOID); -VOID ItFsJffs284(VOID); -VOID ItFsJffs285(VOID); -VOID ItFsJffs286(VOID); -VOID ItFsJffs287(VOID); -VOID ItFsJffs288(VOID); -VOID ItFsJffs289(VOID); -VOID ItFsJffs290(VOID); -VOID ItFsJffs291(VOID); -VOID ItFsJffs292(VOID); -VOID ItFsJffs293(VOID); -VOID ItFsJffs294(VOID); -VOID ItFsJffs295(VOID); -VOID ItFsJffs296(VOID); -VOID ItFsJffs297(VOID); -VOID ItFsJffs298(VOID); -VOID ItFsJffs299(VOID); -VOID ItFsJffs300(VOID); -VOID ItFsJffs301(VOID); -VOID ItFsJffs302(VOID); -VOID ItFsJffs303(VOID); -VOID ItFsJffs304(VOID); -VOID ItFsJffs305(VOID); -VOID ItFsJffs306(VOID); -VOID ItFsJffs307(VOID); -VOID ItFsJffs308(VOID); -VOID ItFsJffs309(VOID); -VOID ItFsJffs310(VOID); -VOID ItFsJffs311(VOID); -VOID ItFsJffs312(VOID); -VOID ItFsJffs313(VOID); -VOID ItFsJffs314(VOID); -VOID ItFsJffs315(VOID); -VOID ItFsJffs316(VOID); -VOID ItFsJffs317(VOID); -VOID ItFsJffs318(VOID); -VOID ItFsJffs319(VOID); -VOID ItFsJffs320(VOID); -VOID ItFsJffs321(VOID); -VOID ItFsJffs322(VOID); -VOID ItFsJffs323(VOID); -VOID ItFsJffs324(VOID); -VOID ItFsJffs325(VOID); -VOID ItFsJffs326(VOID); -VOID ItFsJffs327(VOID); -VOID ItFsJffs328(VOID); -VOID ItFsJffs329(VOID); -VOID ItFsJffs330(VOID); -VOID ItFsJffs331(VOID); -VOID ItFsJffs332(VOID); -VOID ItFsJffs333(VOID); -VOID ItFsJffs334(VOID); -VOID ItFsJffs335(VOID); -VOID ItFsJffs336(VOID); -VOID ItFsJffs337(VOID); -VOID ItFsJffs338(VOID); -VOID ItFsJffs339(VOID); -VOID ItFsJffs340(VOID); -VOID ItFsJffs341(VOID); -VOID ItFsJffs342(VOID); -VOID ItFsJffs343(VOID); -VOID ItFsJffs344(VOID); -VOID ItFsJffs345(VOID); -VOID ItFsJffs346(VOID); -VOID ItFsJffs347(VOID); -VOID ItFsJffs348(VOID); -VOID ItFsJffs349(VOID); -VOID ItFsJffs350(VOID); -VOID ItFsJffs351(VOID); -VOID ItFsJffs352(VOID); -VOID ItFsJffs353(VOID); -VOID ItFsJffs354(VOID); -VOID ItFsJffs355(VOID); -VOID ItFsJffs356(VOID); -VOID ItFsJffs357(VOID); -VOID ItFsJffs358(VOID); -VOID ItFsJffs359(VOID); -VOID ItFsJffs360(VOID); -VOID ItFsJffs361(VOID); -VOID ItFsJffs362(VOID); -VOID ItFsJffs363(VOID); -VOID ItFsJffs364(VOID); -VOID ItFsJffs365(VOID); -VOID ItFsJffs366(VOID); -VOID ItFsJffs367(VOID); -VOID ItFsJffs368(VOID); -VOID ItFsJffs369(VOID); -VOID ItFsJffs370(VOID); -VOID ItFsJffs371(VOID); -VOID ItFsJffs372(VOID); -VOID ItFsJffs373(VOID); -VOID ItFsJffs374(VOID); -VOID ItFsJffs375(VOID); -VOID ItFsJffs376(VOID); -VOID ItFsJffs377(VOID); -VOID ItFsJffs378(VOID); -VOID ItFsJffs379(VOID); -VOID ItFsJffs380(VOID); -VOID ItFsJffs381(VOID); -VOID ItFsJffs382(VOID); -VOID ItFsJffs383(VOID); -VOID ItFsJffs384(VOID); -VOID ItFsJffs385(VOID); -VOID ItFsJffs386(VOID); -VOID ItFsJffs387(VOID); -VOID ItFsJffs388(VOID); -VOID ItFsJffs389(VOID); -VOID ItFsJffs390(VOID); -VOID ItFsJffs391(VOID); -VOID ItFsJffs392(VOID); -VOID ItFsJffs393(VOID); -VOID ItFsJffs394(VOID); -VOID ItFsJffs395(VOID); -VOID ItFsJffs396(VOID); -VOID ItFsJffs397(VOID); -VOID ItFsJffs398(VOID); -VOID ItFsJffs399(VOID); -VOID ItFsJffs400(VOID); -VOID ItFsJffs401(VOID); -VOID ItFsJffs402(VOID); -VOID ItFsJffs403(VOID); -VOID ItFsJffs404(VOID); -VOID ItFsJffs405(VOID); -VOID ItFsJffs406(VOID); -VOID ItFsJffs407(VOID); -VOID ItFsJffs408(VOID); -VOID ItFsJffs409(VOID); -VOID ItFsJffs410(VOID); -VOID ItFsJffs411(VOID); -VOID ItFsJffs412(VOID); -VOID ItFsJffs413(VOID); -VOID ItFsJffs414(VOID); -VOID ItFsJffs415(VOID); -VOID ItFsJffs416(VOID); -VOID ItFsJffs417(VOID); -VOID ItFsJffs418(VOID); -VOID ItFsJffs419(VOID); -VOID ItFsJffs420(VOID); -VOID ItFsJffs421(VOID); -VOID ItFsJffs422(VOID); -VOID ItFsJffs423(VOID); -VOID ItFsJffs424(VOID); -VOID ItFsJffs425(VOID); -VOID ItFsJffs426(VOID); -VOID ItFsJffs427(VOID); -VOID ItFsJffs428(VOID); -VOID ItFsJffs429(VOID); -VOID ItFsJffs430(VOID); -VOID ItFsJffs431(VOID); -VOID ItFsJffs432(VOID); -VOID ItFsJffs433(VOID); -VOID ItFsJffs434(VOID); -VOID ItFsJffs435(VOID); -VOID ItFsJffs436(VOID); -VOID ItFsJffs437(VOID); -VOID ItFsJffs438(VOID); -VOID ItFsJffs439(VOID); -VOID ItFsJffs440(VOID); -VOID ItFsJffs441(VOID); -VOID ItFsJffs442(VOID); -VOID ItFsJffs443(VOID); -VOID ItFsJffs444(VOID); -VOID ItFsJffs445(VOID); -VOID ItFsJffs446(VOID); -VOID ItFsJffs447(VOID); -VOID ItFsJffs448(VOID); -VOID ItFsJffs449(VOID); -VOID ItFsJffs450(VOID); -VOID ItFsJffs451(VOID); -VOID ItFsJffs452(VOID); -VOID ItFsJffs453(VOID); -VOID ItFsJffs454(VOID); -VOID ItFsJffs455(VOID); -VOID ItFsJffs456(VOID); -VOID ItFsJffs457(VOID); -VOID ItFsJffs458(VOID); -VOID ItFsJffs459(VOID); -VOID ItFsJffs460(VOID); -VOID ItFsJffs461(VOID); -VOID ItFsJffs462(VOID); -VOID ItFsJffs463(VOID); -VOID ItFsJffs464(VOID); -VOID ItFsJffs465(VOID); -VOID ItFsJffs466(VOID); -VOID ItFsJffs467(VOID); -VOID ItFsJffs468(VOID); -VOID ItFsJffs469(VOID); -VOID ItFsJffs470(VOID); -VOID ItFsJffs471(VOID); -VOID ItFsJffs472(VOID); -VOID ItFsJffs473(VOID); -VOID ItFsJffs475(VOID); -VOID ItFsJffs476(VOID); -VOID ItFsJffs477(VOID); -VOID ItFsJffs478(VOID); -VOID ItFsJffs479(VOID); -VOID ItFsJffs480(VOID); -VOID ItFsJffs481(VOID); -VOID ItFsJffs482(VOID); -VOID ItFsJffs483(VOID); -VOID ItFsJffs484(VOID); -VOID ItFsJffs485(VOID); -VOID ItFsJffs486(VOID); -VOID ItFsJffs487(VOID); -VOID ItFsJffs488(VOID); -VOID ItFsJffs489(VOID); -VOID ItFsJffs490(VOID); -VOID ItFsJffs491(VOID); -VOID ItFsJffs492(VOID); -VOID ItFsJffs493(VOID); -VOID ItFsJffs494(VOID); -VOID ItFsJffs495(VOID); -VOID ItFsJffs496(VOID); -VOID ItFsJffs497(VOID); -VOID ItFsJffs498(VOID); -VOID ItFsJffs499(VOID); -VOID ItFsJffs500(VOID); -VOID ItFsJffs501(VOID); -VOID ItFsJffs502(VOID); -VOID ItFsJffs503(VOID); -VOID ItFsJffs504(VOID); -VOID ItFsJffs505(VOID); -VOID ItFsJffs506(VOID); -VOID ItFsJffs507(VOID); -VOID ItFsJffs508(VOID); -VOID ItFsJffs509(VOID); -VOID ItFsJffs510(VOID); -VOID ItFsJffs511(VOID); -VOID ItFsJffs512(VOID); -VOID ItFsJffs513(VOID); -VOID ItFsJffs514(VOID); -VOID ItFsJffs515(VOID); -VOID ItFsJffs516(VOID); -VOID ItFsJffs517(VOID); -VOID ItFsJffs518(VOID); -VOID ItFsJffs519(VOID); -VOID ItFsJffs520(VOID); -VOID ItFsJffs521(VOID); -VOID ItFsJffs522(VOID); -VOID ItFsJffs523(VOID); -VOID ItFsJffs524(VOID); -VOID ItFsJffs525(VOID); -VOID ItFsJffs526(VOID); -VOID ItFsJffs528(VOID); -VOID ItFsJffs529(VOID); -VOID ItFsJffs530(VOID); -VOID ItFsJffs531(VOID); -VOID ItFsJffs532(VOID); -VOID ItFsJffs533(VOID); -VOID ItFsJffs534(VOID); -VOID ItFsJffs536(VOID); -VOID ItFsJffs537(VOID); -VOID ItFsJffs538(VOID); -VOID ItFsJffs539(VOID); -VOID ItFsJffs540(VOID); -VOID ItFsJffs541(VOID); -VOID ItFsJffs542(VOID); -VOID ItFsJffs543(VOID); -VOID ItFsJffs544(VOID); -VOID ItFsJffs545(VOID); -VOID ItFsJffs546(VOID); -VOID ItFsJffs547(VOID); -VOID ItFsJffs548(VOID); -VOID ItFsJffs549(VOID); -VOID ItFsJffs550(VOID); -VOID ItFsJffs551(VOID); -VOID ItFsJffs552(VOID); -VOID ItFsJffs553(VOID); -VOID ItFsJffs554(VOID); -VOID ItFsJffs555(VOID); -VOID ItFsJffs556(VOID); -VOID ItFsJffs557(VOID); -VOID ItFsJffs560(VOID); -VOID ItFsJffs562(VOID); -VOID ItFsJffs563(VOID); -VOID ItFsJffs564(VOID); -VOID ItFsJffs565(VOID); -VOID ItFsJffs566(VOID); -VOID ItFsJffs567(VOID); -VOID ItFsJffs568(VOID); -VOID ItFsJffs569(VOID); -VOID ItFsJffs570(VOID); -VOID ItFsJffs571(VOID); -VOID ItFsJffs572(VOID); -VOID ItFsJffs573(VOID); -VOID ItFsJffs574(VOID); - -VOID ItFsJffs124(VOID); -VOID ItFsJffs125(VOID); -VOID ItFsJffs577(VOID); -VOID ItFsJffs578(VOID); -VOID ItFsJffs578(VOID); -VOID ItFsJffs579(VOID); -VOID ItFsJffs580(VOID); -VOID ItFsJffs581(VOID); -VOID ItFsJffs582(VOID); -VOID ItFsJffs583(VOID); -VOID ItFsJffs584(VOID); -VOID ItFsJffs585(VOID); -VOID ItFsJffs586(VOID); -VOID ItFsJffs589(VOID); -VOID ItFsJffs590(VOID); -VOID ItFsJffs591(VOID); -VOID ItFsJffs592(VOID); -VOID ItFsJffs593(VOID); -VOID ItFsJffs594(VOID); -VOID ItFsJffs595(VOID); -VOID ItFsJffs596(VOID); -VOID ItFsJffs603(VOID); -VOID ItFsJffs605(VOID); -VOID ItFsJffs606(VOID); -VOID ItFsJffs607(VOID); -VOID ItFsJffs608(VOID); -VOID ItFsJffs609(VOID); -VOID ItFsJffs610(VOID); -VOID ItFsJffs611(VOID); -VOID ItFsJffs612(VOID); -VOID ItFsJffs613(VOID); -VOID ItFsJffs614(VOID); -VOID ItFsJffs615(VOID); -VOID ItFsJffs618(VOID); -VOID ItFsJffs619(VOID); -VOID ItFsJffs620(VOID); -VOID ItFsJffs621(VOID); -VOID ItFsJffs622(VOID); -VOID ItFsJffs623(VOID); -VOID ItFsJffs624(VOID); -VOID ItFsJffs625(VOID); -VOID ItFsJffs626(VOID); -VOID ItFsJffs627(VOID); -VOID ItFsJffs628(VOID); -VOID ItFsJffs629(VOID); -VOID ItFsJffs636(VOID); -VOID ItFsJffs643(VOID); -VOID ItFsJffs644(VOID); -VOID ItFsJffs645(VOID); -VOID ItFsJffs646(VOID); -VOID ItFsJffs648(VOID); -VOID ItFsJffs649(VOID); -VOID ItFsJffs650(VOID); -VOID ItFsJffs651(VOID); -VOID ItFsJffs652(VOID); -VOID ItFsJffs653(VOID); -VOID ItFsJffs654(VOID); -VOID ItFsJffs655(VOID); -VOID ItFsJffs656(VOID); -VOID ItFsJffs663(VOID); -VOID ItFsJffs664(VOID); -VOID ItFsJffs665(VOID); -VOID ItFsJffs666(VOID); -VOID ItFsJffs668(VOID); -VOID ItFsJffs669(VOID); -VOID ItFsJffs670(VOID); -VOID ItFsJffs671(VOID); -VOID ItFsJffs672(VOID); -VOID ItFsJffs673(VOID); -VOID ItFsJffs674(VOID); -VOID ItFsJffs675(VOID); -VOID ItFsJffs676(VOID); -VOID ItFsJffs690(VOID); -VOID ItFsJffs694(VOID); -VOID ItFsJffs696(VOID); -VOID ItFsJffs697(VOID); -VOID ItFsJffs700(VOID); -VOID ItFsJffs701(VOID); -VOID ItFsJffs800(VOID); -VOID ItFsJffs807(VOID); -VOID ItFsJffs808(VOID); - -VOID ItFsJffsLSFD_001(VOID); -VOID ItFsJffsLSFD_002(VOID); -VOID ItFsJffsLSFD_003(VOID); -VOID ItFsJffsLSFD_004(VOID); -VOID ItFsJffsLSFD_005(VOID); -VOID ItFsJffsLSFD_006(VOID); -VOID ItFsJffsLSFD_007(VOID); - -VOID ItFsTestLink001(VOID); -VOID ItFsTestLink002(VOID); -VOID ItFsTestLink003(VOID); -VOID ItFsTestLinkat001(VOID); -VOID ItFsTestLinkat002(VOID); -VOID ItFsTestLinkat003(VOID); -VOID ItFsTestReadlink001(VOID); -VOID ItFsTestSymlink001(VOID); -VOID ItFsTestSymlink002(VOID); -VOID ItFsTestSymlink003(VOID); -VOID ItFsTestSymlinkat001(VOID); -VOID ItFsTestMountRdonly001(VOID); -VOID ItFsTestMountRdonly002(VOID); -VOID ItFsTestMountRdonly003(VOID); -#endif - -#if defined(LOSCFG_USER_TESTSUIT_SHELL) -VOID ItFsJffsLSFD_008(VOID); -VOID ItFsJffsLSFD_009(VOID); -#endif - -#if defined(LOSCFG_USER_TEST_PRESSURE) -VOID ItFsJffsMultipthread001(VOID); -VOID ItFsJffsMultipthread002(VOID); -VOID ItFsJffsMultipthread003(VOID); -VOID ItFsJffsMultipthread004(VOID); -VOID ItFsJffsMultipthread005(VOID); -VOID ItFsJffsMultipthread006(VOID); -VOID ItFsJffsMultipthread007(VOID); -VOID ItFsJffsMultipthread008(VOID); -VOID ItFsJffsMultipthread009(VOID); -VOID ItFsJffsMultipthread010(VOID); -VOID ItFsJffsMultipthread011(VOID); -VOID ItFsJffsMultipthread012(VOID); -VOID ItFsJffsMultipthread013(VOID); -VOID ItFsJffsMultipthread014(VOID); -VOID ItFsJffsMultipthread015(VOID); -VOID ItFsJffsMultipthread016(VOID); -VOID ItFsJffsMultipthread017(VOID); -VOID ItFsJffsMultipthread018(VOID); -VOID ItFsJffsMultipthread019(VOID); -VOID ItFsJffsMultipthread020(VOID); -VOID ItFsJffsMultipthread021(VOID); -VOID ItFsJffsMultipthread022(VOID); -VOID ItFsJffsMultipthread023(VOID); -VOID ItFsJffsMultipthread024(VOID); -VOID ItFsJffsMultipthread025(VOID); -VOID ItFsJffsMultipthread026(VOID); -VOID ItFsJffsMultipthread027(VOID); -VOID ItFsJffsMultipthread028(VOID); -VOID ItFsJffsMultipthread029(VOID); -VOID ItFsJffsMultipthread030(VOID); -VOID ItFsJffsMultipthread031(VOID); -VOID ItFsJffsMultipthread032(VOID); -VOID ItFsJffsMultipthread033(VOID); -VOID ItFsJffsMultipthread034(VOID); -VOID ItFsJffsMultipthread035(VOID); -VOID ItFsJffsMultipthread036(VOID); -VOID ItFsJffsMultipthread037(VOID); -VOID ItFsJffsMultipthread038(VOID); -VOID ItFsJffsMultipthread039(VOID); -VOID ItFsJffsMultipthread040(VOID); -VOID ItFsJffsMultipthread041(VOID); -VOID ItFsJffsMultipthread042(VOID); -VOID ItFsJffsMultipthread043(VOID); -VOID ItFsJffsMultipthread044(VOID); -VOID ItFsJffsMultipthread045(VOID); -VOID ItFsJffsMultipthread046(VOID); -VOID ItFsJffsMultipthread047(VOID); -VOID ItFsJffsMultipthread048(VOID); -VOID ItFsJffsMultipthread049(VOID); -VOID ItFsJffsMultipthread050(VOID); -VOID ItFsJffsMultipthread051(VOID); -VOID ItFsJffsMultipthread052(VOID); -VOID ItFsJffsMultipthread053(VOID); -VOID ItFsJffsMultipthread054(VOID); -VOID ItFsJffsMultipthread055(VOID); -VOID ItFsJffsMultipthread056(VOID); -VOID ItFsJffsMultipthread057(VOID); -VOID ItFsJffsMultipthread058(VOID); -VOID ItFsJffsMultipthread059(VOID); -VOID ItFsJffsMultipthread060(VOID); -VOID ItFsJffsMultipthread061(VOID); -VOID ItFsJffsMultipthread062(VOID); -VOID ItFsJffsMultipthread063(VOID); - -VOID ItFsJffsPressure001(VOID); -VOID ItFsJffsPressure002(VOID); -VOID ItFsJffsPressure003(VOID); -VOID ItFsJffsPressure004(VOID); -VOID ItFsJffsPressure005(VOID); -VOID ItFsJffsPressure006(VOID); -VOID ItFsJffsPressure007(VOID); -VOID ItFsJffsPressure008(VOID); -VOID ItFsJffsPressure009(VOID); -VOID ItFsJffsPressure010(VOID); -VOID ItFsJffsPressure011(VOID); -VOID ItFsJffsPressure012(VOID); -VOID ItFsJffsPRESSURE_013(VOID); -VOID ItFsJffsPressure014(VOID); -VOID ItFsJffsPressure015(VOID); -VOID ItFsJffsPressure016(VOID); -VOID ItFsJffsPressure017(VOID); -VOID ItFsJffsPressure018(VOID); -VOID ItFsJffsPressure019(VOID); -VOID ItFsJffsPressure020(VOID); -VOID ItFsJffsPressure021(VOID); -VOID ItFsJffsPressure022(VOID); -VOID ItFsJffsPressure023(VOID); -VOID ItFsJffsPressure024(VOID); -VOID ItFsJffsPressure025(VOID); -VOID ItFsJffsPressure026(VOID); -VOID ItFsJffsPressure027(VOID); -VOID ItFsJffsPressure028(VOID); -VOID ItFsJffsPressure029(VOID); -VOID ItFsJffsPressure030(VOID); -VOID ItFsJffsPressure031(VOID); -VOID ItFsJffsPressure032(VOID); -VOID ItFsJffsPressure033(VOID); -VOID ItFsJffsPressure034(VOID); -VOID ItFsJffsPressure035(VOID); -VOID ItFsJffsPressure036(VOID); -VOID ItFsJffsPressure037(VOID); -VOID ItFsJffsPressure038(VOID); -VOID ItFsJffsPressure039(VOID); -VOID ItFsJffsPressure040(VOID); -VOID ItFsJffsPressure041(VOID); -VOID ItFsJffsPressure042(VOID); -VOID ItFsJffsPressure043(VOID); -VOID ItFsJffsPressure044(VOID); -VOID ItFsJffsPressure045(VOID); -VOID ItFsJffsPressure046(VOID); -VOID ItFsJffsPressure047(VOID); -VOID ItFsJffsPressure048(VOID); -VOID ItFsJffsPressure049(VOID); -VOID ItFsJffsPressure050(VOID); -VOID ItFsJffsPressure051(VOID); -VOID ItFsJffsPressure052(VOID); -VOID ItFsJffsPressure053(VOID); - -VOID ItFsJffsPressure301(VOID); -VOID ItFsJffsPressure302(VOID); -VOID ItFsJffsPressure303(VOID); -VOID ItFsJffsPressure304(VOID); -VOID ItFsJffsPressure305(VOID); -VOID ItFsJffsPressure306(VOID); -VOID ItFsJffsPressure307(VOID); -VOID ItFsJffsPressure308(VOID); -VOID ItFsJffsPressure309(VOID); -VOID ItFsJffsPressure310(VOID); -VOID ItFsJffsPressure311(VOID); -VOID ItFsJffsPressure312(VOID); -VOID ItFsJffsPressure313(VOID); -VOID ItFsJffsPressure314(VOID); -VOID ItFsJffsPressure315(VOID); - -VOID ItFsJffsPerformance001(VOID); -VOID ItFsJffsPerformance002(VOID); -VOID ItFsJffsPerformance003(VOID); -VOID ItFsJffsPerformance004(VOID); -VOID ItFsJffsPerformance005(VOID); -VOID ItFsJffsPerformance006(VOID); -VOID ItFsJffsPerformance007(VOID); -VOID ItFsJffsPerformance008(VOID); -VOID ItFsJffsPerformance009(VOID); -VOID ItFsJffsPerformance010(VOID); -VOID ItFsJffsPerformance011(VOID); -VOID ItFsJffsPerformance012(VOID); -VOID ItFsJffsPerformance013(VOID); -#endif - -#if defined(LOSCFG_USER_TEST_LLT) -VOID ItFsJffs036(VOID); -VOID ItFsJffs087(VOID); -VOID ItFsJffs108(VOID); -VOID ItFsJffs181(VOID); -VOID ItFsJffs186(VOID); -VOID ItFsJffs474(VOID); -VOID ItFsJffs527(VOID); -VOID ItFsJffs558(VOID); -VOID ItFsJffs559(VOID); -VOID ItFsJffs561(VOID); -VOID ItFsJffs616(VOID); -VOID ItFsJffs698(VOID); -VOID ItFsJffs699(VOID); -VOID LLT_VFS_JFFS_003(VOID); -VOID LLT_VFS_JFFS_014(VOID); -#endif diff --git a/testsuites/unittest/fs/jffs/config.gni b/testsuites/unittest/fs/jffs/config.gni deleted file mode 100644 index 9239692c..00000000 --- a/testsuites/unittest/fs/jffs/config.gni +++ /dev/null @@ -1,801 +0,0 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. 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. -# -# 3. Neither the name of the copyright holder nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. - -import("//kernel/liteos_a/testsuites/unittest/config.gni") - -jffs_include_dirs = [ "$TEST_UNITTEST_DIR/fs/jffs" ] - -jffs_sources_entry = [ "$TEST_UNITTEST_DIR/fs/jffs/vfs_jffs_test.cpp" ] - -jffs_sources_smoke = [ - "$TEST_UNITTEST_DIR/fs/jffs/smoke/It_vfs_jffs_001.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/smoke/It_vfs_jffs_002.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/smoke/It_vfs_jffs_003.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/smoke/It_vfs_jffs_005.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/smoke/It_vfs_jffs_021.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/smoke/It_vfs_jffs_022.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/smoke/It_vfs_jffs_026.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/smoke/It_vfs_jffs_027.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/smoke/It_vfs_jffs_034.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/smoke/It_vfs_jffs_035.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/smoke/It_vfs_jffs_094.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/smoke/It_vfs_jffs_095.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/smoke/It_vfs_jffs_103.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/smoke/It_vfs_jffs_535.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/smoke/It_vfs_jffs_Dac_001.cpp", -] - -jffs_sources_smoke = [ - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_performance_001.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_performance_002.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_performance_003.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_performance_004.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_performance_005.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_performance_006.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_performance_007.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_performance_008.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_performance_009.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_performance_010.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_performance_011.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_performance_012.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_performance_013.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_001.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_002.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_003.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_004.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_005.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_006.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_007.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_008.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_009.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_010.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_011.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_012.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_014.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_015.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_016.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_017.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_018.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_019.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_020.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_021.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_022.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_023.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_024.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_025.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_026.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_027.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_028.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_029.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_030.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_031.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_032.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_033.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_034.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_035.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_036.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_037.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_038.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_039.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_040.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_041.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_042.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_043.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_044.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_045.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_046.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_047.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_048.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_049.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_050.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_051.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_052.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_053.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_301.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_302.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_303.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_304.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_305.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_306.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_307.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_308.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_309.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_310.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_311.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_312.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_313.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_314.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_fs_jffs_pressure_315.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_001.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_002.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_003.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_004.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_005.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_006.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_007.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_008.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_009.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_010.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_011.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_012.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_013.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_014.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_015.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_016.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_017.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_018.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_019.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_020.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_021.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_022.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_023.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_024.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_025.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_026.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_027.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_028.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_029.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_030.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_031.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_032.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_033.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_034.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_035.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_036.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_037.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_038.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_039.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_040.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_041.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_042.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_043.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_044.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_045.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_046.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_047.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_048.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_049.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_050.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_051.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_052.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_053.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_054.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_055.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_056.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_057.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_058.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_059.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_060.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_061.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_062.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/pressure/It_vfs_jffs_multipthread_063.cpp", -] - -jffs_sources_full = [ - "$TEST_UNITTEST_DIR/fs/jffs/full/It_test_faccessat_001.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_test_faccessat_002.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_test_fstatat_001.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_test_fstatat_002.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_test_fstatfs_001.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_test_fstatfs_002.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/it_test_fs_jffs_001.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/it_test_fs_jffs_002.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/it_test_fs_jffs_003.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/it_test_fs_jffs_004.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/it_test_fs_jffs_100.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/it_test_fs_jffs_101.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/it_test_fs_jffs_106.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/it_test_fs_jffs_112.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/it_test_fs_jffs_113.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_001.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_002.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_003.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_004.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_005.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_006.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_007.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_008.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_009.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_010.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_011.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_012.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_013.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_014.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_015.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_016.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_017.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_018.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_019.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_020.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_021.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_022.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_023.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_024.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_025.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_026.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_027.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_028.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_029.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_030.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_031.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_032.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_033.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_034.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_035.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_036.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_037.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_038.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_039.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_040.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_041.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_042.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_043.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_jffs_044.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_004.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_006.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_007.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_008.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_009.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_010.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_011.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_012.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_013.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_014.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_015.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_016.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_017.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_018.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_019.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_020.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_023.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_024.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_025.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_028.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_029.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_030.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_031.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_032.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_033.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_037.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_038.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_039.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_040.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_041.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_042.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_043.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_044.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_045.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_046.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_048.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_049.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_050.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_051.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_053.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_055.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_056.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_057.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_058.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_059.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_060.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_061.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_062.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_063.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_064.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_065.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_066.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_067.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_068.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_069.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_070.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_071.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_072.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_073.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_074.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_076.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_077.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_078.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_079.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_080.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_081.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_082.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_083.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_084.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_085.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_086.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_088.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_090.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_092.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_093.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_096.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_097.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_099.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_100.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_101.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_102.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_104.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_105.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_106.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_107.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_116.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_117.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_118.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_119.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_120.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_121.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_122.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_123.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_124.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_125.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_126.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_127.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_128.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_129.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_130.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_131.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_132.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_133.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_134.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_135.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_136.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_137.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_138.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_139.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_140.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_141.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_142.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_143.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_144.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_145.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_146.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_147.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_148.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_149.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_150.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_151.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_152.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_153.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_154.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_155.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_156.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_157.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_158.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_159.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_160.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_161.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_162.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_163.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_164.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_165.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_166.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_167.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_168.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_169.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_170.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_171.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_172.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_173.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_174.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_175.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_176.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_177.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_178.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_179.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_180.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_182.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_183.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_184.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_185.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_187.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_188.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_189.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_190.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_191.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_192.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_193.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_194.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_195.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_196.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_197.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_198.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_199.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_200.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_201.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_202.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_203.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_204.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_205.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_206.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_207.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_208.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_209.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_210.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_211.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_212.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_213.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_214.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_215.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_216.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_217.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_218.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_219.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_220.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_221.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_222.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_223.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_224.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_225.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_226.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_227.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_228.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_229.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_230.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_231.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_232.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_233.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_234.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_235.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_236.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_237.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_238.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_239.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_240.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_241.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_242.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_243.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_244.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_245.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_246.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_247.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_248.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_249.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_250.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_251.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_252.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_253.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_254.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_255.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_256.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_257.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_258.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_259.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_260.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_261.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_262.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_263.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_264.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_265.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_266.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_267.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_268.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_269.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_270.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_271.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_272.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_273.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_274.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_275.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_276.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_277.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_278.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_279.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_280.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_281.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_282.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_283.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_284.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_285.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_286.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_287.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_288.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_289.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_290.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_291.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_292.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_293.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_294.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_295.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_296.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_297.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_298.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_299.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_300.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_301.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_302.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_303.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_304.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_305.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_306.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_307.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_308.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_309.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_310.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_311.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_312.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_313.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_314.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_315.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_316.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_317.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_318.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_319.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_320.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_321.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_322.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_323.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_324.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_325.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_326.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_327.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_328.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_329.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_330.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_331.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_332.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_333.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_334.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_335.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_336.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_337.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_338.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_339.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_340.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_342.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_343.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_344.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_346.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_352.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_353.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_354.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_355.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_356.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_357.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_358.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_359.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_360.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_361.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_362.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_364.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_365.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_366.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_367.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_368.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_369.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_370.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_371.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_372.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_373.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_374.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_375.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_376.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_377.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_378.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_379.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_380.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_381.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_382.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_383.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_384.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_385.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_386.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_387.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_388.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_389.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_390.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_391.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_392.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_393.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_394.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_395.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_396.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_397.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_398.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_399.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_400.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_401.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_402.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_403.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_404.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_405.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_406.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_407.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_408.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_409.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_410.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_411.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_412.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_413.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_414.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_415.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_416.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_417.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_418.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_419.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_420.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_421.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_422.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_423.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_424.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_425.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_426.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_427.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_428.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_429.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_430.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_431.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_432.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_433.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_434.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_435.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_454.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_455.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_456.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_457.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_458.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_459.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_460.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_461.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_462.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_487.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_488.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_489.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_490.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_491.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_492.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_493.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_494.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_495.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_496.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_497.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_498.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_499.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_500.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_501.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_502.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_503.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_504.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_505.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_506.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_507.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_508.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_509.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_510.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_511.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_512.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_513.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_514.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_515.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_516.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_517.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_518.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_519.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_520.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_521.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_522.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_523.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_524.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_526.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_528.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_529.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_530.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_531.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_532.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_533.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_534.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_541.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_542.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_543.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_544.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_545.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_546.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_547.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_548.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_549.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_550.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_551.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_552.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_553.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_554.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_555.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_556.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_557.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_560.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_562.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_563.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_564.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_565.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_566.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_567.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_568.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_569.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_570.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_571.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_572.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_573.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_574.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_583.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_584.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_586.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_589.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_590.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_591.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_592.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_593.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_594.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_595.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_596.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_603.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_636.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_643.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_644.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_645.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_646.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_648.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_649.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_650.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_651.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_652.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_653.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_654.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_655.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_656.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_663.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_664.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_665.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_666.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_668.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_669.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_670.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_671.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_672.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_673.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_674.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_675.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_676.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_690.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_694.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_696.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_697.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_700.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_701.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_807.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_jffs_808.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_test_link_001.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_test_link_002.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_test_link_003.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_test_linkat_001.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_test_linkat_002.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_test_linkat_003.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_test_readlink_001.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_test_symlink_001.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_test_symlink_002.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_test_symlink_003.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_test_symlinkat_001.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_test_mount_rdonly_001.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_test_mount_rdonly_002.cpp", - "$TEST_UNITTEST_DIR/fs/jffs/full/It_vfs_test_mount_rdonly_003.cpp", -] diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_001.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_001.cpp deleted file mode 100644 index 89f467e1..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_001.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, dirFd, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dirFd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(dirFd, JFFS_IS_ERROR, dirFd, EXIT1); - - fd = openat(dirFd, "test.txt", O_CREAT | O_RDWR | O_TRUNC); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, "01234567890123456789012345", 16); // 16 means length which will be writed - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlinkat(dirFd, "test.txt", 0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); - unlink(pathname1); - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_NO_ERROR; -} - -VOID ItJffs001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_002.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_002.cpp deleted file mode 100644 index 8c6e3f38..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_002.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = "/test1/test2/test3"; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = "/test1/test2"; - CHAR *dname = NULL; - INT32 ret; - - dname = dirname(pathname1); - ret = strcmp(pathname2, dname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs002(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_003.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_003.cpp deleted file mode 100644 index 7f1f5dcf..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_003.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR *dname = NULL; - INT32 ret; - INT32 fd = -1; - DIR *dir1 = NULL; - DIR *dir2 = NULL; - - dir1 = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir1, NULL, dir1, EXIT); - - ret = closedir(dir1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test123"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - dir2 = fdopendir(fd); - ICUNIT_GOTO_NOT_EQUAL(dir2, NULL, dir2, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = closedir(dir2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - return JFFS_NO_ERROR; -EXIT2: - closedir(dir2); -EXIT1: - unlink(pathname2); - return JFFS_NO_ERROR; -EXIT: - closedir(dir1); - return JFFS_NO_ERROR; -} - -VOID ItJffs003(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_004.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_004.cpp deleted file mode 100644 index b22c3de0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_004.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - CHAR dname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *dname2 = NULL; - CHAR *pret = NULL; - INT32 ret; - - pret = getcwd(dname1, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT); - - dname2 = get_current_dir_name(); - ICUNIT_GOTO_NOT_EQUAL(dname2, NULL, dname2, EXIT); - - ret = strcmp(dname1, dname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs004(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_005.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_005.cpp deleted file mode 100644 index 0521a563..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_005.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret1, ret2; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - - ret1 = getdtablesize(); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret2 = getdtablesize(); - ICUNIT_GOTO_EQUAL(ret2, (ret1 + 1), ret2, EXIT2); - - ret1 = close(fd); - ICUNIT_GOTO_EQUAL(ret1, JFFS_NO_ERROR, ret1, EXIT2); - - ret1 = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret1, JFFS_NO_ERROR, ret1, EXIT1); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs005(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_006.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_006.cpp deleted file mode 100644 index 2e9035d7..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_006.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret1, ret2; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - struct mntent *mnt = NULL; - FILE *fp = NULL; - - ret1 = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "test12"); - ICUNIT_ASSERT_EQUAL(ret1, EOK, ret1); - - fp = setmntent(pathname1, "w+b"); - ICUNIT_GOTO_NOT_EQUAL(fp, NULL, fp, EXIT); - - mnt = getmntent(fp); - ICUNIT_GOTO_NOT_EQUAL(mnt, NULL, mnt, EXIT); - - printf("[%s:%d] mnt->mnt_fsname=%s\n", __FUNCTION__, __LINE__, mnt->mnt_fsname); - printf("[%s:%d] mnt->mnt_dir=%s\n", __FUNCTION__, __LINE__, mnt->mnt_dir); - printf("[%s:%d] mnt->mnt_type=%s\n", __FUNCTION__, __LINE__, mnt->mnt_type); - printf("[%s:%d] mnt->mnt_opts=%s\n", __FUNCTION__, __LINE__, mnt->mnt_opts); - printf("[%s:%d] mnt->mnt_freq=%d\n", __FUNCTION__, __LINE__, mnt->mnt_freq); - printf("[%s:%d] mnt->mnt_passno=%d\n", __FUNCTION__, __LINE__, mnt->mnt_passno); - - endmntent(fp); - unlink(pathname1); - return JFFS_NO_ERROR; -EXIT: - endmntent(fp); - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItJffs006(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_007.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_007.cpp deleted file mode 100644 index 18fb7883..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_007.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MOUNT_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MOUNT_DIR0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MOUNT_DIR0 }; - glob_t buf; - int i, ret; - int fd1 = -1; - int fd2 = -2; - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test1"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, JFFS_IS_ERROR, fd1, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test2"); - fd2 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd2, JFFS_IS_ERROR, fd2, EXIT2); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - glob("/storage/*", GLOB_NOSORT, NULL, &buf); - ICUNIT_GOTO_EQUAL(buf.gl_pathc, 2, buf.gl_pathc, EXIT1); // 2 means size of path - - ret = strcmp(pathname1, buf.gl_pathv[0]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = strcmp(pathname2, buf.gl_pathv[1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - globfree(&buf); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT2: - close(fd2); - unlink(pathname2); -EXIT1: - close(fd1); - unlink(pathname1); -EXIT: - globfree(&buf); - return JFFS_NO_ERROR; -} - -VOID ItJffs007(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_008.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_008.cpp deleted file mode 100644 index f75b0ef4..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_008.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - DIR *dir = NULL; - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - fd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = mkdirat(fd, "TEST", HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = rmdir("/storage/TEST"); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT2: - rmdir("/storage/TEST"); -EXIT1: - closedir(dir); - return JFFS_NO_ERROR; -} - -VOID ItJffs008(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_009.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_009.cpp deleted file mode 100644 index 3119f6f2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_009.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR tempFile[] = "tmp_XXXXXX"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = chdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - fd = mkstemp(tempFile); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlink(tempFile); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - unlink(tempFile); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs009(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_010.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_010.cpp deleted file mode 100644 index 022e8ce3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_010.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR tempFile[] = "tmp_XXXXXX_hello"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = chdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - fd = mkstemps(tempFile, 6); // 6 means size of file - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlink(tempFile); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - unlink(tempFile); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs010(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_011.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_011.cpp deleted file mode 100644 index df31ea3f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_011.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR tempFile[] = "test.XXXXXX"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR *pfd = NULL; - - ret = chdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - pfd = mktemp(tempFile); - ICUNIT_GOTO_NOT_EQUAL(pfd, NULL, pfd, EXIT1); - printf("temp_file = %s\n", tempFile); - - fd = open(pfd, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlink(pfd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - unlink(pfd); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs011(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_012.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_012.cpp deleted file mode 100644 index 931adfd6..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_012.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR tempFile[] = "test_XXXXXX"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR *pfd = NULL; - - ret = chdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - pfd = mkdtemp(tempFile); - ICUNIT_GOTO_NOT_EQUAL(pfd, NULL, pfd, EXIT1); - printf("temp_file = %s, pfd=%s\n", tempFile, pfd); - - ret = rmdir(tempFile); - printf("%s-%d temp=%s ret=%d\n", __FUNCTION__, __LINE__, tempFile, ret); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pfd); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs012(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_013.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_013.cpp deleted file mode 100644 index 92247072..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_013.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR tempFile[] = "test_XXXXXX"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = chdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - fd = mkostemp(tempFile, O_APPEND); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlink(tempFile); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - unlink(tempFile); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs013(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_014.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_014.cpp deleted file mode 100644 index 2f4eb103..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_014.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - - openlog("Test", LOG_CONS | LOG_PID, LOG_USER); - syslog(LOG_INFO, "This is a massage just for test"); - closelog(); - - return JFFS_NO_ERROR; -EXIT: - close(fd); - unlink("Test"); - return JFFS_NO_ERROR; -} - -VOID ItJffs014(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_015.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_015.cpp deleted file mode 100644 index 8112716c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_015.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - long ret; - - ret = pathconf(pathname1, _PC_LINK_MAX); - ICUNIT_GOTO_EQUAL(ret, _POSIX_LINK_MAX, ret, EXIT); - - ret = pathconf(pathname1, _PC_NAME_MAX); - ICUNIT_GOTO_EQUAL(ret, NAME_MAX, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs015(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_016.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_016.cpp deleted file mode 100644 index 5d548c42..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_016.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret1, ret2; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - struct mntent *mnt = NULL; - char *buf = NULL; - static struct mntent mnt1; - FILE *fp = NULL; - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "test12"); - fp = setmntent(pathname1, "w+b"); - ICUNIT_GOTO_NOT_EQUAL(fp, NULL, fp, EXIT); - - mnt = getmntent_r(fp, &mnt1, buf, 1); - ICUNIT_GOTO_NOT_EQUAL(mnt, NULL, mnt, EXIT); - - printf("[%s:%d] mnt->mnt_fsname=%s\n", __FUNCTION__, __LINE__, mnt->mnt_fsname); - printf("[%s:%d] mnt->mnt_dir=%s\n", __FUNCTION__, __LINE__, mnt->mnt_dir); - printf("[%s:%d] mnt->mnt_type=%s\n", __FUNCTION__, __LINE__, mnt->mnt_type); - printf("[%s:%d] mnt->mnt_opts=%s\n", __FUNCTION__, __LINE__, mnt->mnt_opts); - printf("[%s:%d] mnt->mnt_freq=%d\n", __FUNCTION__, __LINE__, mnt->mnt_freq); - printf("[%s:%d] mnt->mnt_passno=%d\n", __FUNCTION__, __LINE__, mnt->mnt_passno); - - endmntent(fp); - unlink(pathname1); - return JFFS_NO_ERROR; -EXIT: - endmntent(fp); - unlink(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItJffs016(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_017.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_017.cpp deleted file mode 100644 index 94fd1569..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_017.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static INT32 DisplayInfo(const char *fpath, const struct stat *sb, int tflag, struct FTW *ftwbuf) -{ - printf("%-3s %2d ", - (tflag == FTW_D) ? "d" : (tflag == FTW_DNR) ? "dnr" : - (tflag == FTW_DP) ? "dp" : (tflag == FTW_F) ? "f" : - (tflag == FTW_NS) ? "ns" : (tflag == FTW_SL) ? "sl" : - (tflag == FTW_SLN) ? "sln" : "???", - ftwbuf->level); - - if (tflag == FTW_NS) { - printf("-------"); - } else { - printf("%7d", (intmax_t)sb->st_size); - } - - printf(" %-40s %d %s\n", fpath, ftwbuf->base, fpath + ftwbuf->base); - - return 0; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 flags = 0; - CHAR *pathnamedir = { JFFS_MAIN_DIR0 }; - CHAR pathname01[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname11[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR pathname02[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - - ret = mkdir(pathname01, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mkdir(pathname11, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mkdir(pathname02, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = nftw(pathnamedir, DisplayInfo, 20, flags); // 20 means max fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = rmdir(pathname02); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = rmdir(pathname11); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname01); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT3: - rmdir(pathname02); -EXIT2: - rmdir(pathname11); -EXIT1: - rmdir(pathname01); - return JFFS_IS_ERROR; -} - -VOID ItJffs017(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_018.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_018.cpp deleted file mode 100644 index d285c6fe..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_018.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -#define TEST_STR "hello world" -static UINT32 Testcase(VOID) -{ - FILE *fd = NULL; - INT32 ret; - size_t size; - char *ptr = NULL; - char *ptr1 = TEST_STR; - - fd = open_memstream(&ptr, &size); - ICUNIT_GOTO_NOT_EQUAL(fd, NULL, fd, EXIT1); - - fprintf(fd, TEST_STR); - - ret = fclose(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = strcmp(ptr, ptr1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = strlen(ptr); - ICUNIT_GOTO_EQUAL(size, ret, size, EXIT); - - free(ptr); - return JFFS_NO_ERROR; -EXIT1: - fclose(fd); -EXIT: - free(ptr); - return JFFS_IS_ERROR; -} - -VOID ItJffs018(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_019.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_019.cpp deleted file mode 100644 index cc9c954b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_019.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static constexpr wchar_t* TEST_STR = L"hello world"; -static UINT32 Testcase(VOID) -{ - FILE *fd = NULL; - INT32 ret; - size_t size; - wchar_t *ptr = NULL; - wchar_t *ptr1 = { TEST_STR }; - - fd = open_wmemstream(&ptr, &size); - ICUNIT_GOTO_NOT_EQUAL(fd, NULL, fd, EXIT1); - - fwprintf(fd, ptr1); - - ret = fclose(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = wcscmp(ptr, ptr1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = wcslen(ptr); - ICUNIT_GOTO_EQUAL(size, ret, size, EXIT); - - free(ptr); - return JFFS_NO_ERROR; -EXIT1: - fclose(fd); -EXIT: - free(ptr); - return JFFS_IS_ERROR; -} - -VOID ItJffs019(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_020.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_020.cpp deleted file mode 100644 index a8a54150..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_020.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -static constexpr int LINE_LENGTH = 50; -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathnamedir[LINE_LENGTH] = { JFFS_MAIN_DIR0 }; - FILE *file = nullptr; - CHAR line[LINE_LENGTH]; - CHAR *ptr = NULL; - - ret = chdir(pathnamedir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - file = popen("pwd", "r"); - ICUNIT_GOTO_NOT_EQUAL(file, NULL, file, EXIT); - - ptr = fgets(line, LINE_LENGTH, file); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT1); - - (void)strcat_s(pathnamedir, LINE_LENGTH, "\n"); - ret = strcmp(line, pathnamedir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = pclose(file); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - pclose(file); -EXIT: - return JFFS_IS_ERROR; -} - -VOID ItJffs020(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_021.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_021.cpp deleted file mode 100644 index 40b1458e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_021.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - DIR *dirp = NULL; - INT32 ret; - CHAR *pathnamedir = { JFFS_MAIN_DIR0 }; - CHAR pathname01[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct dirent *dp1 = (struct dirent *)malloc(sizeof(struct dirent)); - struct dirent *dp2 = (struct dirent *)malloc(sizeof(struct dirent)); - struct dirent *dp2Bak = dp2; - - (void)strcat_s(pathname01, JFFS_STANDARD_NAME_LENGTH, "/test1"); - ret = mkdir(pathname01, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dirp = opendir(pathnamedir); - ICUNIT_GOTO_NOT_EQUAL(dirp, NULL, dirp, EXIT2); - - while (1) { - readdir_r(dirp, dp1, &dp2); - - if (dp2 == NULL) { - break; - } - - ret = strcmp(dp2->d_name, "test1"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ret = rmdir(pathname01); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - closedir(dirp); - free(dp1); - free(dp2Bak); - return JFFS_NO_ERROR; -EXIT2: - rmdir(pathname01); - closedir(dirp); - free(dp1); - free(dp2Bak); - return JFFS_IS_ERROR; -EXIT1: - rmdir(pathname01); - return JFFS_IS_ERROR; -} - -VOID ItJffs021(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_022.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_022.cpp deleted file mode 100644 index 8f27f5df..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_022.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static constexpr int MB = 1024 * 1024; - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR *pathname = { JFFS_MAIN_DIR0 }; - struct statvfs vfs; - fsblkcnt_t blockSize; - fsblkcnt_t blockCount; - fsblkcnt_t totalSize; - fsblkcnt_t freeSize; - fsblkcnt_t usedSize; - fsblkcnt_t availSize; - - ret = statvfs(pathname, &vfs); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - blockSize = vfs.f_bsize; - totalSize = vfs.f_blocks * blockSize; - freeSize = vfs.f_bfree * blockSize; - usedSize = (vfs.f_blocks - vfs.f_bavail) * blockSize; - availSize = vfs.f_bavail * blockSize; - - printf("total_size = %0.2lf MB\n", (double)totalSize / (MB)); - printf("free_size = %0.2lf MB\n", (double)freeSize / (MB)); - printf("used_size = %0.2lf MB\n", (double)usedSize / (MB)); - printf("avail_size = %0.2lf MB\n", (double)availSize / (MB)); - - return JFFS_NO_ERROR; -EXIT: - return JFFS_IS_ERROR; -} - -VOID ItJffs022(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_023.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_023.cpp deleted file mode 100644 index de61e31d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_023.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, dirFd, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dirFd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(dirFd, JFFS_IS_ERROR, dirFd, EXIT1); - printf("dirFd = %d\n", dirFd); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test.txt"); - fd = open(pathname2, O_CREAT | O_RDWR | O_TRUNC); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, "01234567890123456789012345", 16); // 16 means write len - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlinkat(dirFd, "test.txt", 0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); - unlink(pathname1); - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_NO_ERROR; -} - -VOID ItJffs023(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_024.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_024.cpp deleted file mode 100644 index 9e11065d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_024.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, dirFd, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dirFd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(dirFd, JFFS_IS_ERROR, dirFd, EXIT1); - printf("dirFd = %d\n", dirFd); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test.txt"); - fd = open(pathname2, O_CREAT | O_RDWR | O_TRUNC); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, "01234567890123456789012345", 16); // 16 means write len - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = renameat(dirFd, "test.txt", dirFd, "TEST.txt"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/TEST.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); -EXIT2: - unlink(pathname1); - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_NO_ERROR; -} - -VOID ItJffs024(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_025.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_025.cpp deleted file mode 100644 index 756fb6fa..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_025.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - FILE *fp = NULL; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - - fp = fopen(pathname1, "w+"); - ICUNIT_GOTO_NOT_EQUAL(fp, NULL, fp, EXIT); - - ret = fclose(fp); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - fclose(fp); -EXIT: - unlink(pathname1); - return JFFS_IS_ERROR; -} - -VOID ItJffs025(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_026.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_026.cpp deleted file mode 100644 index 22c98fe4..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_026.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItJffs026(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_027.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_027.cpp deleted file mode 100644 index 6138c427..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_027.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItJffs027(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_028.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_028.cpp deleted file mode 100644 index dcac6ef2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_028.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static constexpr int TEST_STRLEN = 30; -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname[TEST_STRLEN] = { JFFS_BASE_DIR }; - CHAR pathname1[TEST_STRLEN] = { JFFS_PATH_NAME0 }; - CHAR pathname2[TEST_STRLEN] = { JFFS_PATH_NAME0 }; - CHAR *pathname3 = NULL; - CHAR buf1[TEST_STRLEN] = ""; - CHAR buf2[TEST_STRLEN] = ""; - CHAR *pret = NULL; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - pathname3 = pathname2; - (void)strcat_s(pathname2, TEST_STRLEN, "/test1"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - pret = getcwd(buf1, TEST_STRLEN); - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(buf1, pathname, buf1, EXIT1); - - ret = fchdir(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - pret = getcwd(buf2, TEST_STRLEN); - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(buf2, pathname3, buf2, EXIT1); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - unlink(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_IS_ERROR; -} - -VOID ItJffs028(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_029.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_029.cpp deleted file mode 100644 index 2168a0c8..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_029.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static constexpr int TEST_STRLEN = 30; -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[TEST_STRLEN] = { JFFS_PATH_NAME0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = fchmod(fd, S_IREAD); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - unlink(pathname1); -EXIT: - rmdir(pathname1); - return JFFS_IS_ERROR; -} - -VOID ItJffs029(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_030.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_030.cpp deleted file mode 100644 index 840b2d19..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_030.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufname[PATH_MAX] = ""; - CHAR *realName = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/////"); - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "test"); - - realName = realpath(pathname2, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItJffs030(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_031.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_031.cpp deleted file mode 100644 index b70ae91d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_031.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -#define TEST_STR "abcdefghijk" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_STANDARD_NAME_LENGTH] = { TEST_STR }; - CHAR str[JFFS_STANDARD_NAME_LENGTH]; - FILE *ptr = NULL; - - fd = open(pathname1, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = write(fd, buf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_NOT_EQUAL(len, -1, len, EXIT); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - ptr = freopen(pathname1, "r", stdin); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT1); - - scanf_s("%s", str, sizeof(str)); - ret = strcmp(buf, str); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fclose(ptr); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItJffs031(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_032.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_032.cpp deleted file mode 100644 index 21afb6a1..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_032.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - - ret = lstat64(pathname1, &buf1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = lstat64(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = lstat64(pathname1, &buf1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItJffs032(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_033.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_033.cpp deleted file mode 100644 index f925f62e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_033.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - - ret = lstat(pathname1, &buf1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = lstat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = lstat(pathname1, &buf1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItJffs033(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_034.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_034.cpp deleted file mode 100644 index 8a545054..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_034.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -#define TEST_STR "abcdefghijk" -#define EXPECT_TEST_STR "ghijk" -static constexpr int OFFSET_NUM = 6; - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_STANDARD_NAME_LENGTH] = { TEST_STR }; - CHAR str[JFFS_STANDARD_NAME_LENGTH]; - FILE *ptr = NULL; - off_t offset = OFFSET_NUM; - size_t fret; - - fd = open(pathname1, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = write(fd, buf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_NOT_EQUAL(len, -1, len, EXIT); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - ptr = fopen(pathname1, "r+"); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT2); - - ret = fseeko(ptr, offset, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fret = fread(str, 1, JFFS_STANDARD_NAME_LENGTH, ptr); - ICUNIT_GOTO_EQUAL(fret, (JFFS_STANDARD_NAME_LENGTH - OFFSET_NUM), fret, EXIT2); - - ret = strcmp(EXPECT_TEST_STR, str); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = fclose(ptr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - fclose(ptr); - unlink(pathname1); - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItJffs034(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_035.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_035.cpp deleted file mode 100644 index 00e7ddc6..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_035.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -#define TEST_STR "abcdefghijk" -#define EXPECT_TEST_STR "ghijk" -static constexpr int OFFSET_NUM = 6; - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_STANDARD_NAME_LENGTH] = { TEST_STR }; - CHAR str[JFFS_STANDARD_NAME_LENGTH]; - FILE *ptr = NULL; - off_t offset1 = OFFSET_NUM; - off_t offset2; - size_t fret; - - fd = open(pathname1, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = write(fd, buf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_NOT_EQUAL(len, -1, len, EXIT); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - ptr = fopen(pathname1, "r+"); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT2); - - ret = fseeko(ptr, offset1, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - offset2 = ftello(ptr); - ICUNIT_GOTO_EQUAL(offset2, offset1, offset2, EXIT2); - - ret = fclose(ptr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - fclose(ptr); - unlink(pathname1); - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItJffs035(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_036.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_036.cpp deleted file mode 100644 index c5e1a541..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_036.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - dir = opendir(pathname2); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - closedir(dir); - rmdir(pathname2); - return JFFS_IS_ERROR; -EXIT1: - closedir(dir); -EXIT: - return JFFS_IS_ERROR; -} - -VOID ItJffs036(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_037.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_037.cpp deleted file mode 100644 index 3f051912..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_037.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - dir = opendir(pathname2); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOTDIR, errno, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - return JFFS_NO_ERROR; -EXIT3: - close(fd); -EXIT2: - unlink(pathname2); - return JFFS_IS_ERROR; -EXIT1: - closedir(dir); - return JFFS_IS_ERROR; -} - -VOID ItJffs037(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_038.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_038.cpp deleted file mode 100644 index 9f231318..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_038.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - long offset; - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT2: - closedir(dir); - rmdir(pathname2); - return JFFS_IS_ERROR; -EXIT1: - closedir(dir); -EXIT: - return JFFS_IS_ERROR; -} - -VOID ItJffs038(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_039.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_039.cpp deleted file mode 100644 index 9c093f4b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_039.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT2: - closedir(dir); - rmdir(pathname2); - return JFFS_IS_ERROR; -EXIT1: - closedir(dir); -EXIT: - return JFFS_IS_ERROR; -} - -VOID ItJffs039(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_040.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_040.cpp deleted file mode 100644 index cd5d99b4..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_040.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -typedef struct __dirstream { - off_t tell; - int fd; - int bufPos; - int bufEnd; - volatile int lock[1]; - void *dirk; - void *resv; - /* Any changes to this struct must preserve the property: - * offsetof(struct __dirent, buf) % sizeof(off_t) == 0 */ - char buf[2048]; -} DIR; - -static UINT32 Testcase(VOID) -{ - INT32 ret, scandirCount; - INT32 fd = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR adir = { 0 }; - DIR *dir1 = &adir; - struct dirent *ptr = NULL; - off_t offset, offset1, offset2, offset3, offset4; - struct dirent **namelist = NULL; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT5); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - offset1 = telldir(dir1); - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT4); - - offset2 = telldir(dir1); - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT4); - - offset3 = telldir(dir1); - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT4); - - offset4 = telldir(dir1); - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT4); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT5); - - ptr = readdir(dir); - offset1 = ptr->d_off; - - ptr = readdir(dir); - offset2 = ptr->d_off; - - ptr = readdir(dir); - offset3 = ptr->d_off; - - ptr = readdir(dir); - offset4 = ptr->d_off; - - seekdir(dir, offset2); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset2, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "1test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - seekdir(dir, offset1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - seekdir(dir, offset4); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset4, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - - seekdir(dir, offset3); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset3, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT5); // 4 means total scaned file - ICUNIT_GOTO_STRING_EQUAL(namelist[0]->d_name, "0file", namelist[0]->d_name, EXIT); // 0 means first file - ICUNIT_GOTO_STRING_EQUAL(namelist[1]->d_name, "0test", namelist[1]->d_name, EXIT); // 1 means second file - ICUNIT_GOTO_STRING_EQUAL(namelist[2]->d_name, "1test", namelist[2]->d_name, EXIT); // 2 means third file - ICUNIT_GOTO_STRING_EQUAL(namelist[3]->d_name, "2test", namelist[3]->d_name, EXIT); // 3 means four file - - seekdir(dir, namelist[3]->d_off); // 3 means four file - offset = telldir(dir); - ICUNIT_GOTO_NOT_EQUAL(offset, -1, offset, EXIT5); - ICUNIT_GOTO_EQUAL(offset1, namelist[3]->d_off, offset1, EXIT5); // 3 means four file - ICUNIT_GOTO_EQUAL(offset, namelist[3]->d_off, offset, EXIT5); // 3 means four file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - - seekdir(dir, namelist[2]->d_off); // 2 means third file - offset = telldir(dir); - ICUNIT_GOTO_NOT_EQUAL(offset, -1, offset, EXIT5); - ICUNIT_GOTO_EQUAL(offset3, namelist[2]->d_off, offset3, EXIT5); // 2 means third file - ICUNIT_GOTO_EQUAL(offset, namelist[2]->d_off, offset, EXIT5); // 2 means third file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - - JffsScandirFree(namelist, scandirCount); - - scandirCount = 0; - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, NULL); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT5); // 4 means total scaned file - - seekdir(dir, namelist[3]->d_off); // 3 means four file - ICUNIT_GOTO_EQUAL(offset4, namelist[3]->d_off, offset4, EXIT5); // 3 means four file - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - - seekdir(dir, namelist[0]->d_off); // 0 means first file - ICUNIT_GOTO_EQUAL(offset1, namelist[0]->d_off, offset1, EXIT5); // 0 means first file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - -EXIT6: - JffsScandirFree(namelist, scandirCount); -EXIT5: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); -EXIT4: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT3: - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItJffs040(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_041.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_041.cpp deleted file mode 100644 index cef5fb75..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_041.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -typedef struct __dirstream { - off_t tell; - int fd; - int bufPos; - int bufEnd; - volatile int lock[1]; - void *dirk; - void *resv; - /* Any changes to this struct must preserve the property: - * offsetof(struct __dirent, buf) % sizeof(off_t) == 0 */ - char buf[2048]; -} DIR; - -static UINT32 Testcase(VOID) -{ - INT32 ret, scandirCount; - INT32 fd = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR adir = { 0 }; - DIR *dir1 = &adir; - struct dirent *ptr = NULL; - off_t offset, offset1, offset2, offset3, offset4; - struct dirent **namelist = NULL; - - errno = 0; - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, NULL); - ICUNIT_GOTO_EQUAL(scandirCount, -1, scandirCount, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT5); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - offset1 = telldir(dir1); - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT4); - - offset2 = telldir(dir1); - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT4); - - offset3 = telldir(dir1); - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT4); - - offset4 = telldir(dir1); - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT4); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT5); - - ptr = readdir(dir); - offset1 = ptr->d_off; - - ptr = readdir(dir); - offset2 = ptr->d_off; - - ptr = readdir(dir); - offset3 = ptr->d_off; - - ptr = readdir(dir); - offset4 = ptr->d_off; - - seekdir(dir, offset2); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset2, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "1test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - seekdir(dir, offset1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - seekdir(dir, offset4); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset4, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - - seekdir(dir, offset3); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset3, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT5); // 4 means total scaned file - ICUNIT_GOTO_STRING_EQUAL(namelist[0]->d_name, "0file", namelist[0]->d_name, EXIT); // 0 means first file - ICUNIT_GOTO_STRING_EQUAL(namelist[1]->d_name, "0test", namelist[1]->d_name, EXIT); // 1 means second file - ICUNIT_GOTO_STRING_EQUAL(namelist[2]->d_name, "1test", namelist[2]->d_name, EXIT); // 2 means third file - ICUNIT_GOTO_STRING_EQUAL(namelist[3]->d_name, "2test", namelist[3]->d_name, EXIT); // 3 means four file - - seekdir(dir, namelist[3]->d_off); // 3 means four file - offset = telldir(dir); - ICUNIT_GOTO_NOT_EQUAL(offset, -1, offset, EXIT5); - ICUNIT_GOTO_EQUAL(offset1, namelist[3]->d_off, offset1, EXIT5); // 3 means four file - ICUNIT_GOTO_EQUAL(offset, namelist[3]->d_off, offset, EXIT5); // 3 means four file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - - seekdir(dir, namelist[2]->d_off); // 2 means third file - offset = telldir(dir); - ICUNIT_GOTO_NOT_EQUAL(offset, -1, offset, EXIT5); - ICUNIT_GOTO_EQUAL(offset3, namelist[2]->d_off, offset3, EXIT5); // 2 means third file - ICUNIT_GOTO_EQUAL(offset, namelist[2]->d_off, offset, EXIT5); // 2 means third file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - - JffsScandirFree(namelist, scandirCount); - - scandirCount = 0; - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, NULL); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT5); // 4 means total scaned file - - seekdir(dir, namelist[3]->d_off); // 3 means four file - ICUNIT_GOTO_EQUAL(offset4, namelist[3]->d_off, offset4, EXIT5); // 3 means four file - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - - seekdir(dir, namelist[0]->d_off); // 0 means first file - ICUNIT_GOTO_EQUAL(offset1, namelist[0]->d_off, offset1, EXIT5); // 0 means first file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - -EXIT6: - JffsScandirFree(namelist, scandirCount); -EXIT5: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); -EXIT4: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT3: - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItJffs041(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_042.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_042.cpp deleted file mode 100644 index 7e8413ea..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_042.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, scandirCount; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent **namelist = NULL; - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - scandirCount = scandir(pathname2, &namelist, 0, NULL); - ICUNIT_GOTO_EQUAL(scandirCount, -1, scandirCount, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOTDIR, errno, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - return JFFS_NO_ERROR; -EXIT3: - close(fd); -EXIT2: - unlink(pathname2); - return JFFS_IS_ERROR; -EXIT1: - closedir(dir); - return JFFS_IS_ERROR; -} - -VOID ItJffs042(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_043.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_043.cpp deleted file mode 100644 index cf88d48a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_043.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -typedef struct __dirstream { - off_t tell; - int fd; - int bufPos; - int bufEnd; - volatile int lock[1]; - void *dirk; - void *resv; - /* Any changes to this struct must preserve the property: - * offsetof(struct __dirent, buf) % sizeof(off_t) == 0 */ - char buf[2048]; -} DIR; - -static UINT32 Testcase(VOID) -{ - DIR *dirp = NULL; - INT32 ret; - CHAR *pathnamedir = (CHAR *)JFFS_MAIN_DIR0; - CHAR pathname01[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct dirent *dp1 = (struct dirent *)malloc(sizeof(struct dirent)); - struct dirent *dp2 = (struct dirent *)malloc(sizeof(struct dirent)); - struct dirent *dp2Bak = dp2; - DIR adir = { 0 }; - DIR *dir1 = &adir; - - (void)strcat_s(pathname01, JFFS_STANDARD_NAME_LENGTH, "/test1"); - ret = mkdir(pathname01, HIGHEST_AUTHORITY); - if (ret != 0) { - if (errno != EEXIST) { - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - - dirp = opendir(pathnamedir); - ICUNIT_GOTO_NOT_EQUAL(dirp, NULL, dirp, EXIT2); - - while (1) { - ret = readdir_r(dir1, dp1, &dp2); - printf("ret=%d\n", ret); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT2); - break; - } - - ret = rmdir(pathname01); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - closedir(dirp); - free(dp1); - free(dp2Bak); - return JFFS_NO_ERROR; -EXIT2: - rmdir(pathname01); - if (dirp) closedir(dirp); - free(dp1); - free(dp2Bak); - return JFFS_IS_ERROR; -EXIT1: - rmdir(pathname01); - return JFFS_IS_ERROR; -} - -VOID ItJffs043(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_jffs_044.cpp b/testsuites/unittest/fs/jffs/full/It_jffs_044.cpp deleted file mode 100644 index 491b5b67..00000000 --- a/testsuites/unittest/fs/jffs/full/It_jffs_044.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -typedef struct __dirstream { - off_t tell; - int fd; - int bufPos; - int bufEnd; - volatile int lock[1]; - void *dirk; - void *resv; - /* Any changes to this struct must preserve the property: - * offsetof(struct __dirent, buf) % sizeof(off_t) == 0 */ - char buf[2048]; -} DIR; - -static UINT32 Testcase(VOID) -{ - INT32 ret, scandirCount; - INT32 fd = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR adir = { 0 }; - DIR *dir1 = &adir; - struct dirent *ptr = NULL; - off_t offset, offset1, offset2, offset3, offset4; - off_t offsetTest; - struct dirent **namelist = NULL; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT5); - - ptr = readdir(dir); - offset1 = ptr->d_off; - - ptr = readdir(dir); - offset2 = ptr->d_off; - - ptr = readdir(dir); - offset3 = ptr->d_off; - - ptr = readdir(dir); - offset4 = ptr->d_off; - - errno = 0; - seekdir(dir, offset2); - ICUNIT_GOTO_EQUAL(errno, 0, errno, EXIT5); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset2, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "1test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - seekdir(dir, offset1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - seekdir(dir, offset4); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset4, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - - seekdir(dir, offset3); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset3, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT5); // 4 means total scaned file - ICUNIT_GOTO_STRING_EQUAL(namelist[0]->d_name, "0file", namelist[0]->d_name, EXIT); // 0 means first file - ICUNIT_GOTO_STRING_EQUAL(namelist[1]->d_name, "0test", namelist[1]->d_name, EXIT); // 1 means second file - ICUNIT_GOTO_STRING_EQUAL(namelist[2]->d_name, "1test", namelist[2]->d_name, EXIT); // 2 means third file - ICUNIT_GOTO_STRING_EQUAL(namelist[3]->d_name, "2test", namelist[3]->d_name, EXIT); // 3 means four file - - seekdir(dir, namelist[3]->d_off); // 3 means four file - offset = telldir(dir); - ICUNIT_GOTO_NOT_EQUAL(offset, -1, offset, EXIT5); - ICUNIT_GOTO_EQUAL(offset1, namelist[3]->d_off, offset1, EXIT5); // 3 means four file - ICUNIT_GOTO_EQUAL(offset, namelist[3]->d_off, offset, EXIT5); // 3 means four file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - - seekdir(dir, namelist[2]->d_off); // 2 means third file - offset = telldir(dir); - ICUNIT_GOTO_NOT_EQUAL(offset, -1, offset, EXIT5); - ICUNIT_GOTO_EQUAL(offset3, namelist[2]->d_off, offset3, EXIT5); // 2 means third file - ICUNIT_GOTO_EQUAL(offset, namelist[2]->d_off, offset, EXIT5); // 2 means third file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - - JffsScandirFree(namelist, scandirCount); - - scandirCount = 0; - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, NULL); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT5); // 4 means total scaned file - - seekdir(dir, namelist[3]->d_off); // 3 means four file - ICUNIT_GOTO_EQUAL(offset4, namelist[3]->d_off, offset4, EXIT5); // 3 means four file - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - - seekdir(dir, namelist[0]->d_off); // 0 means first file - ICUNIT_GOTO_EQUAL(offset1, namelist[0]->d_off, offset1, EXIT5); // 0 means first file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - -EXIT6: - JffsScandirFree(namelist, scandirCount); -EXIT5: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); -EXIT4: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT3: - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItJffs044(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_test_faccessat_001.cpp b/testsuites/unittest/fs/jffs/full/It_test_faccessat_001.cpp deleted file mode 100644 index bb2d2469..00000000 --- a/testsuites/unittest/fs/jffs/full/It_test_faccessat_001.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -#include -#include -#include - -static UINT32 Testcase(VOID) -{ - int ret = 0; - int argc = 2; - char *argv[2]; - - argv[1] = (char *)"/lib/libc.so"; - - if (argc != 2) { - printf("Usage: %s \n", argv[0]); - exit(1); - } - - ret = faccessat(AT_FDCWD, argv[1], R_OK, AT_EACCESS); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - if (ret < 0) { - printf("faccessat error for %s\n", argv[1]); - } else { - printf("read access OK\n"); - } - - if (open(argv[1], O_RDONLY) < 0) { - printf("open error for %s\n", argv[1]); - } else { - printf("open for reading OK\n"); - } - - return LOS_OK; -} - -VOID IO_TEST_FACCESSAT_001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_test_faccessat_002.cpp b/testsuites/unittest/fs/jffs/full/It_test_faccessat_002.cpp deleted file mode 100644 index b7dd3021..00000000 --- a/testsuites/unittest/fs/jffs/full/It_test_faccessat_002.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -#include -#include -#include - -static UINT32 testcase(VOID) -{ - int ret = 0; - - open(FILEPATH_000, O_RDWR | O_EXCL | O_CREAT, 0); - - errno = 0; - ret = faccessat(AT_FDCWD, FILEPATH_000, R_OK, AT_EACCESS); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - -#if 0 - errno = 0; - ret = open(FILEPATH_000, O_RDONLY); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); -#endif - - return LOS_OK; -OUT: - return LOS_NOK; -} - -VOID IO_TEST_FACCESSAT_002(void) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_test_fstatat_001.cpp b/testsuites/unittest/fs/jffs/full/It_test_fstatat_001.cpp deleted file mode 100644 index 1aaf5128..00000000 --- a/testsuites/unittest/fs/jffs/full/It_test_fstatat_001.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -#include "sys/stat.h" - -static UINT32 testcase1(VOID) -{ - struct stat buf; - char *pathname = (char *)FILEPATH_775; - int ret = 0; - int fd = 0; - - errno = 0; - fd = open(pathname, O_RDWR | O_CREAT); - TEST_PRINT("[INFO]%s:%d,%s,fd=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fd, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, OUT); - - errno = 0; - ret = fstatat(fd, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - ICUNIT_GOTO_EQUAL(buf.st_ino, 0, -1, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase2(VOID) -{ - struct stat buf; - char *pathname = (char *)"./fstatat.tmp"; - int ret = 0; - int fd = 0; - - errno = 0; - fd = open(pathname, O_RDWR | O_CREAT); - TEST_PRINT("[INFO]%s:%d,%s,fd=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fd, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, OUT); - - errno = 0; - ret = fstatat(AT_FDCWD, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - ICUNIT_GOTO_EQUAL(buf.st_ino, 0, -1, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase3(VOID) -{ - struct stat buf; - char *pathname = (char *)FILEPATH_775; - int ret = 0; - int fd = 0; - - errno = 0; - fd = open(pathname, O_RDWR | O_CREAT); - TEST_PRINT("[INFO]%s:%d,%s,fd=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fd, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, OUT); - - errno = 0; - ret = fstatat(fd, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - ICUNIT_GOTO_EQUAL(buf.st_ino, 0, -1, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase4(VOID) -{ - struct stat buf; - char *pathname = (char *)FILEPATH_775; - int ret = 0; - int fd = 0; - - errno = 0; - fd = open(pathname, O_RDWR | O_CREAT); - TEST_PRINT("[INFO]%s:%d,%s,fd=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fd, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, OUT); - - errno = 0; - ret = fstatat(fd, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - ICUNIT_GOTO_EQUAL(buf.st_ino, 0, -1, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase(VOID) -{ - testcase1(); - testcase2(); - testcase3(); - testcase4(); - - return LOS_OK; -} - -VOID IO_TEST_FSTATAT_001(void) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_test_fstatat_002.cpp b/testsuites/unittest/fs/jffs/full/It_test_fstatat_002.cpp deleted file mode 100644 index 33388e26..00000000 --- a/testsuites/unittest/fs/jffs/full/It_test_fstatat_002.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -#include -#include "sys/stat.h" -#include "string.h" - -static UINT32 testcase8(VOID) -{ - struct stat buf; - char pathname[200] = FILEPATH_775; - int ret = 0; - int fd = 0; - - /* omit to create test file dynamicly,use prepared test files in /storage instand. */ - errno = 0; - fd = open(pathname, O_CREAT, 0777); - TEST_PRINT("[INFO]%s:%d,%s,fd=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fd, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, OUT); - - errno = 0; - ret = fstatat(fd, FILEPATH_RELATIVE, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, ENOTDIR, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase7(VOID) -{ - struct stat buf; - char pathname[] = FILEPATH_NOACCESS; - char dirname[] = DIRPATH_775; - DIR *dir = NULL; - int ret = 0; - int fd = 0; - - errno = 0; - dir = opendir(dirname); - fd = dirfd(dir); - TEST_PRINT("[INFO]%s:%d,%s,fd=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fd, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, OUT); - - errno = 0; - ret = fstatat(fd, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase6(VOID) -{ - struct stat buf; - /* let the pathname more than 4096 characters,to generate the ENAMETOOLONG errno. */ - char pathname[] = PATHNAME_ENAMETOOLONG; - int ret = 0; - char dirname[] = DIRPATH_775; - DIR *dir = NULL; - int fd = 0; - - errno = 0; - dir = opendir(dirname); - fd = dirfd(dir); - TEST_PRINT("[INFO]%s:%d,%s,fd=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fd, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, OUT); - - errno = 0; - ret = fstatat(fd, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase5(VOID) -{ - struct stat buf; - char pathname[] = FILEPATH_ENOENT; - int ret = 0; - - errno = 0; - ret = fstatat(FD_EBADF, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase3(VOID) -{ - struct stat buf; - char pathname[] = ""; - int ret = 0; - - errno = 0; - ret = fstatat(AT_FDCWD, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase2(VOID) -{ - struct stat buf; - char pathname[] = FILEPATH_ENOENT; - int ret = 0; - - errno = 0; - ret = fstatat(AT_FDCWD, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase1(VOID) -{ - struct stat buf; - char pathname[] = FILEPATH_000; - int ret = 0; - - errno = 0; - ret = fstatat(1, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase(VOID) -{ - testcase8(); /* CASE:fd is no a dirfd */ - /* testcase7(); omitted as program can not create file with no access privilege. */ - testcase6(); - testcase5(); - testcase3(); - testcase2(); - /* testcase1(); CASE:no access */ - - return LOS_OK; -} - -VOID IO_TEST_FSTATAT_002(void) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_test_fstatfs_001.cpp b/testsuites/unittest/fs/jffs/full/It_test_fstatfs_001.cpp deleted file mode 100644 index 678716fa..00000000 --- a/testsuites/unittest/fs/jffs/full/It_test_fstatfs_001.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -#include -#include "fcntl.h" -#include "sys/vfs.h" - -static UINT32 testcase1(VOID) -{ - int fd; - struct statfs buf; - int ret; - errno = 0; - - fd = open("/lib/libc.so", O_RDONLY); - ret = fstatfs(fd, &buf); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - TEST_PRINT("[INFO]The \"/lib/libc.so\" 's,buf->f_type=0x%x\n", buf.f_type); - TEST_PRINT("[INFO]Check the file's filesystem type:./musl/kernel/include/sys/statfs.h:#define JFFS2_SUPER_MAGIC 0x72b6,#define MSDOS_SUPER_MAGIC 0x4d44\n"); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_ASSERT_EQUAL(buf.f_type, 0x4d44, -1); - ICUNIT_GOTO_EQUAL(buf.f_type, 0x4d44, -1, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase(VOID) -{ - testcase1(); - - return LOS_OK; -} - -VOID IO_TEST_FSTATFS_001(void) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_test_fstatfs_002.cpp b/testsuites/unittest/fs/jffs/full/It_test_fstatfs_002.cpp deleted file mode 100644 index 4d802762..00000000 --- a/testsuites/unittest/fs/jffs/full/It_test_fstatfs_002.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -#include -#include "fcntl.h" -#include "sys/vfs.h" - -static UINT32 testcase1(VOID) -{ - struct statfs buf; - char pathname[] = "./fstatfs.tmp"; - int ret = 0; - int fd = 0; - errno = 0; - - fd = open(pathname, O_RDWR | O_CREAT); - TEST_PRINT("[INFO]%s:%d,%s,fd=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fd, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, OUT); - - errno = 0; - ret = chmod(pathname, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - - errno = 0; - ret = fstatfs(fd, &buf); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - /* ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); omitted temprorily,as chmod does no works. */ - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase2(VOID) -{ - struct statfs buf; - int ret; - - errno = 0; - ret = fstatfs(0xffffffff, &buf); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase3(VOID) -{ - struct statfs buf; - int ret; - int fd; - char *pathname = (char *)"./fstatfs2.tmp"; - - errno = 0; - fd = open(pathname, O_RDONLY | O_CREAT); - - errno = 0; - ret = fstatfs(fd, &buf); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 test() -{ - return 0; -} - -static UINT32 testcase4(VOID) -{ - struct statfs *buf = nullptr; - int ret; - int fd; - - errno = 0; - fd = open("/lib/libc.so", O_RDONLY); - - errno = 0; - ret = fstatfs(fd, (struct statfs *)nullptr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase(VOID) -{ - /* testcase1(); 鏈敤渚嬪洜chmod鍑芥暟鏃犳硶鏀规枃浠舵潈闄愯屾棤娉曟祴锛屾晠娉ㄩ噴*/ - testcase2(); - /* testcase3(); 鏈敤渚嬩紶闈炴硶鍙傛暟鐢卞唴鏍告娴嬭繑鍥濫INVAL,浣唌usl閮ㄥ垎浠g爜浼氬绌哄湴鍧璧嬪艰繘鑰岃窇椋烇紝鏁呮敞閲*/ - /* testcase4(); 鏈敤渚嬩紶闈炴硶鍙傛暟鐢卞唴鏍告娴嬭繑鍥濫INVAL,浣唌usl閮ㄥ垎浠g爜浼氬绌哄湴鍧璧嬪艰繘鑰岃窇椋烇紝鏁呮敞閲*/ - - return LOS_OK; -} - -VOID IO_TEST_FSTATFS_002(void) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_004.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_004.cpp deleted file mode 100644 index e3ebd478..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_004.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, scandirCount; - INT32 fd = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset, offset1, offset2, offset3, offset4; - struct dirent **namelist = NULL; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT5); - - ptr = readdir(dir); - offset1 = ptr->d_off; - - ptr = readdir(dir); - offset2 = ptr->d_off; - - ptr = readdir(dir); - offset3 = ptr->d_off; - - ptr = readdir(dir); - offset4 = ptr->d_off; - - seekdir(dir, offset2); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset2, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "1test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - seekdir(dir, offset1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - seekdir(dir, offset4); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset4, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - - seekdir(dir, offset3); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset3, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT5); // 4 means total scaned file - ICUNIT_GOTO_STRING_EQUAL(namelist[0]->d_name, "0file", namelist[0]->d_name, EXIT); // 0 means first file - ICUNIT_GOTO_STRING_EQUAL(namelist[1]->d_name, "0test", namelist[1]->d_name, EXIT); // 1 means second file - ICUNIT_GOTO_STRING_EQUAL(namelist[2]->d_name, "1test", namelist[2]->d_name, EXIT); // 2 means third file - ICUNIT_GOTO_STRING_EQUAL(namelist[3]->d_name, "2test", namelist[3]->d_name, EXIT); // 3 means four file - - seekdir(dir, namelist[3]->d_off); // 3 means four file - offset = telldir(dir); - ICUNIT_GOTO_NOT_EQUAL(offset, -1, offset, EXIT5); - ICUNIT_GOTO_EQUAL(offset1, namelist[3]->d_off, offset1, EXIT5); // 3 means four file - ICUNIT_GOTO_EQUAL(offset, namelist[3]->d_off, offset, EXIT5); // 3 means four file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - - seekdir(dir, namelist[2]->d_off); // 2 means third file - offset = telldir(dir); - ICUNIT_GOTO_NOT_EQUAL(offset, -1, offset, EXIT5); - ICUNIT_GOTO_EQUAL(offset3, namelist[2]->d_off, offset3, EXIT5); // 2 means third file - ICUNIT_GOTO_EQUAL(offset, namelist[2]->d_off, offset, EXIT5); // 2 means third file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - - JffsScandirFree(namelist, scandirCount); - - scandirCount = 0; - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, NULL); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT5); // 4 means total scaned file - - seekdir(dir, namelist[3]->d_off); // 3 means four file - ICUNIT_GOTO_EQUAL(offset4, namelist[3]->d_off, offset4, EXIT5); // 3 means four file - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - - seekdir(dir, namelist[0]->d_off); // 0 means first file - ICUNIT_GOTO_EQUAL(offset1, namelist[0]->d_off, offset1, EXIT5); // 0 means first file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - -EXIT6: - JffsScandirFree(namelist, scandirCount); -EXIT5: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); -EXIT4: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT3: - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs004(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_004", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_006.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_006.cpp deleted file mode 100644 index d30da2da..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_006.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret; - CHAR *pret = NULL; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - CHAR buf[30] = ""; - struct dirent *ptr = NULL; - INT32 offset, offset1, offset2, offset3, offset4; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - pret = getcwd(buf, 30); // 30 means name length - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname, buf, EXIT); - - (void)strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - pret = getcwd(buf, 30); // 30 means name length - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname, buf, EXIT1); - - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - pret = getcwd(buf, 30); // 30 means name length - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname, buf, EXIT3); - - (void)strcat_s(pathname, sizeof(pathname), "/1file"); - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT4); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - pret = getcwd(buf, 30); // 30 means name length - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname, buf, EXIT5); - - ret = chdir("/storage"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - pret = getcwd(buf, 30); // 30 means name length - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(buf, "/storage", buf, EXIT5); - -EXIT5: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT4: - JffsStrcat2(pathname, "/2test/1file", sizeof(pathname)); - close(fd1); - remove(pathname); -EXIT3: - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs006(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_006", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_007.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_007.cpp deleted file mode 100644 index 1dcbce7e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_007.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 fd3 = -1; - INT32 ret, scandirCount; - CHAR *pret = NULL; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - CHAR buf[50] = ""; - DIR *dir = NULL; - struct dirent *ptr = NULL; - struct stat statfile; - struct statfs statfsfile; - struct dirent **namelist = NULL; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pret = getcwd(buf, 20); // 20 means path name len - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname, buf, EXIT); - - (void)strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - (void)strcat_s(pathname, sizeof(pathname), "/1file"); - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT4); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - pret = getcwd(buf, 20); // 20 means path name len - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname, buf, EXIT5); - - fd2 = open("2file", O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - fd3 = open("2file", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd3, -1, fd3, EXIT6); - - ret = mkdir("3dir", HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT7); - - ret = mkdir("3dir", HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT7); - - dir = opendir("3dir"); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT8); - - scandirCount = scandir(".", &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 3, scandirCount, EXIT8); // 3 means scan file num - ICUNIT_GOTO_STRING_EQUAL(namelist[0]->d_name, "1file", namelist[0]->d_name, EXIT9); // 0 means first file - - ret = rename("2file", "file2"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT10); - - ret = stat("file2", &statfile); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT10); - ICUNIT_GOTO_EQUAL(statfile.st_size, 0, statfile.st_size, EXIT10); - - ret = statfs("file2", &statfsfile); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT10); - - ret = access("file2", R_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT10); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT10); - - ret = unlink("file2"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT10); - - ret = chdir("3dir"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT9); - (void)strcat_s(pathname, sizeof(pathname), "/3dir"); - pret = getcwd(buf, 30); // 30 means path name len - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT9); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname, buf, EXIT9); - - ret = chdir("../"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT9); - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - pret = getcwd(buf, 20); // 20 means path name len - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT9); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname, buf, EXIT9); - -EXIT10: - JffsStrcat2(pathname, "/2test/file2", sizeof(pathname)); - close(fd2); - remove(pathname); -EXIT9: - JffsScandirFree(namelist, scandirCount); -EXIT8: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); -EXIT7: - JffsStrcat2(pathname, "/2test/3dir", sizeof(pathname)); - rmdir(pathname); -EXIT6: - JffsStrcat2(pathname, "/2test/2file", sizeof(pathname)); - close(fd2); - close(fd3); - remove(pathname); -EXIT5: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT4: - JffsStrcat2(pathname, "/2test/1file", sizeof(pathname)); - close(fd1); - remove(pathname); -EXIT3: - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs007(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_007", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_008.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_008.cpp deleted file mode 100644 index 2ef4cb3a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_008.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, scandirCount; - CHAR *pret = NULL; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - struct dirent **namelist = NULL; - INT32 offset, offset1, offset2, offset3, offset4; - CHAR buf[20]; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - (void)strcat_s(pathname, sizeof(pathname), "/1file"); - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT4); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset1 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset1 - 1, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset2 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset2 - 1, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset3 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset3 - 1, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset4 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset4 - 1, offset, EXIT6); - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, NULL, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT6); // 4 means total scaned file - - ICUNIT_GOTO_STRING_EQUAL(namelist[0]->d_name, "0file", namelist[0]->d_name, EXIT7); // 0 means first file - ICUNIT_GOTO_STRING_EQUAL(namelist[1]->d_name, "0test", namelist[1]->d_name, EXIT7); // 1 means second file - ICUNIT_GOTO_STRING_EQUAL(namelist[2]->d_name, "1test", namelist[2]->d_name, EXIT7); // 2 means third file - ICUNIT_GOTO_STRING_EQUAL(namelist[3]->d_name, "2test", namelist[3]->d_name, EXIT7); // 3 means four file - ICUNIT_GOTO_EQUAL(namelist[0]->d_off, offset2, namelist[0]->d_off, EXIT7); // 0 means first file - ICUNIT_GOTO_EQUAL(namelist[2]->d_off, offset3, namelist[2]->d_off, EXIT7); // 2 means third file - -EXIT7: - JffsScandirFree(namelist, scandirCount); -EXIT6: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); -EXIT5: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT4: - JffsStrcat2(pathname, "/2test/1file", sizeof(pathname)); - close(fd1); - remove(pathname); -EXIT3: - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs008(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_008", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_009.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_009.cpp deleted file mode 100644 index 0dfa0444..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_009.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static INT32 ScandirF01(const struct dirent *ent) -{ - // read out a file while the name begined with "test" - return (strncmp(ent->d_name, "test", 4) == 0); -} -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, scandirCount; - CHAR *pret = NULL; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - struct dirent **namelist = NULL; - INT32 offset, offset1, offset2, offset3, offset4; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname, sizeof(pathname), "/test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/testfile", 50); // 50 means name length - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/0test1", 50); // 50 means name length - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - (void)strcat_s(pathname, sizeof(pathname), "/test1file"); - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT4); - - JffsStrcat2(pathname, "/test2", 50); // 50 means name length - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset1 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset1 - 1, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset2 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset2 - 1, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset3 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset3 - 1, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset4 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset4 - 1, offset, EXIT6); - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, ScandirF01, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 3, scandirCount, EXIT6); // 3 means total scaned file - ICUNIT_GOTO_STRING_EQUAL(namelist[0]->d_name, "test", namelist[0]->d_name, EXIT7); // 0 means first file - ICUNIT_GOTO_STRING_EQUAL(namelist[1]->d_name, "test2", namelist[1]->d_name, EXIT7); // 1 means second file - ICUNIT_GOTO_STRING_EQUAL(namelist[2]->d_name, "testfile", namelist[2]->d_name, EXIT7); // 2 means third file - ICUNIT_GOTO_EQUAL(namelist[0]->d_type, DT_DIR, namelist[0]->d_name, EXIT7); // 0 means first file - -EXIT7: - JffsScandirFree(namelist, scandirCount); -EXIT6: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); -EXIT5: - JffsStrcat2(pathname, "/test2", sizeof(pathname)); - rmdir(pathname); -EXIT4: - JffsStrcat2(pathname, "/0test1/test1file", sizeof(pathname)); - close(fd1); - remove(pathname); -EXIT3: - JffsStrcat2(pathname, "/0test1", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/testfile", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs009(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_009", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_010.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_010.cpp deleted file mode 100644 index 881f7a73..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_010.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static INT32 ScandirF01(const struct dirent *ent) -{ - return (strncmp(ent->d_name, "test", 4) == 0); -} - -static INT32 ScandirF02(const struct dirent **a, const struct dirent **b) -{ - return -1; -} - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, scandirCount; - CHAR *pret = NULL; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - struct dirent **namelist = NULL; - INT32 offset, offset1, offset2, offset3, offset4; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname, sizeof(pathname), "/test0"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/testfile", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/0test1", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - (void)strcat_s(pathname, sizeof(pathname), "/test1file"); - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT4); - - JffsStrcat2(pathname, "/test1", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset1 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset2 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset2, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset3 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset3, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset4 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset4, offset, EXIT6); - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, ScandirF01, ScandirF02); - ICUNIT_GOTO_EQUAL(scandirCount, 3, scandirCount, EXIT7); // 3 means total scaned file - ICUNIT_GOTO_STRING_EQUAL(namelist[0]->d_name, "test0", namelist[0]->d_name, EXIT7); // 0 means first file - ICUNIT_GOTO_STRING_EQUAL(namelist[1]->d_name, "test1", namelist[1]->d_name, EXIT7); // 1 means second file - ICUNIT_GOTO_EQUAL(namelist[0]->d_type, DT_DIR, namelist[0]->d_name, EXIT7); // 0 means first file - -EXIT7: - JffsScandirFree(namelist, scandirCount); -EXIT6: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); -EXIT5: - JffsStrcat2(pathname, "/test1", sizeof(pathname)); - rmdir(pathname); -EXIT4: - JffsStrcat2(pathname, "/0test1/test1file", sizeof(pathname)); - close(fd1); - remove(pathname); -EXIT3: - JffsStrcat2(pathname, "/0test1", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/testfile", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/test0", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs010(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_010", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_011.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_011.cpp deleted file mode 100644 index b1175c49..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_011.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - INT32 offset; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - (void)strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - (void)strcat_s(pathname, sizeof(pathname), "/1test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - (void)strcat_s(pathname, sizeof(pathname), "/2test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - (void)strcat_s(pathname, sizeof(pathname), "/0file"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT5); - - JffsStrcat2(pathname, "/0test/1test/2test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT5); - - JffsStrcat2(pathname, "/0test/1test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT5); - - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT5); - - JffsStrcat2(pathname, "/0test/1test/2test/0file", sizeof(pathname)); - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - ret = remove(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - JffsStrcat2(pathname, "/0test/1test/2test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname, "/0test/1test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT5: - JffsStrcat2(pathname, "/0test/1test/2test/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT4: - JffsStrcat2(pathname, "/0test/1test/2test", sizeof(pathname)); - rmdir(pathname); -EXIT3: - JffsStrcat2(pathname, "/0test/1test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT1: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs011(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_011", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_012.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_012.cpp deleted file mode 100644 index 03467f67..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_012.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir1 = NULL; - DIR *dir2 = NULL; - DIR *dir3 = NULL; - DIR *dir4 = NULL; - struct dirent *ptr = NULL; - INT32 offset; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir1 = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir1, NULL, dir1, EXIT1); - - (void)strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - dir2 = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir2, NULL, dir2, EXIT3); - - (void)strcat_s(pathname, sizeof(pathname), "/1test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - dir3 = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir3, NULL, dir3, EXIT5); - - (void)strcat_s(pathname, sizeof(pathname), "/2test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - dir4 = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir4, NULL, dir4, EXIT7); - - (void)strcat_s(pathname, sizeof(pathname), "/0file"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT8); - - ret = closedir(dir1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); - - ret = closedir(dir2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); - - ret = closedir(dir3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); - - ret = closedir(dir4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); - - JffsStrcat2(pathname, "/0test/1test/2test/0file", sizeof(pathname)); - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); - ret = remove(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); - - JffsStrcat2(pathname, "/0test/1test/2test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname, "/0test/1test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT8: - JffsStrcat2(pathname, "/0test/1test/2test/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT7: - closedir(dir4); -EXIT6: - JffsStrcat2(pathname, "/0test/1test/2test", sizeof(pathname)); - rmdir(pathname); -EXIT5: - closedir(dir3); -EXIT4: - JffsStrcat2(pathname, "/0test/1test", sizeof(pathname)); - rmdir(pathname); -EXIT3: - closedir(dir2); -EXIT2: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT1: - closedir(dir1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs012(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_012", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_013.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_013.cpp deleted file mode 100644 index 3535514e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_013.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd[5] = { -1 }; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[100] = { 0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd[0] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_NOT_EQUAL(fd[0], -1, fd[0], EXIT); // 0 means first fd - - (void)strcat_s(pathname, sizeof(pathname), "0"); - fd[1] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); // 1 means second fd - ICUNIT_GOTO_NOT_EQUAL(fd[1], -1, fd[1], EXIT1); // 1 means second fd - - (void)strcat_s(pathname, sizeof(pathname), "1"); - fd[2] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); // 2 means third fd - ICUNIT_GOTO_NOT_EQUAL(fd[2], -1, fd[2], EXIT2); // 2 means third fd - - (void)strcat_s(pathname, sizeof(pathname), "2"); - fd[3] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); // 3 means four fd - ICUNIT_GOTO_NOT_EQUAL(fd[3], -1, fd[3], EXIT3); // 3 means four fd - - (void)strcat_s(pathname, sizeof(pathname), "3"); - fd[4] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); // 4 means fifth fd - ICUNIT_GOTO_NOT_EQUAL(fd[4], -1, fd[4], EXIT4); // 4 means fifth fd - - len = write(fd[0], filebuf, strlen(filebuf)); // 0 means first fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - - off = lseek(fd[0], 0, SEEK_SET); // 0 means first fd - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT4); - - len = read(fd[0], readbuf, JFFS_STANDARD_NAME_LENGTH); // 0 means first fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT4); - - len = write(fd[1], filebuf, strlen(filebuf)); // 1 means second fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - - off = lseek(fd[1], 0, SEEK_SET); // 1 means second fd - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT4); - - len = read(fd[1], readbuf, JFFS_STANDARD_NAME_LENGTH); // 1 means second fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT4); - - len = write(fd[2], filebuf, strlen(filebuf)); // 2 means third fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - - off = lseek(fd[2], 0, SEEK_SET); // 2 means third fd - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT4); - - len = read(fd[2], readbuf, JFFS_STANDARD_NAME_LENGTH); // 2 means third fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT4); - - len = write(fd[3], filebuf, strlen(filebuf)); // 3 means four fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - - off = lseek(fd[3], 0, SEEK_SET); // 3 means four fd - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT4); - - len = read(fd[3], readbuf, JFFS_STANDARD_NAME_LENGTH); // 3 means four fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT4); - - len = write(fd[4], filebuf, strlen(filebuf)); // 4 means fifth fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - - off = lseek(fd[4], 0, SEEK_SET); // 4 means fifth fd - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT4); - - len = read(fd[4], readbuf, JFFS_STANDARD_NAME_LENGTH); // 4 means fifth fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT4); - -EXIT4: - JffsStrcat2(pathname, "0123", sizeof(pathname)); - close(fd[4]); // 4 means fifth fd - remove(pathname); -EXIT3: - JffsStrcat2(pathname, "012", sizeof(pathname)); - close(fd[3]); // 3 means four fd - remove(pathname); -EXIT2: - JffsStrcat2(pathname, "01", sizeof(pathname)); - close(fd[2]); // 2 means third fd - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "0", sizeof(pathname)); - close(fd[1]); // 1 means second fd - remove(pathname); -EXIT: - close(fd[0]); // 0 means first fd - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs013(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_013", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_014.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_014.cpp deleted file mode 100644 index cbf5adb2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_014.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd[3] = { -1 }; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[100] = { 0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd[0] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_NOT_EQUAL(fd[0], -1, fd[0], EXIT1); // 0 means first fd - - fd[1] = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); // 1 means second fd - ICUNIT_GOTO_NOT_EQUAL(fd[1], -1, fd[1], EXIT2); // 1 means second fd - - fd[2] = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); // 2 means third fd - ICUNIT_GOTO_NOT_EQUAL(fd[2], -1, fd[2], EXIT3); // 2 means third fd - - len = write(fd[0], filebuf, strlen(filebuf)); // 0 means first fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - - len = read(fd[1], readbuf, JFFS_STANDARD_NAME_LENGTH); // 1 means second fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - len = read(fd[2], readbuf, JFFS_STANDARD_NAME_LENGTH); // 2 means third fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - len = write(fd[2], filebuf, strlen(filebuf)); // 2 means third fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - - len = read(fd[1], readbuf, JFFS_STANDARD_NAME_LENGTH); // 1 means second fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - len = read(fd[0], readbuf, JFFS_STANDARD_NAME_LENGTH); // 0 means first fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - (void)strcpy_s(filebuf, sizeof(filebuf), "abcdeabcde1"); - len = write(fd[1], filebuf, strlen(filebuf)); // 1 means second fd - ICUNIT_GOTO_EQUAL(len, 11, len, EXIT3); // 11 means write len - - len = read(fd[2], readbuf, JFFS_STANDARD_NAME_LENGTH); // 2 means third fd - ICUNIT_GOTO_EQUAL(len, 11, len, EXIT3); // 11 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - len = read(fd[0], readbuf, JFFS_STANDARD_NAME_LENGTH); // 0 means first fd - ICUNIT_GOTO_EQUAL(len, 11, len, EXIT3); // 11 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - (void)strcpy_s(filebuf, sizeof(filebuf), "fghjkfghjk12"); - len = write(fd[0], filebuf, strlen(filebuf)); // 0 means first fd - ICUNIT_GOTO_EQUAL(len, 12, len, EXIT3); // 12 means write len - - (void)strcpy_s(filebuf, sizeof(filebuf), "qqqqqppppp12"); - len = write(fd[2], filebuf, strlen(filebuf)); // 2 means third fd - ICUNIT_GOTO_EQUAL(len, 12, len, EXIT3); // 12 means write len - - len = read(fd[1], readbuf, JFFS_STANDARD_NAME_LENGTH); // 1 means second fd - ICUNIT_GOTO_EQUAL(len, 12, len, EXIT3); // 12 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "qqqqqppppp12", readbuf, EXIT3); - - ret = close(fd[2]); // 2 means third fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd[1]); // 1 means second fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd[0]); // 0 means first fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = unlink(pathname); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(fd[2]); // 2 means third fd -EXIT2: - close(fd[1]); // 1 means second fd -EXIT1: - close(fd[0]); // 0 means first fd -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs014(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_014", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_015.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_015.cpp deleted file mode 100644 index f39a15fd..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_015.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[20] = { 0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - DIR *dir = NULL; - struct dirent *ptr = NULL; - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, sizeof(pathname2), "/jffs_1015.txt"); - fd = creat(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname3, sizeof(pathname3), "/1015_123.txt"); - ret = rename(pathname2, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd = open(pathname2, O_NONBLOCK | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT); - - fd = open(pathname3, O_NONBLOCK | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - - fd1 = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd1, -1, fd1, EXIT4); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT5); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "1015_123.txt", ptr->d_name, EXIT5); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT3); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - return JFFS_NO_ERROR; -EXIT5: - if (dir) ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); -EXIT4: - close(fd1); -EXIT3: - (void)strcat_s(pathname3, sizeof(pathname3), "/1015_123.txt"); - close(fd); - remove(pathname3); -EXIT2: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -EXIT1: - (void)strcat_s(pathname2, sizeof(pathname2), "/jffs_1015.txt"); - close(fd); - remove(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs015(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_015", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_016.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_016.cpp deleted file mode 100644 index b893d57e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_016.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[20] = { 0 }; - off_t off; - - fd = open(JFFS_PATH_NAME0, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - (void)strcat_s(pathname, sizeof(pathname), "123"); - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT3); - len = read(fd1, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = rename(JFFS_PATH_NAME0, pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - fd1 = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - len = read(fd1, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - return JFFS_NO_ERROR; - -EXIT5: - close(fd1); -EXIT4: - JffsStrcat2(pathname, "123", strlen(pathname)); - remove(pathname); - return JFFS_NO_ERROR; - -EXIT3: - close(fd1); -EXIT2: - JffsStrcat2(pathname, "123", strlen(pathname)); - remove(pathname); -EXIT1: - close(fd); -EXIT: - JffsStrcat2(pathname, JFFS_PATH_NAME0, strlen(pathname)); - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs016(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_016", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_017.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_017.cpp deleted file mode 100644 index 8932ed1f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_017.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/0test"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname, sizeof(pathname), "/dirfiles"); - - ret = rename(pathname1, pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - ret = rmdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT2); // 虏禄麓忙脭脷 - - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT2: - JffsStrcat2(pathname, "/dirfiles", strlen(pathname)); - remove(pathname); -EXIT1: - JffsStrcat2(pathname1, "/0test", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs017(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_017", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_018.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_018.cpp deleted file mode 100644 index 518056da..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_018.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/0test"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - (void)strcat_s(pathname, sizeof(pathname), "/dirfiles"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rename(pathname1, pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - ret = rmdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT2); // 虏禄麓忙脭脷 - - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - JffsStrcat2(pathname, "/dirfiles", strlen(pathname)); - remove(pathname); -EXIT1: - JffsStrcat2(pathname1, "/0test", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs018(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_018", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_019.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_019.cpp deleted file mode 100644 index d8562832..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_019.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR pathname3[50] = { JFFS_PATH_NAME0 }; - CHAR filebuf[20] = "1234567890"; - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, sizeof(pathname2), "/0test"); - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - (void)strcat_s(pathname1, sizeof(pathname1), "/dirfiles"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - (void)strcat_s(pathname3, sizeof(pathname3), "/dirfiles/files"); - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT4); - - printf("pathname1: %s pathname2: %s pathname3: %s\n", pathname1, pathname2, pathname3); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT4); // 10 means file name length - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = rename(pathname2, pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT5); - - ret = rename(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - JffsStrcat2(pathname3, "/0test/files", sizeof(pathname3)); - ret = unlink(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT5: - JffsStrcat2(pathname3, "/0test/files", strlen(pathname3)); - remove(pathname3); -EXIT4: - close(fd); -EXIT3: - JffsStrcat2(pathname3, "/dirfiles/files", strlen(pathname3)); - remove(pathname3); -EXIT2: - JffsStrcat2(pathname2, "/dirfiles", strlen(pathname2)); - remove(pathname2); -EXIT1: - JffsStrcat2(pathname1, "/0test", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs019(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_019", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_020.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_020.cpp deleted file mode 100644 index b7eaed8e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_020.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - CHAR pathname1[20] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - (void)strcat_s(pathname, sizeof(pathname), "/files"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - ret = rename(pathname1, pathname); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - - ret = rename(pathname, pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir1", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs020(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_020", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_023.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_023.cpp deleted file mode 100644 index 76c94bc6..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_023.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR bufdir1[50] = { JFFS_PATH_NAME0 }; - CHAR bufdir2[50] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - (void)strcat_s(bufdir1, sizeof(bufdir1), "/dir/dirfile1"); - ret = mkdir(bufdir1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - (void)strcat_s(bufdir2, sizeof(bufdir2), "/dir/dirfile1/dirfile2"); - ret = mkdir(bufdir2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = rename(bufdir1, bufdir2); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - - ret = rename(bufdir2, bufdir1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - ret = rmdir(bufdir1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - - ret = rmdir(bufdir2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = rmdir(bufdir1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - JffsStrcat2(pathname1, "/dir/dirfile1/dirfile2", strlen(pathname1)); - remove(pathname1); -EXIT2: - JffsStrcat2(pathname1, "/dir/dirfile1", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs023(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_023", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_024.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_024.cpp deleted file mode 100644 index 7e82f9aa..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_024.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 ret; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile1[50] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rename(pathname1, pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - (void)strcat_s(buffile1, sizeof(buffile1), "/dir/file1"); - fd1 = open(buffile1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = rename(buffile1, buffile1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = unlink(buffile1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - close(fd1); -EXIT2: - JffsStrcat2(pathname1, "/dir/file1", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs024(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_024", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_025.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_025.cpp deleted file mode 100644 index 2eab0c7d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_025.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR bufdir1[50] = { JFFS_PATH_NAME0 }; - CHAR bufdir2[50] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - (void)strcat_s(bufdir1, sizeof(bufdir1), "/dir/dirfile1"); - ret = mkdir(bufdir1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - (void)strcat_s(bufdir2, sizeof(bufdir2), "/dir/dirfile1/dirfile2"); - ret = rename(bufdir2, bufdir1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - - ret = rmdir(bufdir1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(bufdir2); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - JffsStrcat2(pathname1, "/dir/dirfile1/dirfile2", strlen(pathname1)); - remove(pathname1); - goto EXIT1; -EXIT2: - JffsStrcat2(pathname1, "/dir/dirfile1", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs025(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_025", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_028.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_028.cpp deleted file mode 100644 index acca57b3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_028.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - (void)strcat_s(buffile, sizeof(buffile), "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - len = write(fd, "012345678901234567890123456789", 30); // 30 means write len - ICUNIT_GOTO_EQUAL(len, 30, len, EXIT3); // 30 means write len - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.st_blocks, buf2.st_blocks, buf1.st_blocks, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mode, buf2.st_mode, buf1.st_mode, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs028(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_028", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_029.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_029.cpp deleted file mode 100644 index 8788f665..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_029.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - INT32 n = 103; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - (void)strcat_s(buffile, sizeof(buffile), "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - while (n--) { - len = write(fd, "0123456789012345678901234567890123456789", 40); // 40 means write len - ICUNIT_GOTO_EQUAL(len, 40, len, EXIT3); // 40 means write len - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.st_blocks, buf2.st_blocks, buf1.st_blocks, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mode, buf2.st_mode, buf1.st_mode, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs029(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_029", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_030.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_030.cpp deleted file mode 100644 index ca7e5ff2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_030.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - INT32 n = 256; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - (void)strcat_s(buffile, sizeof(buffile), "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - while (n--) { - len = write(fd, "01234567890123456789012345", 16); // 16 means write len - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT3); // 16 means write len - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs030(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_030", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_031.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_031.cpp deleted file mode 100644 index b88bc82d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_031.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - (void)strcat_s(buffile, sizeof(buffile), "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - len = write(fd, "01234567890123456789012345", 16); // 16 means write len - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT3); // 16 means write len - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs031(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_031", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_032.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_032.cpp deleted file mode 100644 index 9621ccc8..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_032.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - CHAR readbuf[20] = { 0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - (void)strcat_s(buffile, sizeof(buffile), "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - ret = fstat(fd, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - LosTaskDelay(20); // 20 means timedelay length - len = read(fd, readbuf, 20); // 20 means read length - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT3); - - ret = fstat(fd, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - LosTaskDelay(20); // 20 means timedelay length - len = write(fd, "01234567890123456789012345", 16); // 16 means write len - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT3); // 16 means write len - - ret = fstat(fd, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs032(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_032", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_033.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_033.cpp deleted file mode 100644 index f23c1171..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_033.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - CHAR readbuf[20] = { 0 }; - - LosTaskDelay(10); // 10 means delay time length - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - LosTaskDelay(10); // 10 means delay time length - (void)strcat_s(buffile, sizeof(buffile), "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - LosTaskDelay(10); // 10 means delay time length - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT3); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - LosTaskDelay(10); // 10 means delay time length - len = write(fd, "01234567890123456789012345", 16); // 16 means write len - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT3); // 16 means write len - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs033(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_033", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_037.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_037.cpp deleted file mode 100644 index 2ceda67d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_037.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[50] = { 0 }; - CHAR pathname[50] = "/storage/liteos"; - CHAR pathname1[50] = "/storage/liteosliteosli"; - CHAR pathname2[50] = "/storage/liteosliteoslit"; - CHAR pathname3[50] = "/storage/liteos"; - CHAR pathname4[50] = "/storage/liteosliteosli"; - CHAR pathname5[50] = "/jffs/liteosliteoslit"; - off_t off; - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - JffsDeletefile(fd, pathname3); - - fd = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT4); - JffsDeletefile(fd, pathname4); - - fd = open(pathname5, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT5); - - return JFFS_NO_ERROR; -EXIT5: - close(fd); - remove(pathname5); - return JFFS_NO_ERROR; -EXIT4: - close(fd); - remove(pathname4); - return JFFS_NO_ERROR; -EXIT3: - close(fd); - remove(pathname3); - return JFFS_NO_ERROR; -EXIT2: - remove(pathname2); - return JFFS_NO_ERROR; -EXIT1: - remove(pathname1); - return JFFS_NO_ERROR; -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs037(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_037", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_038.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_038.cpp deleted file mode 100644 index bf59e2df..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_038.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - struct stat buf1; - - fd = creat(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = stat(pathname, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.st_size, 0, buf1.st_size, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs038(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_038", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_039.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_039.cpp deleted file mode 100644 index 744cb5de..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_039.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[50] = " "; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs039(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_039", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_040.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_040.cpp deleted file mode 100644 index 35107efb..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_040.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH][JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0, }; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - DIR *dir = NULL; - DIR *dir1[JFFS_STANDARD_NAME_LENGTH] = { NULL, }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - for (i = 0; i < JFFS_STANDARD_NAME_LENGTH; i++) { - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - (void)memset_s(pathname2[i], JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH - 1, JFFS_SHORT_ARRAY_LENGTH, "/test%d", i); - JffsStrcat2(pathname2[i], bufname, strlen(bufname)); - - ret = mkdir(pathname2[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < JFFS_STANDARD_NAME_LENGTH; i++) { - dir1[i] = opendir(pathname2[i]); - ICUNIT_GOTO_NOT_EQUAL(dir1[i], NULL, dir1[i], EXIT3); - } - - for (i = 0; i < JFFS_STANDARD_NAME_LENGTH; i++) { - ret = closedir(dir1[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (i = 0; i < JFFS_STANDARD_NAME_LENGTH; i++) { - ret = remove(pathname2[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - for (i = 0; i < JFFS_STANDARD_NAME_LENGTH; i++) { - closedir(dir1[i]); - } -EXIT2: - for (i = 0; i < JFFS_STANDARD_NAME_LENGTH; i++) { - remove(pathname2[i]); - } -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs040(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_040", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_041.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_041.cpp deleted file mode 100644 index 35b6ef88..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_041.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = { 0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDONLY, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_EQUAL(readbuf[0], 0, readbuf[0], EXIT1); - - fd1 = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs041(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_041", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_042.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_042.cpp deleted file mode 100644 index c3e4e88d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_042.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_WRONLY, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT1); - - fd1 = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs042(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_042", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_043.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_043.cpp deleted file mode 100644 index 4863839f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_043.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - - fd = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs043(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_043", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_044.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_044.cpp deleted file mode 100644 index d922b5cb..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_044.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_WRONLY, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_EXCL | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd1, -1, fd1, EXIT2); - -EXIT2: - close(fd1); -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs044(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_044", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_045.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_045.cpp deleted file mode 100644 index f99e7df8..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_045.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = { 0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - fd2 = open(pathname, O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd2, -1, fd2, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT2); - - fd1 = open(pathname, O_APPEND | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT3); // 10 means read size - - len = write(fd1, "abcde", 6); // 6 means write len - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT3); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT3); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT3); // 16 means path name len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890abcde", readbuf, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - ret = unlink(pathname); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); -#if 1 - close(fd1); -#endif - return JFFS_NO_ERROR; -EXIT3: - close(fd1); -EXIT2: - close(fd2); -EXIT1: - close(fd); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs045(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_045", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_046.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_046.cpp deleted file mode 100644 index 158367c4..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_046.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd1 = open(pathname, O_NONBLOCK | O_TRUNC | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, " ", readbuf, EXIT2); - - ret = close(fd1); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - ret = unlink(pathname); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); - goto EXIT; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs046(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_046", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_048.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_048.cpp deleted file mode 100644 index f484f594..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_048.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 len, ret; - CHAR filebuf[20] = "1234567890abcde"; - CHAR readbuf[7] = { 0 }; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 15, len, EXIT1); // 15 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 4); // 4 means read len - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // 4 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234", readbuf, EXIT1); - - len = read(fd, readbuf, 5); // 5 means read len - ICUNIT_GOTO_EQUAL(len, 5, len, EXIT1); // 5 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "56789", readbuf, EXIT1); - - len = read(fd, readbuf, 6); // 6 means read len - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0abcde", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs048(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_048", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_049.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_049.cpp deleted file mode 100644 index 5fa6a7c1..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_049.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 len, ret; - CHAR filebuf[10] = "123456"; - CHAR readbuf[10] = { 0 }; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 9); // 9 means length of data to be read - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "123456", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 10); // 10 means length of data to be read - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "123456", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - len = read(fd, readbuf, 11); // 11 means length of data to be read - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "123456", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs049(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_049", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_050.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_050.cpp deleted file mode 100644 index cb1fe87a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_050.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 len, ret; - CHAR filebuf[10] = "123456"; - CHAR readbuf[10] = { 0 }; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1", readbuf, EXIT1); - - len = read(fd, readbuf, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs050(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_050", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_051.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_051.cpp deleted file mode 100644 index ff5ce19f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_051.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd[10] = { -1 }; - INT32 ret; - CHAR pathname[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - INT32 offset; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT0); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT0); - - (void)strcat_s(pathname, JFFS_NAME_LIMITTED_SIZE, "/0testwe12rttyututututqweqqfsdfsdfsdf.exe"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/0testwe12rttyututututqweqqfsdfsdfsdffsdf1234567890.TXT", JFFS_NAME_LIMITTED_SIZE); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname, - "/0testwe12rttyututututqweqqfsdfsdfsdffsdf12345678900testwe12rttyututututqweqqfsdfsdfsdffsdf1234567890.123", - JFFS_NAME_LIMITTED_SIZE); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - JffsStrcat2(pathname, "/12345678901234567890123456789012345678901234567890.123", JFFS_NAME_LIMITTED_SIZE); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname, "/ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghjklmnopqrstuvwxyz.123", JFFS_NAME_LIMITTED_SIZE); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - JffsStrcat2(pathname, "/锟斤拷锟斤拷系统锟斤拷锟斤拷锟斤拷缺锟轿达拷未锟.123", JFFS_NAME_LIMITTED_SIZE); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname, "/锟斤拷锟斤拷系统锟斤拷锟斤拷锟斤拷缺锟轿达拷未锟123ttt.www", JFFS_NAME_LIMITTED_SIZE); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT7); - - JffsStrcat2(pathname, "/锟斤拷锟斤拷系统锟斤拷锟斤拷锟斤拷缺锟轿达拷未锟123ttt.www", JFFS_NAME_LIMITTED_SIZE); - fd[0] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_EQUAL(fd[0], -1, fd[0], EXIT7); // 0 means first fd - - JffsStrcat2(pathname, "/0testwe12rttyututututqweqqfsdfsdfsdf.exe", JFFS_NAME_LIMITTED_SIZE); - fd[0] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_EQUAL(fd[0], -1, fd[0], EXIT7); // 0 means first fd - - JffsStrcat2(pathname, "/0testwe12rttyututututqweqqfsdfsdfsdf.txt", JFFS_NAME_LIMITTED_SIZE); - fd[0] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_NOT_EQUAL(fd[0], -1, fd[0], EXIT8); // 0 means first fd - - JffsStrcat2(pathname, "/0testwe12rttyututututqweqqfsdfsdfsdffsdf1234567890.WWW", JFFS_NAME_LIMITTED_SIZE); - fd[1] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 1 means second fd - ICUNIT_GOTO_NOT_EQUAL(fd[1], -1, fd[1], EXIT9); // 1 means second fd - - JffsStrcat2(pathname, - "/0testwe12rttyututututqweqqfsdfsdfsdffsdf12345678900testwe12rttyututututqweqqfsdfsdfsdffsdf1234567890.AAA", - JFFS_NAME_LIMITTED_SIZE); - fd[2] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 2 means third fd - ICUNIT_GOTO_NOT_EQUAL(fd[2], -1, fd[2], EXIT10); // 2 means third fd - - JffsStrcat2(pathname, "/12345678901234567890123456789012345678901234567890.456", JFFS_NAME_LIMITTED_SIZE); - fd[3] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 3 means four fd - ICUNIT_GOTO_NOT_EQUAL(fd[3], -1, fd[3], EXIT11); // 3 means four fd - - JffsStrcat2(pathname, "/ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghjklmnopqrstuvwxyz.456", JFFS_NAME_LIMITTED_SIZE); - fd[4] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 4 means fifth fd - ICUNIT_GOTO_NOT_EQUAL(fd[4], -1, fd[4], EXIT12); // 4 means fifth fd - - JffsStrcat2(pathname, "/锟斤拷锟斤拷系统锟斤拷锟斤拷锟斤拷缺锟轿达拷未锟.123.456", JFFS_NAME_LIMITTED_SIZE); - fd[5] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 5 means six fd - ICUNIT_GOTO_NOT_EQUAL(fd[5], -1, fd[5], EXIT13); // 5 means six fd - - JffsStrcat2(pathname, "/锟斤拷锟斤拷系统锟斤拷锟斤拷锟斤拷缺锟轿达拷未锟123ttt.www", JFFS_NAME_LIMITTED_SIZE); - fd[6] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 6 means seven fd - ICUNIT_GOTO_EQUAL(fd[6], -1, fd[6], EXIT13); // 6 means seven fd - - JffsStrcat2(pathname, "/锟斤拷锟斤拷系统锟斤拷锟斤拷锟斤拷缺锟轿达拷未锟123ttt.AAA", JFFS_NAME_LIMITTED_SIZE); - fd[6] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 6 means seven fd - ICUNIT_GOTO_NOT_EQUAL(fd[6], -1, fd[6], EXIT14); // 6 means seven fd - - JffsStrcat2(pathname, "/锟斤拷锟斤拷系统锟斤拷锟斤拷锟斤拷缺锟轿达拷未锟123ttt.AAA", JFFS_NAME_LIMITTED_SIZE); - fd[7] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 7 means eight fd - ICUNIT_GOTO_EQUAL(fd[7], -1, fd[7], EXIT14); // 7 means eight fd - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT15); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT15); - LosTaskDelay(5); // 5 means timedelay len - -EXIT14: - JffsStrcat2(pathname, "/锟斤拷锟斤拷系统锟斤拷锟斤拷锟斤拷缺锟轿达拷未锟123ttt.AAA", JFFS_NAME_LIMITTED_SIZE); - ret = close(fd[6]); // 6 means seven fd - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT14_1); -EXIT14_1: - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT13); - -EXIT13: - JffsStrcat2(pathname, "/锟斤拷锟斤拷系统锟斤拷锟斤拷锟斤拷缺锟轿达拷未锟.123.456", JFFS_NAME_LIMITTED_SIZE); - ret = close(fd[5]); // 5 means six fd - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT13_1); -EXIT13_1: - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT12); -EXIT12: - JffsStrcat2(pathname, "/ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghjklmnopqrstuvwxyz.456", JFFS_NAME_LIMITTED_SIZE); - ret = close(fd[4]); // 4 means fifth fd - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT12_1); -EXIT12_1: - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT11); -EXIT11: - JffsStrcat2(pathname, "/12345678901234567890123456789012345678901234567890.456", JFFS_NAME_LIMITTED_SIZE); - ret = close(fd[3]); // 3 means four fd - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT11_1); -EXIT11_1: - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT10); -EXIT10: - JffsStrcat2(pathname, - "/0testwe12rttyututututqweqqfsdfsdfsdffsdf12345678900testwe12rttyututututqweqqfsdfsdfsdffsdf1234567890.AAA", - JFFS_NAME_LIMITTED_SIZE); - ret = close(fd[2]); // 2 means third fd - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT10_1); -EXIT10_1: - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT9); -EXIT9: - JffsStrcat2(pathname, "/0testwe12rttyututututqweqqfsdfsdfsdffsdf1234567890.WWW", JFFS_NAME_LIMITTED_SIZE); - ret = close(fd[1]); // 1 means second fd - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT9_1); -EXIT9_1: - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); - -EXIT8: - JffsStrcat2(pathname, "/0testwe12rttyututututqweqqfsdfsdfsdf.txt", JFFS_NAME_LIMITTED_SIZE); - ret = close(fd[0]); // 0 means first fd - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8_1); -EXIT8_1: - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT7); - -EXIT7: - JffsStrcat2(pathname, "/锟斤拷锟斤拷系统锟斤拷锟斤拷锟斤拷缺锟轿达拷未锟123ttt.www", JFFS_NAME_LIMITTED_SIZE); - rmdir(pathname); - -EXIT6: - JffsStrcat2(pathname, "/锟斤拷锟斤拷系统锟斤拷锟斤拷锟斤拷缺锟轿达拷未锟.123", JFFS_NAME_LIMITTED_SIZE); - rmdir(pathname); -EXIT5: - JffsStrcat2(pathname, "/ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghjklmnopqrstuvwxyz.123", JFFS_NAME_LIMITTED_SIZE); - rmdir(pathname); -EXIT4: - JffsStrcat2(pathname, "/12345678901234567890123456789012345678901234567890.123", JFFS_NAME_LIMITTED_SIZE); - rmdir(pathname); -EXIT3: - JffsStrcat2(pathname, - "/0testwe12rttyututututqweqqfsdfsdfsdffsdf12345678900testwe12rttyututututqweqqfsdfsdfsdffsdf1234567890.123", - JFFS_NAME_LIMITTED_SIZE); - rmdir(pathname); - -EXIT2: - JffsStrcat2(pathname, "/0testwe12rttyututututqweqqfsdfsdfsdffsdf1234567890.TXT", JFFS_NAME_LIMITTED_SIZE); - rmdir(pathname); - -EXIT1: - JffsStrcat2(pathname, "/0testwe12rttyututututqweqqfsdfsdfsdf.exe", JFFS_NAME_LIMITTED_SIZE); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -EXIT15: - closedir(dir); - goto EXIT14; - return JFFS_NO_ERROR; -EXIT0: - closedir(dir); - goto EXIT; -} - -VOID ItFsJffs051(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_051", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_053.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_053.cpp deleted file mode 100644 index 5e1ec2eb..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_053.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 len, ret; - CHAR filebuf[20] = "1234567890abcde"; - CHAR readbuf[JFFS_SHORT_ARRAY_LENGTH] = { 0 }; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 4); // 4 means read len - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // 4 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)memset_s(readbuf, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - - len = read(fd, readbuf, 2); // 2 means read len - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - ICUNIT_GOTO_EQUAL(readbuf[0], 0, readbuf[0], EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - fd = open(pathname, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); // 脭脵麓脦麓貌驴陋脦脛录镁 - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 4); // 4 means read len - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // 4 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - len = read(fd, readbuf, 2); // 2 means read len - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234", readbuf, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs053(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_053", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_055.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_055.cpp deleted file mode 100644 index 1d5325e1..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_055.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 len, ret; - CHAR filebuf[20] = "1234567890abcde&"; - CHAR readbuf[5] = { 0 }; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); // 16 means write len - - len = write(fd, filebuf, strlen(filebuf) + 1); - ICUNIT_GOTO_EQUAL(len, 17, len, EXIT1); // 17 means write len - - len = write(fd, filebuf, strlen(filebuf) - 1); - ICUNIT_GOTO_EQUAL(len, 15, len, EXIT1); // 15 means write len - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs055(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_055", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_056.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_056.cpp deleted file mode 100644 index f6263037..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_056.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 len, ret; - CHAR filebuf[20] = "1234567890abcde&"; - CHAR readbuf[50] = { 0 }; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); // 16 means write len - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); // 16 means write len - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); // 16 means write len - - len = write(fd, "END", 3); // 3 means name len - ICUNIT_GOTO_EQUAL(len, 3, len, EXIT1); // 3 means write len - - off = lseek(fd, 10, SEEK_SET); // 10 means file seek len - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT1); // 10 means current file position - - len = read(fd, readbuf, 6); // 6 means read len - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcde&", readbuf, EXIT1); - - off = lseek(fd, 2, SEEK_CUR); // 2 means file seek len - ICUNIT_GOTO_EQUAL(off, 18, off, EXIT1); // 18 means current file position - - (void)memset_s(readbuf, sizeof(readbuf), 0, sizeof(readbuf)); - - len = read(fd, readbuf, 5); // 5 means read len - ICUNIT_GOTO_EQUAL(len, 5, len, EXIT1); // 5 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "34567", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 23, off, EXIT1); // 23 means current file position - - len = read(fd, readbuf, 5); // 5 means read len - ICUNIT_GOTO_EQUAL(len, 5, len, EXIT1); // 5 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "890ab", readbuf, EXIT1); - - off = lseek(fd, -2, SEEK_CUR); // -2 means file seek back len - ICUNIT_GOTO_EQUAL(off, 26, off, EXIT1); // 26 means current file position - - len = read(fd, readbuf, 6); // 6 means read len - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcde&", readbuf, EXIT1); - - (void)memset_s(readbuf, sizeof(readbuf), 0, sizeof(readbuf)); - - off = lseek(fd, -2, SEEK_END); // -2 means file seek back len - ICUNIT_GOTO_EQUAL(off, 49, off, EXIT1); // 49 means current file position - - len = read(fd, readbuf, 5); // 5 means read len - ICUNIT_GOTO_EQUAL(len, 2, len, EXIT1); // 2 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "ND", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 51, off, EXIT1); // 51 means current file position - - len = read(fd, readbuf, 6); // 6 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - off = lseek(fd, 2, SEEK_END); // 2 means file seek len - ICUNIT_GOTO_EQUAL(off, 53, off, EXIT1); // 53 means current file position - len = read(fd, readbuf, 6); // 6 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - len = write(fd, "mmm", 3); // 3 means write len - ICUNIT_GOTO_EQUAL(len, 3, len, EXIT1); // 3 means write len - - off = lseek(fd, -3, SEEK_END); // -3 means file seek back len - ICUNIT_GOTO_EQUAL(off, 53, off, EXIT1); // 53 means current file position - - len = read(fd, readbuf, 5); // 5 means read len - ICUNIT_GOTO_EQUAL(len, 3, len, EXIT1); // 3 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "mmm", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs056(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_056", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_057.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_057.cpp deleted file mode 100644 index 874eb88e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_057.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, scandirCount; - INT32 fd = -1; - CHAR pathname[30] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - struct dirent **namelist = NULL; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT1); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT1); - - scandirCount = scandir(pathname, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 0, scandirCount, EXIT2); - - JffsScandirFree(namelist, scandirCount); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - if (scandirCount > 0) - JffsScandirFree(namelist, scandirCount); - else - goto EXIT1; -EXIT1: - closedir(dir); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs057(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_057", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_058.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_058.cpp deleted file mode 100644 index a921bc52..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_058.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname[30] = { JFFS_MAIN_DIR0 }; - CHAR pathname1[30] = { JFFS_PATH_NAME0 }; - CHAR pathname2[30] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - struct dirent **namelist = NULL; - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - (void)strcat_s(pathname2, sizeof(pathname2), "/test"); - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = access(pathname2, F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = access(pathname2, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - rmdir(pathname2); -EXIT1: - rmdir(pathname1); -EXIT: - closedir(dir); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs058(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_058", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_059.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_059.cpp deleted file mode 100644 index ad522df9..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_059.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static constexpr int FILE_NAME_LEN = 10; -static constexpr int MAX_FILE_NAME_LEN = 50; - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[MAX_FILE_NAME_LEN] = "liteos"; - CHAR pathname[MAX_FILE_NAME_LEN] = { JFFS_PATH_NAME0 }; - off_t off; - struct stat buf1; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FILE_NAME_LEN, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = creat(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, MAX_FILE_NAME_LEN); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = stat(pathname, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.st_size, 0, buf1.st_size, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FILE_NAME_LEN, len, EXIT1); - - len = read(fd, readbuf, MAX_FILE_NAME_LEN); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs059(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_059", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_060.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_060.cpp deleted file mode 100644 index 2e8dc814..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_060.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[50] = { 0 }; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - off_t off; - fd = open(pathname, O_NONBLOCK | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, 0, fd, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs060(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_060", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_061.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_061.cpp deleted file mode 100644 index 7f1c775e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_061.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - INT32 offset; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - closedir(dir); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs061(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_061", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_062.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_062.cpp deleted file mode 100644 index 0c2ec0ae..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_062.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs062(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_062", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_063.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_063.cpp deleted file mode 100644 index 798bc84e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_063.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static constexpr int FILE_NAME_LEN = 10; -static constexpr int MAX_FILE_NAME_LEN = 50; - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret; - CHAR pathname[MAX_FILE_NAME_LEN] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDONLY | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_WRONLY | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd1, -1, fd1, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_WRONLY, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(ret, FILE_NAME_LEN, ret, EXIT1); - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - ret = read(fd, readbuf, FILE_NAME_LEN); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDONLY, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - ret = read(fd, readbuf, FILE_NAME_LEN); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(ret, FILE_NAME_LEN, ret, EXIT1); - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - ret = read(fd, readbuf, FILE_NAME_LEN); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs063(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_063", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_064.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_064.cpp deleted file mode 100644 index 47dbe0ed..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_064.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs064(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_064", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_065.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_065.cpp deleted file mode 100644 index 21ddec70..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_065.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static constexpr int MAX_FILE_NUM = 50; - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, i; - - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1[MAX_FILE_NUM] = {NULL}; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - while (i < MAX_FILE_NUM) { - dir1[i] = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir1[i], NULL, dir1[i], EXIT1); - - i++; - } - for (i = 0; i < MAX_FILE_NUM; i++) { - ret = closedir(dir1[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - return JFFS_NO_ERROR; -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return JFFS_NO_ERROR; -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs065(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_065", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_066.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_066.cpp deleted file mode 100644 index 22e2d250..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_066.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, i, j; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR bufname[10] = ""; - CHAR pathname2[10][50] = { 0 }; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - for (i = 0; i < 10; i++) { // 10 means max file num - (void)memset_s(bufname, sizeof(bufname), 0, strlen(bufname)); - (void)snprintf_s(bufname, sizeof(bufname) - 1, sizeof(bufname), "/%d", i); - (void)strcat_s(pathname1, sizeof(pathname1), bufname); - (void)strcpy_s(pathname2[i], sizeof(pathname2[i]), pathname1); - - ret = mkdir(pathname2[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - - for (i = 0; i < 9; i++) { // 9 means max file num - ret = rmdir(pathname2[i]); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - } - for (i = 9; i >= 0; i--) { // 9 means max file num - ret = rmdir(pathname2[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - for (i = 9; i >= 0; i--) { // 9 means max file num - rmdir(pathname2[i]); - } -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs066(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_066", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_067.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_067.cpp deleted file mode 100644 index 74efa6cf..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_067.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs067(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_067", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_068.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_068.cpp deleted file mode 100644 index 0ef55e36..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_068.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static constexpr int MAX_FILE_NAME_LEN = 50; - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 pfd = -1; - INT32 ret, len; - CHAR filebuf1[10] = "liteos "; - CHAR filebuf2[10] = "good"; - CHAR readbuf[MAX_FILE_NAME_LEN] = { 0 }; - CHAR pathname1[MAX_FILE_NAME_LEN] = { JFFS_PATH_NAME0 }; - CHAR pathname2[MAX_FILE_NAME_LEN] = { JFFS_PATH_NAME0 }; - off_t off; - struct stat buf1; - - errno = 0; - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - pfd = dup2(20, 20); // 20 means dup length - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT2); - - pfd = dup2(fd, fd); - ICUNIT_GOTO_EQUAL(pfd, fd, pfd, EXIT2); - - (void)strcat_s(pathname2, sizeof(pathname2), "T"); - fd1 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT4); - - pfd = dup2(fd, fd1); - printf("[%d] fd:%d, fd1:%d, pfd:%d, errno:%d\n", __LINE__, fd, fd1, pfd, errno); - ICUNIT_GOTO_EQUAL(pfd, fd1, pfd, EXIT4); - - len = write(fd1, filebuf1, strlen(filebuf1)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf1), len, EXIT4); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - len = write(fd, filebuf2, strlen(filebuf2)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf2), len, EXIT4); - - fd2 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT5); - - errno = 0; - len = read(fd2, readbuf, MAX_FILE_NAME_LEN); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT5); - - ICUNIT_GOTO_EQUAL((INT32)lseek(fd2, 0, SEEK_CUR), 0, (INT32)lseek(fd2, 0, SEEK_CUR), EXIT5); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - len = write(fd, filebuf2, strlen(filebuf2)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT5); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT5); - - (void)memset_s(readbuf, sizeof(readbuf), 0, strlen(readbuf)); - len = read(fd, readbuf, MAX_FILE_NAME_LEN); - printf("[%d] fd:%d, errno:%d,readbuf:%s\n", __LINE__, fd, errno, readbuf); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf1) + strlen(filebuf2), len, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos good", readbuf, EXIT5); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - return JFFS_NO_ERROR; -EXIT5: - close(fd2); - goto EXIT3; -EXIT4: - close(fd1); -EXIT3: - remove(pathname2); -EXIT2: - close(pfd); -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs068(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_068", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_069.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_069.cpp deleted file mode 100644 index 86e30850..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_069.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 pfd = -100; - INT32 pfd2 = -1; - INT32 ret, len; - CHAR filebuf1[JFFS_SHORT_ARRAY_LENGTH] = "liteos "; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - struct stat buf1; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - pfd = dup(fd); - ICUNIT_GOTO_NOT_EQUAL(pfd, -1, pfd, EXIT2); - - len = write(fd, filebuf1, strlen(filebuf1)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf1), len, EXIT2); - - off = lseek(fd, 3, SEEK_SET); // 3 means seek len - ICUNIT_GOTO_EQUAL(off, 3, off, EXIT2); // 3 means current file position - - pfd2 = dup(fd); - ICUNIT_GOTO_NOT_EQUAL(pfd2, -1, pfd2, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - (void)memset_s(readbuf, sizeof(readbuf), 0, sizeof(readbuf)); - len = read(fd, readbuf, 50); // 50 means read len - ICUNIT_GOTO_EQUAL(len, 7, len, EXIT1); // 7 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos ", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = close(pfd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = close(pfd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(pfd2); -EXIT2: - close(pfd); -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs069(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_069", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_070.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_070.cpp deleted file mode 100644 index d9969e3d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_070.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd1 = open(pathname, O_NONBLOCK | O_TRUNC, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd1 = open(pathname, O_NONBLOCK | O_TRUNC | O_RDONLY, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT1); - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd1 = open(pathname, O_NONBLOCK | O_TRUNC | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd1, -1, fd1, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - goto EXIT; -EXIT1: - close(fd1); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs070(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_070", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_071.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_071.cpp deleted file mode 100644 index 20150f34..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_071.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, i; - INT32 fileCount = 0; - INT32 fd[JFFS_NAME_LIMITTED_SIZE] = { -1 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE][JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0, }; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - (void)memset_s(pathname2[i], JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH - 1, JFFS_SHORT_ARRAY_LENGTH, "/test%d", i); - JffsStrcat2(pathname2[i], bufname, strlen(bufname)); - - if (fd[fileCount] == (CONFIG_NFILE_DESCRIPTORS - 1)) { - fd[i] = open(pathname2[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd[i], -1, fd[i], EXIT3); - ICUNIT_GOTO_EQUAL(errno, EMFILE, errno, EXIT3); - continue; - } - fd[i] = open(pathname2[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT3); - fileCount = i; - } - - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - if (i > fileCount) { - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT3); - continue; - } - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - if (i > fileCount) { - ret = remove(pathname2[i]); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT2); - continue; - } - - ret = remove(pathname2[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - close(fd[i]); - } -EXIT2: - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - remove(pathname2[i]); - } -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs071(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_071", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_072.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_072.cpp deleted file mode 100644 index 72e2e87c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_072.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - dir = opendir(JFFS_MAIN_DIR0); - printf("#####test72###11111111\n"); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - - ret = closedir(dir); - printf("#####test72###22222222\n"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - printf("#####test72###333333333\n"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - printf("#####test72###444444444\n"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - printf("#####test72###555555555\n"); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs072(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_072", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_073.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_073.cpp deleted file mode 100644 index 095ee361..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_073.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - dir = opendir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs073(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_073", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_074.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_074.cpp deleted file mode 100644 index d7497e92..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_074.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 ret, i, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/test"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT1); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < 1000; i++) { // 1000 means mount and umount times - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT1); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - close(fd1); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs074(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_074", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_076.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_076.cpp deleted file mode 100644 index ed4760da..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_076.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 ret, i, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname1); - - return JFFS_NO_ERROR; -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs076(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_076", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_077.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_077.cpp deleted file mode 100644 index 16166aa5..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_077.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, i; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR pathname3[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/test"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - (void)strcat_s(pathname2, sizeof(pathname2), "/test"); - (void)strcat_s(pathname2, sizeof(pathname2), "/test"); - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - remove(pathname2); -EXIT1: - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs077(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_077", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_078.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_078.cpp deleted file mode 100644 index b8727ce8..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_078.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret, i; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR pathname3[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/test"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT1); - - (void)strcat_s(pathname2, sizeof(pathname2), "/TEst"); - fd2 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd2); - remove(pathname2); -EXIT1: - close(fd1); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs078(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_078", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_079.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_079.cpp deleted file mode 100644 index e1d6ae29..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_079.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret, i; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR pathname3[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/test"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - (void)strcat_s(pathname2, sizeof(pathname2), "/TEst"); - ret = rename(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd2 = open(pathname2, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT2); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd2); - remove(pathname2); -EXIT1: - close(fd1); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs079(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_079", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_080.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_080.cpp deleted file mode 100644 index 008fbf03..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_080.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 ret, i, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[50] = "liteos"; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR pathname3[50] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/test"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT1); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EBUSY, errno, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, "/storage", JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - mount(JFFS_DEV_PATH0, "/storage", JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - close(fd1); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs080(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_080", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_081.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_081.cpp deleted file mode 100644 index 224ad0bb..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_081.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 ret, i, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[50] = "liteos"; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR pathname3[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EBUSY, errno, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - mount(JFFS_DEV_PATH0, "/storage", JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - closedir(dir); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs081(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_081", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_082.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_082.cpp deleted file mode 100644 index 93edd2b6..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_082.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct dirent *ptr = NULL; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/1082"); - fd = open(pathname1, O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - ICUNIT_GOTO_EQUAL(buf1.st_mode & S_IFMT, S_IFREG, buf1.st_mode & S_IFMT, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(pathname2); - return LOS_NOK; -} - -VOID ItFsJffs082(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_082", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_083.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_083.cpp deleted file mode 100644 index 141b2ab2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_083.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - struct dirent *ptr = NULL; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/10 77"); - fd = open(pathname1, O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - ICUNIT_GOTO_EQUAL(buf1.st_mode & S_IFMT, S_IFREG, buf1.st_mode & S_IFMT, EXIT2); - - len = write(fd, buf, sizeof(buf)); - ICUNIT_GOTO_EQUAL(len, sizeof(buf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(pathname2); - return LOS_NOK; -} - -VOID ItFsJffs083(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_083", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_084.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_084.cpp deleted file mode 100644 index e4991b75..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_084.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - struct dirent *ptr = NULL; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/10 78"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname3, sizeof(pathname3), "/10 78/test"); - fd = open(pathname3, O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = stat(pathname3, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - ICUNIT_GOTO_EQUAL(buf1.st_mode & S_IFMT, S_IFREG, buf1.st_mode & S_IFMT, EXIT2); - - len = write(fd, buf, sizeof(buf)); - ICUNIT_GOTO_EQUAL(len, sizeof(buf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - remove(pathname3); -EXIT1: - remove(pathname1); -EXIT: - rmdir(pathname2); - return LOS_NOK; -} - -VOID ItFsJffs084(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_084", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_085.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_085.cpp deleted file mode 100644 index 44318aa5..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_085.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - struct dirent *ptr = NULL; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/test\0test"); - fd = open(pathname1, O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname1, "/test\ntest", JFFS_STANDARD_NAME_LENGTH); - fd = open(pathname1, O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname1, "/test\ttest", JFFS_STANDARD_NAME_LENGTH); - fd = open(pathname1, O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(pathname2); - return LOS_NOK; -} - -VOID ItFsJffs085(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_085", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_086.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_086.cpp deleted file mode 100644 index c2ddc867..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_086.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = "/jffs111"; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = "/jffs222"; - struct stat buf1 = { 0 }; - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, pathname2, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, pathname3, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = umount(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = umount(pathname3); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = stat(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = stat(pathname3, &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(pathname2); - goto EXIT; -EXIT1: - remove(pathname3); -EXIT: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return LOS_NOK; -} - -VOID ItFsJffs086(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_086", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_088.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_088.cpp deleted file mode 100644 index d5529cde..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_088.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - errno = 0; - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs088(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_088", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_090.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_090.cpp deleted file mode 100644 index bef8325d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_090.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_SHORT_ARRAY_LENGTH] = "lalala"; - CHAR readbuf[JFFS_SHORT_ARRAY_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname2, sizeof(pathname2), "/test"); - fd = open64(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT1); - - (void)memset_s(readbuf, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs090(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_090", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_092.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_092.cpp deleted file mode 100644 index e3a4d3c3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_092.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chmod(pathname1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - (void)strcat_s(pathname2, sizeof(pathname2), "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = chmod(pathname1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - - ret = chmod(pathname1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs092(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_092", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_093.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_093.cpp deleted file mode 100644 index ab8b23c6..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_093.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static constexpr int MAX_FILE_LEN = 10; - -static UINT32 Testcase(VOID) -{ - INT32 fd[10] = { -1 }; - INT32 ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[10][JFFS_STANDARD_NAME_LENGTH] = {JFFS_PATH_NAME0}; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - INT32 randTest1[10] = { 2, 6, 3, 1, 0, 8, 7, 9, 4, 5 }; - INT32 randTest2[10] = { 5, 3, 1, 6, 7, 2, 4, 9, 0, 8 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < MAX_FILE_LEN; i++) { - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - (void)memset_s(pathname2[i], JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH - 1, JFFS_SHORT_ARRAY_LENGTH, "/1071_%d", i); - (void)strcat_s(pathname2[i], JFFS_STANDARD_NAME_LENGTH, pathname1); - (void)strcat_s(pathname2[i], JFFS_STANDARD_NAME_LENGTH, bufname); - fd[i] = open(pathname2[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - } - for (i = 0; i < MAX_FILE_LEN; i++) { - len = write(fd[randTest1[i]], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - ret = close(fd[randTest1[i]]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < MAX_FILE_LEN; i++) { - fd[randTest2[i]] = open(pathname2[randTest2[i]], O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - - len = read(fd[randTest2[i]], readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // 10 means length of actually read data - - ret = close(fd[randTest2[i]]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < MAX_FILE_LEN; i++) { - ret = remove(pathname2[randTest2[i]]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < MAX_FILE_LEN; i++) { - close(fd[randTest1[i]]); - } -EXIT1: - for (i = 0; i < MAX_FILE_LEN; i++) { - remove(pathname2[randTest2[i]]); - } -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs093(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_093", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_096.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_096.cpp deleted file mode 100644 index 099e0fe1..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_096.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 pfd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname2, sizeof(pathname2), "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - pfd = dup(fd); - ICUNIT_GOTO_NOT_EQUAL(pfd, -1, pfd, EXIT2); - - ret = close(pfd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(pfd); -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs096(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_096", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_097.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_097.cpp deleted file mode 100644 index e116d67a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_097.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1, buf2; - struct utimbuf utime1; - time_t ttime1; - struct tm ttm1; - - ttm1.tm_year = 90; // 90 means year - ttm1.tm_mon = 0; // 0 means month - ttm1.tm_mday = 1; // 1 means day - ttm1.tm_hour = 12; // 12 means hour - ttm1.tm_min = 12; // 12 means minute - ttm1.tm_sec = 12; // 12 means second - ttm1.tm_isdst = 0; - ttime1 = mktime(&ttm1); - utime1.modtime = ttime1; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/097"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, 0644); // 0644 means mode of file - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - JffsStatPrintf(buf1); - - ret = utime(pathname1, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - JffsStatPrintf(buf1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = utime(pathname1, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - JffsStatPrintf(buf1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs097(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_097", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_099.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_099.cpp deleted file mode 100644 index 356f08f1..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_099.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "test12"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = pread(fd, readbuf, JFFS_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, len, off, EXIT1); - - len = pread(fd, readbuf, JFFS_STANDARD_NAME_LENGTH, off); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = pread(fd, readbuf, JFFS_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - (void)strcpy_s(readbuf, JFFS_STANDARD_NAME_LENGTH, "liteos"); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = pread(fd, readbuf, JFFS_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, len, off, EXIT1); - - len = pread(fd, readbuf, JFFS_STANDARD_NAME_LENGTH, off); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = pread(fd, readbuf, JFFS_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs099(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_099", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_100.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_100.cpp deleted file mode 100644 index e3e3e7e6..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_100.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "test12"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = pwrite(fd, filebuf, strlen(filebuf), 0); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - (void)strcpy_s(readbuf, JFFS_STANDARD_NAME_LENGTH, "liteos"); - - (void)strcat_s(pathname1, sizeof(pathname1), "test12"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = pwrite64(fd, filebuf, strlen(filebuf), 0); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs100(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_100", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_101.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_101.cpp deleted file mode 100644 index bbf0607e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_101.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, i, scandirCount; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = "/jf"; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = "/jf/test"; - CHAR pathname6[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)memset_s(pathname2, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(pathname3, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)strcat_s(pathname6, sizeof(pathname6), "/"); - - while (i < 247) { // 247 means loop times - i++; - (void)strcat_s(pathname2, sizeof(pathname2), "t"); - (void)strcat_s(pathname3, sizeof(pathname3), "t"); - (void)strcat_s(pathname6, sizeof(pathname6), "t"); - } - ICUNIT_GOTO_EQUAL(strlen(pathname6), 259, strlen(pathname6), EXIT); // 259 means current name len - ICUNIT_GOTO_EQUAL(strlen(pathname2), 247, strlen(pathname2), EXIT); // 247 means current name len - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mkdir(pathname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT1); - - (void)strcat_s(pathname3, sizeof(pathname3), "t"); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT2); - - (void)strcat_s(pathname6, sizeof(pathname6), "t"); - ICUNIT_GOTO_EQUAL(strlen(pathname6), 260, strlen(pathname6), EXIT); // 260 means current name len - ret = mkdir(pathname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT2); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = mount(JFFS_DEV_PATH0, pathname4, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname5); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = access(pathname2, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - scandirCount = scandir(pathname5, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 2, scandirCount, EXIT5); // 2 means total scaned file - - JffsScandirFree(namelist, scandirCount); - - ret = umount(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - scandirCount = scandir(pathname1, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 2, scandirCount, EXIT5); // 2 means total scaned file - - JffsScandirFree(namelist, scandirCount); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT4); - - ret = rmdir(pathname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT4); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, pathname4, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname5); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT5: - JffsScandirFree(namelist, scandirCount); -EXIT4: - umount(pathname4); - remove(pathname4); -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT2: - remove(pathname3); - remove(pathname6); -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs101(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_101", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_102.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_102.cpp deleted file mode 100644 index e0d414ac..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_102.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, i, scandirCount; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_MAIN_DIR0 }; - CHAR pathname4[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR pathname5[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR pathname6[JFFS_STANDARD_NAME_LENGTH] = "/jf"; - CHAR pathname7[JFFS_STANDARD_NAME_LENGTH] = "/jf"; - - struct dirent **namelist = NULL; - - ret = chdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)memset_s(pathname4, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(pathname5, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)strcat_s(pathname3, sizeof(pathname3), "/"); - - while (i < 252) { // 252 means loop times - i++; - (void)strcat_s(pathname4, sizeof(pathname4), "t"); - (void)strcat_s(pathname5, sizeof(pathname5), "t"); - (void)strcat_s(pathname3, sizeof(pathname3), "t"); - } - ICUNIT_GOTO_EQUAL(strlen(pathname3), 259, strlen(pathname3), EXIT); // 259 means current name len - ICUNIT_GOTO_EQUAL(strlen(pathname4), 252, strlen(pathname4), EXIT); // 252 means current name len - - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT2); - - (void)strcat_s(pathname5, sizeof(pathname5), "t"); - fd = open(pathname5, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT2); - - (void)strcat_s(pathname3, sizeof(pathname3), "t"); - ICUNIT_GOTO_EQUAL(strlen(pathname3), 260, strlen(pathname3), EXIT); // 260 means current name len - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT2); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = mount(JFFS_DEV_PATH0, pathname6, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = access(pathname4, F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - fd = open(pathname5, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT4); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - scandirCount = scandir(pathname7, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 2, scandirCount, EXIT5); // 2 means total scaned file - - JffsScandirFree(namelist, scandirCount); - - ret = umount(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - scandirCount = scandir(pathname1, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 2, scandirCount, EXIT5); // 2 means total scaned file - - JffsScandirFree(namelist, scandirCount); - - ret = remove(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, pathname6, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname5); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = umount(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - return JFFS_NO_ERROR; -EXIT5: - JffsScandirFree(namelist, scandirCount); -EXIT4: - umount(pathname6); - remove(pathname6); -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT2: - close(fd); - remove(pathname5); - remove(pathname3); -EXIT1: - close(fd); - remove(pathname4); -EXIT: - close(fd); - remove(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs102(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_102", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_104.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_104.cpp deleted file mode 100644 index 8df5eb2d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_104.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd[3] = { -1 }; - INT32 ret, len; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd[0] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_NOT_EQUAL(fd[0], JFFS_IS_ERROR, fd[0], EXIT1); // 0 means first fd - - fd[1] = open(pathname1, O_NONBLOCK | O_RDONLY, HIGHEST_AUTHORITY); // 1 means second fd - ICUNIT_GOTO_NOT_EQUAL(fd[1], JFFS_IS_ERROR, fd[1], EXIT2); // 1 means second fd - - ret = close(fd[1]); // 1 means second fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd[0]); // 0 means first fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd[0] = open(pathname1, O_NONBLOCK | O_CREAT | O_WRONLY, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_NOT_EQUAL(fd[0], JFFS_IS_ERROR, fd[0], EXIT1); // 0 means first fd - - fd[1] = open(pathname1, O_NONBLOCK | O_RDONLY, HIGHEST_AUTHORITY); // 1 means second fd - ICUNIT_GOTO_NOT_EQUAL(fd[1], JFFS_IS_ERROR, fd[1], EXIT2); // 1 means second fd - - fd[2] = open(pathname1, O_NONBLOCK | O_WRONLY, HIGHEST_AUTHORITY); // 2 means third fd - ICUNIT_GOTO_NOT_EQUAL(fd[2], JFFS_IS_ERROR, fd[2], EXIT3); // 2 means third fd - - ret = close(fd[2]); // 2 means third fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd[1]); // 1 means second fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd[0]); // 0 means first fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd[0] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDONLY, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_NOT_EQUAL(fd[0], JFFS_IS_ERROR, fd[0], EXIT1); // 0 means first fd - - fd[1] = open(pathname1, O_NONBLOCK | O_RDONLY, HIGHEST_AUTHORITY); // 1 means second fd - ICUNIT_GOTO_NOT_EQUAL(fd[1], JFFS_IS_ERROR, fd[1], EXIT2); // 1 means second fd - - ret = close(fd[1]); // 1 means second fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd[0]); // 0 means first fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd[0] = open(pathname1, O_NONBLOCK | O_RDONLY, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_NOT_EQUAL(fd[0], JFFS_IS_ERROR, fd[0], EXIT1); // 0 means first fd - - fd[1] = open(pathname1, O_NONBLOCK | O_RDONLY, HIGHEST_AUTHORITY); // 1 means second fd - ICUNIT_GOTO_NOT_EQUAL(fd[1], JFFS_IS_ERROR, fd[1], EXIT2); // 1 means second fd - - fd[2] = open(pathname1, O_NONBLOCK | O_WRONLY, HIGHEST_AUTHORITY); // 2 means third fd - ICUNIT_GOTO_NOT_EQUAL(fd[2], JFFS_IS_ERROR, fd[2], EXIT3); // 2 means third fd - - len = write(fd[0], filebuf, strlen(filebuf)); // 0 means first fd - ICUNIT_GOTO_EQUAL(len, JFFS_IS_ERROR, len, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT3); - - len = write(fd[2], filebuf, strlen(filebuf)); // 2 means third fd - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - - off = lseek(fd[0], 0, SEEK_SET); // 0 means first fd - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT3); - - len = read(fd[1], readbuf, JFFS_STANDARD_NAME_LENGTH); // 1 means second fd - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - ret = close(fd[2]); // 2 means third fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd[1]); // 1 means second fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd[0]); // 0 means first fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(fd[2]); // 2 means third fd -EXIT2: - close(fd[1]); // 1 means second fd -EXIT1: - close(fd[0]); // 0 means first fd -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_104 -* -@tspec The Function test for open -* -@ttitle Open the file several times in read-only mode -* -@tprecon The filesystem module is open -* -@tbrief -1. create one file and opened it in read-write mode; -2. open the file several times in read-only mode -3. write and read these fd -4. close and remove all the file -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs104(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_104", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_105.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_105.cpp deleted file mode 100644 index fab9df77..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_105.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = access(pathname1, F_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_EXCL, S_IRWXU); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_EXCL, S_IRWXU | S_IRWXG); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_EXCL, S_IRWXU | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_105 -* -@tspec The Function test for access -* -@ttitle Check file existence and permissions normally -* -@tprecon The filesystem module is open -* -@tbrief -1. create one file ; -2. check file existence and permissions normally; -3. delete the file; -4. N/A; -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A; -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs105(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_105", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_106.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_106.cpp deleted file mode 100644 index dba4504f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_106.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_EXCL, 0); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT, S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT, S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT, S_IRWXG); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_106 -* -@tspec The Function test for access -* -@ttitle Exception check file presence and permissions -* -@tprecon The filesystem module is open -* -@tbrief -1. create one file ; -2. exception check file presence and permissions; -3. delete the file; -4. N/A; -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A; -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs106(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_106", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_107.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_107.cpp deleted file mode 100644 index 61736c22..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_107.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_107 -* -@tspec The Function test for access -* -@ttitle Exception Check directory presence and permissions -* -@tprecon The filesystem module is open -* -@tbrief -1. create one directory ; -2. check directory presence and permissions; -3. delete the directory; -4. N/A; -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A; -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs107(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_107", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_116.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_116.cpp deleted file mode 100644 index 450ed8a5..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_116.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/118.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, 0); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_116 -* -@tspec The Function test for open -* -@ttitle Create a file with permission 0 and open an existing file -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file with permission 0 and open an existing file ; -2. read and write the file; -3. delete the file; -4. N/A -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs116(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_116", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_117.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_117.cpp deleted file mode 100644 index 67e5d3d4..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_117.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/119.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRUSR | S_IRGRP | S_IROTH); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_117 -* -@tspec The Function test for open -* -@ttitle Create a file with permission 0x444 and open an existing file -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file with permission 0x444 and open an existing file ; -2. read and write the file; -3. delete the file; -4. N/A -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs117(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_117", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_118.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_118.cpp deleted file mode 100644 index cc334f75..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_118.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/120.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, 0x222); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_118 -* -@tspec The Function test for open -* -@ttitle Create a file with permission 0x222 and open an existing file -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file with permission 0x222 and open an existing file ; -2. read and write the file; -3. delete the file; -4. N/A -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs118(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_118", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_119.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_119.cpp deleted file mode 100644 index 15e4b31c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_119.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/121.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, 0x111); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_119 -* -@tspec The Function test for open -* -@ttitle Create a file with permission 0x111 and open an existing file -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file with permission 0x111 and open an existing file ; -2. read and write the file; -3. delete the file; -4. N/A -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs119(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_119", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_120.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_120.cpp deleted file mode 100644 index 7b7b9336..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_120.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/122.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, 0x177); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_120 -* -@tspec The Function test for open -* -@ttitle Create a file with permission 0x177 and open an existing file -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file with permission 0x177 and open an existing file ; -2. read and write the file; -3. delete the file; -4. N/A -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs120(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_120", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_121.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_121.cpp deleted file mode 100644 index 3dda0b0d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_121.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/123.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, 0x277); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_121 -* -@tspec The Function test for open -* -@ttitle Create a file with permission 0x277 and open an existing file -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file with permission 0x277 and open an existing file ; -2. read and write the file; -3. delete the file; -4. N/A -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs121(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_121", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_122.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_122.cpp deleted file mode 100644 index f3d140fb..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_122.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = access(pathname1, F_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, 10); // 10 means access len - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, -1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = access(pathname1, 0xffff); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_122 -* -@tspec The API test for access -* -@ttitle Access parameter (mode) exception test -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file ; -2. access parameter (mode) exception test; -3. delete the file; -4. N/A -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs122(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_122", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_123.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_123.cpp deleted file mode 100644 index 43338b76..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_123.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH - 1, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_123 -* -@tspec The API test for write -* -@ttitle The length of the write data is 0xffff -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file ; -2. the length of the write data is 0xffff; -3. delete the file; -4. N/A -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs123(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_123", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_124.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_124.cpp deleted file mode 100644 index 97e06f75..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_124.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufbuf[10] = { 0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1124"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs124(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_124", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_125.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_125.cpp deleted file mode 100644 index 31a00f71..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_125.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[15] = "0123456789"; - CHAR readbuf[30] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1125.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, 20); // 20 means write len - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT1); // 20 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 25); // 25 means write len - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT1); // 20 means write len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs125(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_125", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_126.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_126.cpp deleted file mode 100644 index 558ae749..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_126.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1111111111"; - CHAR readbuf[20] = "liteosliteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1110"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteosliteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1111111111os", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs126(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_126", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_127.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_127.cpp deleted file mode 100644 index f62b3d67..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_127.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "111111111122222"; - CHAR readbuf[20] = "liteosliteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1111"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteosliteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1111111111os", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs127(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_127", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_128.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_128.cpp deleted file mode 100644 index 1ca63b9f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_128.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1111111111"; - CHAR readbuf[20] = "liteosliteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1112"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteosliteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 15); // 15 means read len - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1111111111os", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs128(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_128", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_129.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_129.cpp deleted file mode 100644 index 59473931..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_129.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[11] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1113"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs129(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_129", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_130.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_130.cpp deleted file mode 100644 index 75d4d169..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_130.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[20] = "liteosliteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1114"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteosliteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 15); // 15 means read len - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcdeos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs130(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_130", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_131.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_131.cpp deleted file mode 100644 index 97469a5c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_131.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufbuf[10] = { 0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1115"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 0xffff); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs131(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_131", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_132.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_132.cpp deleted file mode 100644 index 5eac0fa2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_132.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1122.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, NULL, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs132(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_132", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_133.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_133.cpp deleted file mode 100644 index d0a87a65..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_133.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1123.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs133(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_133", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_134.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_134.cpp deleted file mode 100644 index 2cb9b3d2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_134.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufbuf[10] = { 0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1124"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs134(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_134", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_135.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_135.cpp deleted file mode 100644 index dcc52ce4..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_135.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[15] = "0123456789"; - CHAR readbuf[30] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1125.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, 20); // 20 means write len - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT1); // 20 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 25); // 25 means read len - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT1); // 20 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs135(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_135", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_136.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_136.cpp deleted file mode 100644 index b6aafdf5..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_136.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[25] = "01234567890123456789"; - CHAR readbuf[25] = "liteosliteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1126.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteosliteos", readbuf, EXIT1); - - len = write(fd, filebuf, 15); // 15 means write len - ICUNIT_GOTO_EQUAL(len, 15, len, EXIT1); // 15 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 15, len, EXIT1); // 15 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "012345678901234", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs136(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_136", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_137.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_137.cpp deleted file mode 100644 index f8a1cd13..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_137.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[20] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1127.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, 10); // 10 means write len - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 15); // 15 means read len - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs137(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_137", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_138.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_138.cpp deleted file mode 100644 index ecf505a9..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_138.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1134.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek(fd, -1, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, -1, off, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - off = lseek(fd, -10, SEEK_CUR); // -10 means seek back len - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs138(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_138", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_139.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_139.cpp deleted file mode 100644 index 66c2b327..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_139.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1135.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0xffff, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0xffff, off, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs139(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_139", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_140.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_140.cpp deleted file mode 100644 index f8bb4f5a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_140.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1136.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, len, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, len, off, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs140(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_140", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_141.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_141.cpp deleted file mode 100644 index 8dc84f98..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_141.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1137.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, (len + 2), SEEK_SET); // 2 means seek len - ICUNIT_GOTO_EQUAL(off, (len + 2), off, EXIT1); // 2 means seek len - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs141(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_141", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_142.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_142.cpp deleted file mode 100644 index 8435b820..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_142.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1138.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, -1, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 9, off, EXIT1); // 9 means current file position - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "eiteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs142(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_142", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_143.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_143.cpp deleted file mode 100644 index 1d750cc6..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_143.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1139.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT1); // 10 means current file position - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs143(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_143", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_144.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_144.cpp deleted file mode 100644 index 2a83e7fc..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_144.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1140.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0xffff, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 0x10009, off, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs144(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_144", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_145.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_145.cpp deleted file mode 100644 index a269f833..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_145.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1141.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, len, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 0x14, off, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs145(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_145", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_146.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_146.cpp deleted file mode 100644 index 9048bb06..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_146.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1142.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, (len + 2), SEEK_CUR); // 2 means seek len - ICUNIT_GOTO_EQUAL(off, (len + len + 2), off, EXIT1); // 2 means seek len - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs146(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_146", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_147.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_147.cpp deleted file mode 100644 index 49af0405..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_147.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1143.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT1); // 10 means current file position - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs147(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_147", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_148.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_148.cpp deleted file mode 100644 index 240a3f7c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_148.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1144.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, -1, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 9, off, EXIT1); // 9 means current position - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT1); // 1 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "9iteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs148(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_148", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_149.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_149.cpp deleted file mode 100644 index 932a1075..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_149.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1145.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0xffff, SEEK_END); - ICUNIT_GOTO_EQUAL(off, (0xffff + 10), off, EXIT1); // 10 means seek len - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs149(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_149", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_150.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_150.cpp deleted file mode 100644 index 5fd4ed03..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_150.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1146.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, len, SEEK_END); - ICUNIT_GOTO_EQUAL(off, (len + len), off, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs150(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_150", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_151.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_151.cpp deleted file mode 100644 index 6757eb3b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_151.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1147.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, (len + 2), SEEK_END); // 2 means seek len - ICUNIT_GOTO_EQUAL(off, (len + len + 2), off, EXIT1); // 2 means seek len - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs151(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_151", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_152.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_152.cpp deleted file mode 100644 index 64f4458f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_152.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1147.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, -1); - ICUNIT_GOTO_EQUAL(off, -1, off, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs152(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_152", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_153.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_153.cpp deleted file mode 100644 index aebd6df8..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_153.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1147.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, 0xffff); - ICUNIT_GOTO_EQUAL(off, -1, off, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs153(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_153", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_154.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_154.cpp deleted file mode 100644 index e00a84f4..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_154.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, sizeof(pathname1), "1150xt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, 10); // 10 means seek len - ICUNIT_GOTO_EQUAL(off, -1, off, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs154(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_154", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_155.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_155.cpp deleted file mode 100644 index a989152d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_155.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink("//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs155(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_155", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_156.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_156.cpp deleted file mode 100644 index 9e742836..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_156.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink("/"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs156(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_156", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_157.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_157.cpp deleted file mode 100644 index ab77af9f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_157.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink("aaaaa"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs157(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_157", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_158.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_158.cpp deleted file mode 100644 index 01d764c8..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_158.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink("+-/*%^@"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs158(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_158", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_159.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_159.cpp deleted file mode 100644 index f9531d96..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_159.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink(""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs159(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_159", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_160.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_160.cpp deleted file mode 100644 index f6340e51..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_160.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink(".."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EISDIR, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs160(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_160", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_161.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_161.cpp deleted file mode 100644 index a58bb29c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_161.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink("."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs161(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_161", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_162.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_162.cpp deleted file mode 100644 index 809c6c11..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_162.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink("''"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs162(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_162", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_163.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_163.cpp deleted file mode 100644 index d3d2f2b7..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_163.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EISDIR, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs163(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_163", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_164.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_164.cpp deleted file mode 100644 index b8419c50..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_164.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, sizeof(pathname2), "/"); - (void)strcat_s(pathname2, sizeof(pathname2), pathname3); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs164(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_164", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_165.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_165.cpp deleted file mode 100644 index 43912f3a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_165.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs165(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_165", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_166.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_166.cpp deleted file mode 100644 index b31a27c2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_166.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, sizeof(pathname2), "/abc.txt"); - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs166(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_166", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_167.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_167.cpp deleted file mode 100644 index 9cbc8fb1..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_167.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open("//", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - - (void)strcat_s(pathname2, sizeof(pathname2), "//"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - goto EXIT; -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs167(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_167", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_168.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_168.cpp deleted file mode 100644 index c5b3a88f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_168.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open("/", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - - (void)strcat_s(pathname2, sizeof(pathname2), "/"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - goto EXIT; -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs168(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_168", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_169.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_169.cpp deleted file mode 100644 index 9f861f62..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_169.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open("aaaaa", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink("aaaaa"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove("aaaaa"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs169(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_169", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_170.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_170.cpp deleted file mode 100644 index 43971180..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_170.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open("+-", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/+-"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs170(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_170", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_171.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_171.cpp deleted file mode 100644 index cf8ac38f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_171.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open("", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - - ret = strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/"""); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - goto EXIT; -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs171(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_171", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_172.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_172.cpp deleted file mode 100644 index 6118c0b3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_172.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open("..", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - - ret = strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/.."); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - goto EXIT; -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs172(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_172", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_173.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_173.cpp deleted file mode 100644 index 9faa5bc1..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_173.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(".", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - - ret = strcat_s(pathname2, sizeof(pathname2), "/."); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - remove("."); - goto EXIT; -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs173(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_173", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_174.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_174.cpp deleted file mode 100644 index cbf8c53b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_174.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 fd3 = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd1 = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - (void)memset_s(pathname4, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/"); - ret = strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd2 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT3); - - ret = strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, pathname4); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - - fd3 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd3, -1, fd3, EXIT4); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd3); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT4: - close(fd3); - goto EXIT1; -EXIT3: - close(fd2); - goto EXIT1; -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname2, pathname4, strlen(pathname2)); - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs174(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_174", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_175.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_175.cpp deleted file mode 100644 index 73baf8b8..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_175.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open("""", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - - fd = open("/""""", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - - ret = strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/"""""); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - goto EXIT; -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs175(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_175", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_176.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_176.cpp deleted file mode 100644 index 927af185..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_176.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test_1176.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs176(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_176", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_177.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_177.cpp deleted file mode 100644 index f2ddd455..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_177.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs177(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_177", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_178.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_178.cpp deleted file mode 100644 index fc1d5011..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_178.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "ABCDE"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1178.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd1 = open(pathname1, O_NONBLOCK | O_NOCTTY | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT3); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT3: - close(fd1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs178(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_178", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_179.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_179.cpp deleted file mode 100644 index 305d89ce..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_179.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1179.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd1 = open(pathname1, O_NONBLOCK | O_SYNC | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT3); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT3: - close(fd1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs179(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_179", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_180.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_180.cpp deleted file mode 100644 index 1faa5d17..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_180.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, sizeof(pathname1), "/1180.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd1 = open(pathname1, O_NONBLOCK | O_ASYNC | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT3: - close(fd1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs180(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_180", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_182.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_182.cpp deleted file mode 100644 index 17e79cdc..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_182.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, sizeof(pathname1), "/1182.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd1 = open(pathname1, O_NONBLOCK | O_NOFOLLOW | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT3: - close(fd1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs182(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_182", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_183.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_183.cpp deleted file mode 100644 index 1b3640b3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_183.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1183.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd1 = open(pathname1, O_NONBLOCK | O_DIRECT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT3: - close(fd1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs183(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_183", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_184.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_184.cpp deleted file mode 100644 index 312efdc0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_184.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1184.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd1 = open(pathname1, O_NONBLOCK | O_NOATIME | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT3: - close(fd1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs184(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_184", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_185.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_185.cpp deleted file mode 100644 index 511297a6..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_185.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, sizeof(pathname1), "/1185.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd1 = open(pathname1, O_NONBLOCK | O_CLOEXEC | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT3: - close(fd1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs185(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_185", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_187.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_187.cpp deleted file mode 100644 index 3b2bef77..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_187.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1187.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd1 = open(pathname1, O_NONBLOCK | (-1) | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd1, -1, fd1, EXIT3); - ICUNIT_GOTO_EQUAL(errno, ENOTDIR, errno, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT3: - close(fd1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs187(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_187", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_188.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_188.cpp deleted file mode 100644 index 7e3522f2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_188.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir("aaaaa", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir("aaaaa"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir("aaaaa"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs188(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_188", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_189.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_189.cpp deleted file mode 100644 index e08359c9..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_189.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir("+-/*%^@", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = rmdir("+-/*%^@"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir("+-/*%^@"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs189(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_189", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_190.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_190.cpp deleted file mode 100644 index c7c321c6..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_190.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir("", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir("+-/*%^@"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs190(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_190", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_191.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_191.cpp deleted file mode 100644 index c6a61c4c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_191.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir("..", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(".."); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs191(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_191", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_192.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_192.cpp deleted file mode 100644 index a27475b6..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_192.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(".", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir("."); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs192(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_192", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_193.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_193.cpp deleted file mode 100644 index 8479df33..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_193.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname3); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs193(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_193", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_194.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_194.cpp deleted file mode 100644 index 03251395..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_194.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat("/", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove("/"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs194(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_194", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_195.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_195.cpp deleted file mode 100644 index 1727734e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_195.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat("//", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove("//"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs195(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_195", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_196.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_196.cpp deleted file mode 100644 index 2e99f6ff..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_196.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat("aaaaa", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove("aaaaa"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove("aaaaa"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs196(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_196", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_197.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_197.cpp deleted file mode 100644 index dbfb2257..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_197.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat("+-/*%^@", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove("+-/*%^@"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs197(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_197", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_198.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_198.cpp deleted file mode 100644 index 3d93e8cc..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_198.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat("", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove(""); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs198(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_198", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_199.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_199.cpp deleted file mode 100644 index ed3d413a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_199.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat("..", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove(".."); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs199(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_199", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_200.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_200.cpp deleted file mode 100644 index 4c259181..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_200.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat(".", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove("."); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs200(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_200", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_201.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_201.cpp deleted file mode 100644 index 561ae7fc..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_201.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static const int PARAM_NUM = 2; -static int Dup2Test(void) -{ - int ret = 0; - int number1, number2, sum; - int savedStdin = -1; - int savedStdout = -1; - - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/input.txt"); - - int inputFds = open(pathname, O_CREAT | O_RDWR, S_IRWXU); - ICUNIT_GOTO_NOT_EQUAL(inputFds, -1, inputFds, EXIT); - - savedStdin = dup(STDIN_FILENO); - savedStdout = dup(STDOUT_FILENO); - - setbuf(stdout, NULL); - setbuf(stdin, NULL); - - ret = dup2(inputFds, STDIN_FILENO); - ICUNIT_GOTO_EQUAL(ret, STDIN_FILENO, ret, EXIT); - - ret = dup2(inputFds, STDOUT_FILENO); - ICUNIT_GOTO_EQUAL(ret, STDOUT_FILENO, ret, EXIT); - - /* STDIN_FILENO STDOUT_FILENO all be directed */ - printf("1 1\n"); - lseek(inputFds, 0, SEEK_SET); - ret = scanf_s("%d %d", &number1, &number2); - ICUNIT_GOTO_EQUAL(ret, PARAM_NUM, ret, EXIT); - - sum = number1 + number2; - -EXIT: - close(inputFds); - dup2(savedStdin, STDIN_FILENO); - dup2(savedStdout, STDOUT_FILENO); - close(savedStdin); - close(savedStdout); - unlink(pathname); - return sum; -} - -const int DUP_TEST_RET = 2; - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = Dup2Test(); - ICUNIT_GOTO_EQUAL(ret, DUP_TEST_RET, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs201(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_201", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_202.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_202.cpp deleted file mode 100644 index 2d78caaf..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_202.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat("""", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove(""""); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs202(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_202", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_203.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_203.cpp deleted file mode 100644 index b2197251..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_203.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir("""", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(""""); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs203(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_203", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_204.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_204.cpp deleted file mode 100644 index 12af9ddf..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_204.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd1 = -1; - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - fd1 = creat(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); /* pathname1 already open, cannot creat */ - ICUNIT_GOTO_NOT_EQUAL(fd1, 0, fd1, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs204(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_204", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_205.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_205.cpp deleted file mode 100644 index ba6c6bcb..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_205.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs205(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_205", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_206.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_206.cpp deleted file mode 100644 index 6804fcac..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_206.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufbuf[10] = { 0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "1208"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT); - - len = read(fd, NULL, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs206(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_206", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_207.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_207.cpp deleted file mode 100644 index cc62c293..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_207.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname2, sizeof(pathname2), "/aaaaa"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = access(NULL, F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT1); - - ret = access(0, F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT1); - - ret = access("//", F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = access("/", F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = access("aaaaaa", F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = access("+-/*%^@", F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = access("", F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = access("..", F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = access(".", F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = access("""", F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove(pathname2); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs207(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_207", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_208.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_208.cpp deleted file mode 100644 index 4c879b46..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_208.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/jffs_1239.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs208(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_208", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_209.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_209.cpp deleted file mode 100644 index 4a5d45f8..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_209.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static const int DUP_WRONG_FD = 256; -static const int DUP_WRONG_FD2 = 250; - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 pfd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1127.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - pfd = dup2(CONFIG_NFILE_DESCRIPTORS, fd); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - - pfd = dup2(DUP_WRONG_FD, fd); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - - pfd = dup2(DUP_WRONG_FD2, fd); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - - pfd = dup2(0xffff, fd); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - - pfd = dup2(CONFIG_NFILE_DESCRIPTORS - 1, fd); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - - pfd = dup2(-1, fd); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(pfd); -EXIT2: - close(fd); -EXIT1: - unlink(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs209(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_209", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_210.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_210.cpp deleted file mode 100644 index 7d9a3532..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_210.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 pfd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1128.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - pfd = dup2(fd, CONFIG_NFILE_DESCRIPTORS); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT3); - - pfd = dup2(fd, CONFIG_NFILE_DESCRIPTORS); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT3); - - pfd = dup2(fd, CONFIG_NFILE_DESCRIPTORS + 1); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT3); - - pfd = dup2(fd, 0xffff); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT3); - - pfd = dup2(fd, -1); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(pfd); -EXIT2: - close(fd); -EXIT1: - unlink(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs210(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_210", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_211.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_211.cpp deleted file mode 100644 index b208de0f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_211.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static const int DUP_FD1 = 256; -static const int DUP_FD2 = 250; - -static UINT32 TestCase(VOID) -{ - INT32 pfd = -1; - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pfd = dup2(CONFIG_NFILE_DESCRIPTORS, CONFIG_NFILE_DESCRIPTORS); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT1); - - pfd = dup2(DUP_FD1, DUP_FD1); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT1); - pfd = dup2(DUP_FD2, DUP_FD2); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT1); - - pfd = dup2(0xffff, 0xffff); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT1); - - pfd = dup2(CONFIG_NFILE_DESCRIPTORS - 1, CONFIG_NFILE_DESCRIPTORS - 1); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT1); - - pfd = dup2(-1, -1); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(pfd); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs211(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_211", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_212.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_212.cpp deleted file mode 100644 index 95e0efc9..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_212.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *pret = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pret = getcwd(buf, 0); - ICUNIT_GOTO_EQUAL(pret, NULL, pret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs212(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_212", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_213.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_213.cpp deleted file mode 100644 index 4d02da28..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_213.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[0xff + 2] = ""; - CHAR *pret = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pret = getcwd(buf, 0xff); - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname1, buf, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs213(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_213", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_214.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_214.cpp deleted file mode 100644 index 7a97e2c0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_214.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *pret = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pret = getcwd(buf, 1); - ICUNIT_GOTO_EQUAL(pret, NULL, pret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ERANGE, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs214(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_214", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_215.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_215.cpp deleted file mode 100644 index 6927fc30..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_215.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *pret = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pret = getcwd(buf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(buf, JFFS_PATH_NAME0, buf, EXIT); - - pret = getcwd(buf, 5); // 5 is less than path length - ICUNIT_GOTO_EQUAL(pret, NULL, pret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ERANGE, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs215(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_215", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_216.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_216.cpp deleted file mode 100644 index bbb0bd59..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_216.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_STANDARD_NAME_LENGTH]; - CHAR *pret = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir("//", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir("//"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs216(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_216", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_217.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_217.cpp deleted file mode 100644 index 6a5dfc6f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_217.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_STANDARD_NAME_LENGTH]; - CHAR *pret = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir("/", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir("/"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs217(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_217", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_218.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_218.cpp deleted file mode 100644 index 2a3a92a0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_218.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/aaaaa"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove("aaaaa"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs218(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_218", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_219.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_219.cpp deleted file mode 100644 index 88db7bd0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_219.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove("+-/*%^@"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs219(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_219", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_220.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_220.cpp deleted file mode 100644 index 670686dc..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_220.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove(""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs220(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_220", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_221.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_221.cpp deleted file mode 100644 index cba3e4d9..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_221.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove(".."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs221(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_221", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_222.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_222.cpp deleted file mode 100644 index d44c1aba..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_222.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove("."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs222(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_222", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_223.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_223.cpp deleted file mode 100644 index 0611d05d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_223.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - DIR *dir = NULL; - struct statfs buf1 = {0}; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/"); - ret = strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname3); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs223(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_223", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_224.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_224.cpp deleted file mode 100644 index 4f76cda2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_224.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = {0}; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove(""""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs224(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_224", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_225.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_225.cpp deleted file mode 100644 index 00d5730e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_225.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs225(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_225", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_226.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_226.cpp deleted file mode 100644 index b2da2d7d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_226.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs226(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_226", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_227.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_227.cpp deleted file mode 100644 index 207919ce..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_227.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1241"); - ret = mkdir(pathname2, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs227(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_227", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_228.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_228.cpp deleted file mode 100644 index a5bab8bd..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_228.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1242"); - ret = mkdir(pathname2, 0xffff); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs228(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_228", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_229.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_229.cpp deleted file mode 100644 index 0d057250..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_229.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1243"); - ret = mkdir(pathname2, S_IXUSR | S_IXGRP | S_IXOTH); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs229(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_229", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_230.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_230.cpp deleted file mode 100644 index 0788d60d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_230.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1244"); - - ret = mkdir(pathname2, S_IWUSR | S_IWGRP | S_IWOTH); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs230(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_230", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_231.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_231.cpp deleted file mode 100644 index 523466bb..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_231.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (VOID)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1245"); - - ret = mkdir(pathname2, S_IRUSR | S_IRGRP | S_IROTH); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs231(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_231", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_232.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_232.cpp deleted file mode 100644 index 6fceebd2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_232.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (VOID)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1246"); - - ret = mkdir(pathname2, S_IXUSR | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs232(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_232", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_233.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_233.cpp deleted file mode 100644 index b096a66d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_233.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (VOID)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname1, S_IWUSR | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs233(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_233", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_234.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_234.cpp deleted file mode 100644 index f86dfbbb..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_234.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir("//"); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("//"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs234(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_234", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_235.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_235.cpp deleted file mode 100644 index 883a923e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_235.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir("/"); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("/"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs235(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_235", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_236.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_236.cpp deleted file mode 100644 index eebaff7e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_236.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (VOID)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/aaaaa"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir("aaaaa"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("aaaaa"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs236(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_236", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_237.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_237.cpp deleted file mode 100644 index efa64941..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_237.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir("+-/*%^@"); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("+-/*%^@"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs237(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_237", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_238.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_238.cpp deleted file mode 100644 index 756160d7..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_238.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(""); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(""); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs238(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_238", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_239.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_239.cpp deleted file mode 100644 index bd0d6305..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_239.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(".."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(".."); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs239(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_239", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_240.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_240.cpp deleted file mode 100644 index 8599862f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_240.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir("."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("."); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs240(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_240", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_241.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_241.cpp deleted file mode 100644 index 9bd647a0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_241.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(""""); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("" - ""); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs241(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_241", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_242.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_242.cpp deleted file mode 100644 index d19e41ab..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_242.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (VOID)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOTDIR, errno, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs242(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_242", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_243.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_243.cpp deleted file mode 100644 index 78659959..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_243.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (VOID)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = rmdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("/test"); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs243(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_243", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_244.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_244.cpp deleted file mode 100644 index 932b09a1..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_244.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (VOID)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs244(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_244", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_245.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_245.cpp deleted file mode 100644 index a8d3cd46..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_245.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("//"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs245(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_245", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_246.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_246.cpp deleted file mode 100644 index d71256ab..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_246.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("/"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs246(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_246", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_247.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_247.cpp deleted file mode 100644 index 04b09e4d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_247.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/aaaaa"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir("aaaaa"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("aaaaa"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs247(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_247", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_248.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_248.cpp deleted file mode 100644 index 75a16d14..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_248.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("+-/*%^@"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("+-/*%^@"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs248(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_248", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_249.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_249.cpp deleted file mode 100644 index 3e5efa52..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_249.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(""); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs249(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_249", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_250.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_250.cpp deleted file mode 100644 index 19a401d3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_250.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(".."); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs250(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_250", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_251.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_251.cpp deleted file mode 100644 index 7074031b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_251.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("."); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("."); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs251(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_251", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_252.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_252.cpp deleted file mode 100644 index c2cc1d3a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_252.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/"); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(pathname3); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs252(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_252", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_253.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_253.cpp deleted file mode 100644 index b4507f8f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_253.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(""""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("" - ""); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs253(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_253", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_254.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_254.cpp deleted file mode 100644 index cc951423..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_254.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove("test"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs254(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_254", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_255.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_255.cpp deleted file mode 100644 index 36646599..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_255.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("test"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs255(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_255", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_256.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_256.cpp deleted file mode 100644 index 7976790a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_256.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static const int CAT_TIME = 278; -static const int PATHNAME_LEN = 292; - -static UINT32 TestCase(VOID) -{ - INT32 i = 0; - INT32 fd, ret, len; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "/"); - - while (i < CAT_TIME) { - (void)strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "t"); - i++; - } - ICUNIT_GOTO_EQUAL(strlen(pathname1), PATHNAME_LEN, strlen(pathname1), EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs256(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_256", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_257.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_257.cpp deleted file mode 100644 index ba1577ba..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_257.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir("//"); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs257(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_257", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_258.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_258.cpp deleted file mode 100644 index 25d06741..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_258.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir("/"); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs258(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_258", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_259.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_259.cpp deleted file mode 100644 index 4b53e5a3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_259.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/aaaaa"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir("aaaaa"); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir("aaaaa"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - closedir(dir); -EXIT1: - rmdir("aaaaa"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs259(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_259", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_260.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_260.cpp deleted file mode 100644 index b377358a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_260.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir("+-/*%^@"); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs260(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_260", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_261.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_261.cpp deleted file mode 100644 index c3aa3c1e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_261.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(""); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs261(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_261", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_262.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_262.cpp deleted file mode 100644 index 611ea13e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_262.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(".."); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs262(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_262", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_263.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_263.cpp deleted file mode 100644 index f3cf4a4d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_263.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir("."); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs263(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_263", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_264.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_264.cpp deleted file mode 100644 index 104afe8d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_264.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/"); - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir(pathname3); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - closedir(dir); -EXIT1: - rmdir(pathname3); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs264(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_264", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_265.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_265.cpp deleted file mode 100644 index 3eda7436..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_265.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1287.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dir = opendir(pathname1); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - closedir(dir); -EXIT2: - close(fd); -EXIT1: - rmdir(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs265(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_265", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_266.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_266.cpp deleted file mode 100644 index 36b3b9c2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_266.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - dir = opendir(pathname1); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - closedir(dir); -EXIT1: - rmdir(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs266(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_266", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_267.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_267.cpp deleted file mode 100644 index ef770440..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_267.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static const int CAT_TIME = 280; - -static UINT32 TestCase(VOID) -{ - INT32 i = 0; - INT32 fd, ret, len; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "/test"); - while (i < CAT_TIME) { - i++; - (void)strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "t"); - } - - dir = opendir(pathname1); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT2); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - dir = opendir(pathname1); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - closedir(dir); -EXIT1: - rmdir(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs267(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_267", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_268.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_268.cpp deleted file mode 100644 index 27ce5bb0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_268.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 i = 0; - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1 = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dir1 = dir; - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs268(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_268", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_269.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_269.cpp deleted file mode 100644 index 57637936..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_269.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 i = 0; - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1 = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dir1 = dir; - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs269(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_269", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_270.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_270.cpp deleted file mode 100644 index 3fc9d90e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_270.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 i = 0; - INT32 fd, ret, len; - INT32 offset; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1 = NULL; - struct dirent *ptr = NULL; - - printf("line:%d\n", __LINE__); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - printf("line:%d\n", __LINE__); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - printf("line:%d\n", __LINE__); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - printf("line:%d\n", __LINE__); - - dir1 = dir; - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - printf("line:%d\n", __LINE__); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - printf("line:%d\n", __LINE__); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs270(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_270", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_271.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_271.cpp deleted file mode 100644 index 976f9aa4..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_271.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 i = 0; - INT32 fd, ret, len; - INT32 offset; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1 = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 0, offset, EXIT2); - - seekdir(dir, 0xffff); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT2); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 0, offset, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - closedir(dir); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs271(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_271", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_272.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_272.cpp deleted file mode 100644 index 40ca15e4..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_272.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 i = 0; - INT32 fd, ret, len; - INT32 offset; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1 = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - seekdir(dir, -1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - closedir(dir); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs272(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_272", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_273.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_273.cpp deleted file mode 100644 index 1b019c16..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_273.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static const int SEEK_OFFSET = 10; -static UINT32 TestCase(VOID) -{ - INT32 i = 0; - INT32 fd, ret, len; - INT32 offset; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1 = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - seekdir(dir, SEEK_OFFSET); - - dir1 = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - seekdir(dir, SEEK_OFFSET); - - ptr = readdir(dir1); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT3); - - offset = telldir(dir1); - ICUNIT_GOTO_EQUAL(offset, 1, offset, EXIT3); - - ret = closedir(dir1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - closedir(dir1); -EXIT2: - closedir(dir); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs273(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_273", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_274.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_274.cpp deleted file mode 100644 index 1a5c5c52..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_274.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - INT32 offset; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1 = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 0, offset, EXIT); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs274(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_274", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_275.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_275.cpp deleted file mode 100644 index 7934c148..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_275.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir("//", &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs275(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_275", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_276.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_276.cpp deleted file mode 100644 index c2c4401b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_276.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir("/", &namelist, 0, alphasort); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - JffsScandirFree(namelist, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs276(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_276", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_277.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_277.cpp deleted file mode 100644 index bf7429fc..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_277.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir("+-/*%^@", &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs277(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_277", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_278.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_278.cpp deleted file mode 100644 index 0a8fa06b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_278.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir("", &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs278(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_278", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_279.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_279.cpp deleted file mode 100644 index bc291ee2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_279.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir("..", &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT1); - - JffsScandirFree(namelist, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs279(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_279", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_280.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_280.cpp deleted file mode 100644 index 28074a2f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_280.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - INT32 scandirCount; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - scandirCount = scandir(".", &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 0, scandirCount, EXIT1); - - JffsScandirFree(namelist, scandirCount); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs280(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_280", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_281.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_281.cpp deleted file mode 100644 index ef368b30..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_281.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/aaaaa"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = scandir("aaaaa", &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsScandirFree(namelist, ret); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - free(namelist); -EXIT1: - remove("aaaaa"); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs281(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_281", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_282.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_282.cpp deleted file mode 100644 index cccc3171..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_282.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = scandir(pathname3, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsScandirFree(namelist, ret); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - free(namelist); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs282(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_282", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_283.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_283.cpp deleted file mode 100644 index 6de6b3f4..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_283.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir("""", &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs283(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_283", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_284.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_284.cpp deleted file mode 100644 index ad3615b5..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_284.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1317.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = scandir(pathname2, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - free(namelist); -EXIT2: - close(fd); -EXIT1: - unlink(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs284(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_284", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_285.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_285.cpp deleted file mode 100644 index 6f14bd30..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_285.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = scandir(pathname1, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT3); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - free(namelist); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs285(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_285", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_286.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_286.cpp deleted file mode 100644 index 1defe8ec..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_286.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir(pathname1, NULL, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - free(namelist); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs286(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_286", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_287.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_287.cpp deleted file mode 100644 index 97e25a68..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_287.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir(pathname1, 0, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs287(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_287", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_288.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_288.cpp deleted file mode 100644 index ba705b7e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_288.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir(pathname1, &namelist, NULL, alphasort); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsScandirFree(namelist, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs288(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_288", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_289.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_289.cpp deleted file mode 100644 index bad4059e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_289.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir(pathname1, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsScandirFree(namelist, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs289(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_289", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_290.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_290.cpp deleted file mode 100644 index e555bd6b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_290.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static INT32 ScandirFunc01(const struct dirent *ent) -{ - return -1; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir(pathname1, &namelist, ScandirFunc01, alphasort); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsScandirFree(namelist, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs290(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_290", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_291.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_291.cpp deleted file mode 100644 index e8467aea..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_291.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static INT32 ScandirFunc01(const struct dirent *ent) -{ - return 0xffff; -} -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir(pathname1, &namelist, ScandirFunc01, alphasort); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsScandirFree(namelist, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs291(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_291", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_292.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_292.cpp deleted file mode 100644 index 998f415b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_292.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir(pathname1, &namelist, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsScandirFree(namelist, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs292(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_292", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_293.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_293.cpp deleted file mode 100644 index 8b10a679..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_293.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir(pathname1, &namelist, 0, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsScandirFree(namelist, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs293(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_293", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_294.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_294.cpp deleted file mode 100644 index 16e49b0e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_294.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret, len; - struct flock fl = { 0 }; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1328.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = fcntl(fd, F_GETLK, &fl); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(fl.l_type, 0, fl.l_type, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs294(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_294", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_295.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_295.cpp deleted file mode 100644 index b9060f71..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_295.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat("//", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - JffsStatPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs295(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_295", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_296.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_296.cpp deleted file mode 100644 index 047a2902..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_296.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat("/", &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs296(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_296", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_297.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_297.cpp deleted file mode 100644 index cd8188ae..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_297.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/aaaaa"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = stat("aaaaa", &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(buf1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - close(fd); -EXIT1: - remove("aaaaa"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs297(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_297", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_298.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_298.cpp deleted file mode 100644 index 62aa8461..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_298.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat("+-/*%^@", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs298(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_298", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_299.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_299.cpp deleted file mode 100644 index 27a74d68..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_299.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat("", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs299(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_299", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_300.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_300.cpp deleted file mode 100644 index 58d86902..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_300.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat("..", &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs300(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_300", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_301.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_301.cpp deleted file mode 100644 index 42c203ab..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_301.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(".", &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs301(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_301", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_302.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_302.cpp deleted file mode 100644 index 8d82f8b8..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_302.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/"); - ret = strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = stat(pathname3, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(buf1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - close(fd); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs302(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_302", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_303.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_303.cpp deleted file mode 100644 index e4d0abf2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_303.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat("""", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs303(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_303", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_304.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_304.cpp deleted file mode 100644 index fcc003fd..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_304.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = stat(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - JffsStatPrintf(buf1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs304(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_304", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_305.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_305.cpp deleted file mode 100644 index 7db64b2a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_305.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - - ret = stat(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs305(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_305", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_306.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_306.cpp deleted file mode 100644 index 36cd2022..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_306.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs306(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_306", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_307.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_307.cpp deleted file mode 100644 index d632e690..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_307.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs307(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_307", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_308.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_308.cpp deleted file mode 100644 index 8b490fe0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_308.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/jffs_1350.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = fstat(fd, &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs308(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_308", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_309.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_309.cpp deleted file mode 100644 index 213ca066..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_309.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1351.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs309(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_309", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_310.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_310.cpp deleted file mode 100644 index 22645118..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_310.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1352.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs310(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_310", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_311.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_311.cpp deleted file mode 100644 index 00bf2336..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_311.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = statfs("//", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs311(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_311", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_312.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_312.cpp deleted file mode 100644 index 8b1ed9fe..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_312.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = statfs("/", &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs312(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_312", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_313.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_313.cpp deleted file mode 100644 index 68f10507..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_313.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/aaaaa"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = statfs("aaaaa", &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - JffsStatfsPrintf(buf1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs313(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_313", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_314.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_314.cpp deleted file mode 100644 index c5eb2704..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_314.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = statfs("+-/*%^@", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs314(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_314", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_315.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_315.cpp deleted file mode 100644 index 346e5f54..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_315.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = statfs("", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs315(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_315", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_316.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_316.cpp deleted file mode 100644 index d8f50019..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_316.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = statfs("..", &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatfsPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs316(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_316", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_317.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_317.cpp deleted file mode 100644 index a2f24bae..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_317.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = statfs(".", &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatfsPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs317(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_317", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); - -#ifdef __cpluscplus -#if __cplusplus -} -#endif -#endif -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_318.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_318.cpp deleted file mode 100644 index df04584d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_318.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/"); - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = statfs(pathname3, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - JffsStatfsPrintf(buf1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs318(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_318", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_319.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_319.cpp deleted file mode 100644 index 3d8265b0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_319.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - - ret = statfs("""", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs319(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_319", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_320.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_320.cpp deleted file mode 100644 index 370a0432..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_320.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1364.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - JffsStatfsPrintf(buf1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - JffsStatfsPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs320(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_320", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_321.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_321.cpp deleted file mode 100644 index aafc7231..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_321.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1365.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs321(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_321", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_322.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_322.cpp deleted file mode 100644 index 45b2326b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_322.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 pfd, ret, len; - INT32 flags; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1373.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - pfd = fcntl(fd, F_DUPFD, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_NOT_EQUAL(pfd, -1, pfd, EXIT3); - - flags |= O_NONBLOCK | O_RDWR; - ret = fcntl(fd, F_SETFL, flags); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = close(pfd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT3: - close(pfd); -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs322(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_322", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_323.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_323.cpp deleted file mode 100644 index d2a6177d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_323.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static const int ILLEGAL_FD = -10; - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 flags; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1374.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - flags = fcntl(fd, F_DUPFD, ILLEGAL_FD); - ICUNIT_GOTO_EQUAL(flags, -1, flags, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT3); - - flags |= O_NONBLOCK | O_RDWR; - flags = fcntl(fd, F_SETFL, flags); - ICUNIT_GOTO_EQUAL(flags, 0, flags, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT3: - close(flags); -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs323(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_323", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_324.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_324.cpp deleted file mode 100644 index 4fc41913..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_324.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 flags; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1375.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - flags = fcntl(fd, F_DUPFD, 0xffff); - ICUNIT_GOTO_EQUAL(flags, -1, flags, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - flags |= O_NONBLOCK | O_RDWR; - flags = fcntl(fd, F_SETFL, flags); - ICUNIT_GOTO_EQUAL(flags, 0, flags, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - close(flags); -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs324(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_324", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_325.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_325.cpp deleted file mode 100644 index 360637e0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_325.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 flags; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1376.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - flags = fcntl(fd, F_DUPFD, 0xffff); - ICUNIT_GOTO_EQUAL(flags, -1, flags, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - flags |= O_NONBLOCK | O_RDWR; - flags = fcntl(fd, F_SETFL, flags); - ICUNIT_GOTO_EQUAL(flags, 0, flags, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT3: - close(flags); -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs325(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_325", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_326.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_326.cpp deleted file mode 100644 index 6249a04b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_326.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 flags; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/495.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - flags = fcntl(fd, F_SETOWN, &fl); - ICUNIT_GOTO_EQUAL(flags, -1, flags, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs326(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_326", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_327.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_327.cpp deleted file mode 100644 index 9556cc97..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_327.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 flags; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/496.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - flags = fcntl(fd, 0xffff, &fl); - ICUNIT_GOTO_EQUAL(flags, -1, flags, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs327(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_327", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_328.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_328.cpp deleted file mode 100644 index 8412d676..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_328.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 flags; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount("s-s_s-s_s", JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs328(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_328", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_329.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_329.cpp deleted file mode 100644 index dd5d7ff0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_329.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 flags; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount("//", JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs329(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_329", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_330.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_330.cpp deleted file mode 100644 index 52788b08..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_330.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 flags; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount("/", JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs330(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_330", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_331.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_331.cpp deleted file mode 100644 index 5da9b478..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_331.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR filebuf[301] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij" - "9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789" - "abcedfghij9876543210abcdeabcde0123456789abcedfghij987654321011111111112222222222"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(filebuf, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs331(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_331", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_332.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_332.cpp deleted file mode 100644 index 3646c3e7..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_332.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount("+-*%^@", JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs332(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_332", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_333.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_333.cpp deleted file mode 100644 index 37e73226..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_333.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount("", JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs333(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_333", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_334.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_334.cpp deleted file mode 100644 index 144d657d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_334.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount("..", JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs334(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_334", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_335.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_335.cpp deleted file mode 100644 index f9efe545..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_335.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(".", JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs335(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_335", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_336.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_336.cpp deleted file mode 100644 index fc0d592a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_336.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(pathname3, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - remove(pathname3); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs336(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_336", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_337.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_337.cpp deleted file mode 100644 index 06c7b65b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_337.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(pathname1, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs337(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_337", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_338.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_338.cpp deleted file mode 100644 index be25d214..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_338.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount("""", JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs338(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_338", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_339.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_339.cpp deleted file mode 100644 index 1f7eeee0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_339.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1388"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(pathname1, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(pathname1, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT3: - close(fd); -EXIT2: - remove(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname1); - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs339(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_339", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_340.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_340.cpp deleted file mode 100644 index a3b6d6ab..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_340.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mount(pathname1, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(pathname1, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs340(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_340", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_342.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_342.cpp deleted file mode 100644 index 264afaf4..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_342.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, "//", JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = umount("//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = rmdir("//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount("//"); - rmdir("//"); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs342(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_342", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_343.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_343.cpp deleted file mode 100644 index d833b7ef..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_343.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, "/", JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = umount("/"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = rmdir("/"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount("/"); - rmdir("/"); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs343(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_343", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_344.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_344.cpp deleted file mode 100644 index 25552d6e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_344.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR filebuf[302] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij" - "9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789" - "abcedfghij9876543210abcdeabcde0123456789abcedfghij987654321011111111112222222222"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, filebuf, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = umount(filebuf); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = rmdir(filebuf); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(filebuf); - rmdir(filebuf); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs344(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_344", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_346.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_346.cpp deleted file mode 100644 index 91feb05e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_346.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, "", JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(""); - rmdir(""); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs346(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_346", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_352.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_352.cpp deleted file mode 100644 index d78b5e7a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_352.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, "s-s_s-s_s", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs352(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_352", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_353.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_353.cpp deleted file mode 100644 index bd689d7c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_353.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, "//", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs353(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_353", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_354.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_354.cpp deleted file mode 100644 index 332b52a6..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_354.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, "/", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs354(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_354", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_355.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_355.cpp deleted file mode 100644 index 01d9478b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_355.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR filebuf[302] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij" - "9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789" - "abcedfghij9876543210abcdeabcde0123456789abcedfghij987654321011111111112222222222"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, filebuf, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs355(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_355", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_356.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_356.cpp deleted file mode 100644 index 5f3e0638..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_356.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, "+-/*%^@", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs356(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_356", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_357.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_357.cpp deleted file mode 100644 index 534833a3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_357.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, "", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs357(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_357", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_358.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_358.cpp deleted file mode 100644 index cbfd03d0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_358.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, "..", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs358(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_358", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_359.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_359.cpp deleted file mode 100644 index e33c9dc5..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_359.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, ".", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs359(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_359", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_360.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_360.cpp deleted file mode 100644 index 47d8dd2c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_360.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, ".", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs360(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_360", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_361.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_361.cpp deleted file mode 100644 index 5be33aa0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_361.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, """", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs361(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_361", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_362.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_362.cpp deleted file mode 100644 index 5e828b75..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_362.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_MAIN_DIR0, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs362(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_362", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_364.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_364.cpp deleted file mode 100644 index e4cf6ba2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_364.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0xffff, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs364(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_364", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_365.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_365.cpp deleted file mode 100644 index 1fdeb1f3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_365.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0xffffffff, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs365(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_365", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_366.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_366.cpp deleted file mode 100644 index 12e66729..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_366.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount("s-s_s-s_s"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs366(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_366", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_367.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_367.cpp deleted file mode 100644 index b7f3c486..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_367.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount("//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs367(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_367", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_368.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_368.cpp deleted file mode 100644 index 9b7692eb..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_368.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount("/"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - printf("%s-%d \n", __FUNCTION__, __LINE__); - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - printf("%s-%d \n", __FUNCTION__, __LINE__); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs368(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_368", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_369.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_369.cpp deleted file mode 100644 index 290ff834..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_369.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR filebuf[302] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij" - "9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789" - "abcedfghij9876543210abcdeabcde0123456789abcedfghij987654321011111111112222222222"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(filebuf); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs369(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_369", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_370.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_370.cpp deleted file mode 100644 index cada2014..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_370.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount("+-/*%^@"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs370(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_370", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_371.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_371.cpp deleted file mode 100644 index 4571a882..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_371.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs371(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_371", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_372.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_372.cpp deleted file mode 100644 index 61a10278..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_372.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs372(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_372", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_373.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_373.cpp deleted file mode 100644 index 2697d68e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_373.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = umount("."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs373(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_373", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_374.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_374.cpp deleted file mode 100644 index fd3cf8e7..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_374.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = umount(""""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs374(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_374", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_375.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_375.cpp deleted file mode 100644 index 2242bf16..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_375.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = umount(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs375(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_375", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_376.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_376.cpp deleted file mode 100644 index 0f31a0d5..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_376.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = umount(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs376(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_376", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_377.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_377.cpp deleted file mode 100644 index fa8d8abe..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_377.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename("s-s_s-s_s", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - strcat(pathname1, "/test"); - ret = rename("s-s_s-s_s", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove("s-s_s-s_s"); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs377(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_377", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_378.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_378.cpp deleted file mode 100644 index b1c1ddba..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_378.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename("//", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - strcat(pathname1, "/test"); - ret = rename("//", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove("//"); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs378(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_378", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_379.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_379.cpp deleted file mode 100644 index f31fd019..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_379.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename("/", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - strcat(pathname1, "/test"); - ret = rename("/", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove("/"); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs379(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_379", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_380.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_380.cpp deleted file mode 100644 index 7a269f6b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_380.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR filebuf[302] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij" - "9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789" - "abcedfghij9876543210abcdeabcde0123456789abcedfghij987654321011111111112222222222"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(filebuf, pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - strcat(pathname1, "/test"); - ret = rename(filebuf, pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove(filebuf); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs380(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_380", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_381.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_381.cpp deleted file mode 100644 index 315cb4b0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_381.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename("+-/*%^@", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - strcat(pathname1, "/test"); - ret = rename("+-/*%^@", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove("+-/*%^@"); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs381(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_381", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_382.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_382.cpp deleted file mode 100644 index a7aa4e75..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_382.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename("+-*%^@", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - strcat(pathname1, "/test"); - ret = rename("+-*%^@", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove("+-*%^@"); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs382(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_382", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_383.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_383.cpp deleted file mode 100644 index e8f05fdb..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_383.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename("", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - strcat(pathname1, "/test"); - ret = rename("", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove(""); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs383(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_383", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_384.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_384.cpp deleted file mode 100644 index 6b8cdef3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_384.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename("..", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - strcat(pathname1, "/test"); - ret = rename("..", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - remove(pathname1); - goto EXIT; -EXIT1: - remove(".."); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs384(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_384", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_385.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_385.cpp deleted file mode 100644 index c81660a2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_385.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(".", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - strcat(pathname1, "/test"); - ret = rename(".", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBUSY, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - remove(pathname1); -EXIT1: - remove("."); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs385(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_385", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_386.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_386.cpp deleted file mode 100644 index f6628f73..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_386.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename("" - "", - pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - strcat(pathname1, "/test"); - ret = rename("" - "", - pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove("" - ""); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs386(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_386", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_387.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_387.cpp deleted file mode 100644 index d9600a6e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_387.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname3, "/1436"); - ret = rename(pathname3, pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rename(pathname3, pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = remove(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs387(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_387", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_388.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_388.cpp deleted file mode 100644 index 7ce56296..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_388.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR filebuf[302] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij" - "9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789" - "abcedfghij9876543210abcdeabcde0123456789abcedfghij987654321011111111112222222222"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, filebuf); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(filebuf); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs388(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_388", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_389.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_389.cpp deleted file mode 100644 index 3c5cbf9b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_389.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, pathname3); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs389(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_389", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_390.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_390.cpp deleted file mode 100644 index a02e0729..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_390.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname3, "/1439"); - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rename(pathname1, pathname3); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = remove(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs390(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_390", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_391.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_391.cpp deleted file mode 100644 index f0ce7d94..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_391.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname3, "/1440"); - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rename(pathname1, pathname3); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = remove(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs391(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_391", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_392.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_392.cpp deleted file mode 100644 index a3bbf3fb..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_392.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname3, "/1441"); - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - strcat(pathname2, "/test1441"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rename(pathname2, pathname3); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(fd); -EXIT2: - remove(pathname2); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs392(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_392", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_393.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_393.cpp deleted file mode 100644 index 29421f15..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_393.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname3, "/1442"); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - strcat(pathname2, "/test1442"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rename(pathname2, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - remove(pathname2); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs393(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_393", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_394.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_394.cpp deleted file mode 100644 index b6612b5f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_394.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname3, "/1443"); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - strcat(pathname2, "/test1443"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rename(pathname3, pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - remove(pathname2); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs394(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_394", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_395.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_395.cpp deleted file mode 100644 index 65c6da70..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_395.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - getcwd(readbuf, 20); // cwd max length 20 - ICUNIT_GOTO_STRING_EQUAL(readbuf, pathname1, readbuf, EXIT); - - ret = rename(pathname1, "s-s_s-s_s"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir("s-s_s-s_s"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("s-s_s-s_s"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs395(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_395", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_396.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_396.cpp deleted file mode 100644 index d7911420..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_396.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, "//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir("//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("//"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs396(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_396", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_397.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_397.cpp deleted file mode 100644 index d26c22e3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_397.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, "/"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir("/"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("/"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs397(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_397", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_398.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_398.cpp deleted file mode 100644 index 3ac89a1f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_398.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR filebuf[302] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij" - "9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789" - "abcedfghij9876543210abcdeabcde0123456789abcedfghij987654321011111111112222222222"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, filebuf); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir(filebuf); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(filebuf); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs398(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_398", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_399.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_399.cpp deleted file mode 100644 index 58372fef..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_399.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, "+-/*%^@"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir("+-/*%^@"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("+-/*%^@"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs399(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_399", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_400.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_400.cpp deleted file mode 100644 index eb0a8e9d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_400.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, ""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = rmdir(""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(""); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs400(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_400", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_401.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_401.cpp deleted file mode 100644 index f346a06a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_401.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, ".."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir(".."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(".."); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs401(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_401", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_402.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_402.cpp deleted file mode 100644 index 0c456db3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_402.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, "."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir("."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("."); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs402(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_402", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_403.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_403.cpp deleted file mode 100644 index 8370f4c9..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_403.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, "" - ""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = rmdir("" - ""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("" - ""); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs403(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_403", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_404.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_404.cpp deleted file mode 100644 index 909f6043..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_404.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - struct stat buf1, buf2, buf3; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = utime("s-s_s-s_s", NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat("s-s_s-s_s", &buf2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - JffsStatPrintf(buf2); - - sleep(2); // wait 2s - - ret = utime("s-s_s-s_s", NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs404(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_404", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_405.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_405.cpp deleted file mode 100644 index 008dab46..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_405.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - struct stat buf1, buf2, buf3; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = utime("//", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat("//", &buf2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - JffsStatPrintf(buf2); - - sleep(2); // wait 2s - - ret = utime("//", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs405(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_405", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_406.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_406.cpp deleted file mode 100644 index 3e280818..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_406.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - struct stat buf1, buf2, buf3; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = utime("/", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat("/", &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf2); - - sleep(2); // wait 2s - - ret = utime("/", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs406(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_406", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_407.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_407.cpp deleted file mode 100644 index 1734b166..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_407.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - struct stat buf1, buf2, buf3; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = utime("", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat("", &buf2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - JffsStatPrintf(buf2); - - sleep(2); // wait 2s - - ret = utime("", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs407(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_407", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_408.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_408.cpp deleted file mode 100644 index 897a0dfd..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_408.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - struct stat buf1, buf2, buf3; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = utime("..", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat("..", &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf2); - - sleep(2); // wait 2s - - ret = utime("..", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs408(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_408", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_409.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_409.cpp deleted file mode 100644 index ab99dc46..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_409.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - struct stat buf1, buf2, buf3; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - sleep(2); // wait 2s - - ret = utime(".", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - sleep(2); // wait 2s - - ret = utime(".", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs409(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_409", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_410.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_410.cpp deleted file mode 100644 index 3b4aa4ad..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_410.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - struct stat buf1, buf2, buf3; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - sleep(2); // wait 2s - - ret = utime("" - "", - NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = stat("" - "", - &buf2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - JffsStatPrintf(buf2); - - sleep(2); // wait 2s - - ret = utime("" - "", - NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs410(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_410", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_411.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_411.cpp deleted file mode 100644 index 2fc8eef7..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_411.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct stat buf1, buf2; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = utime(pathname1, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - sleep(2); // wait 2s - - ret = utime(pathname1, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs411(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_411", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_412.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_412.cpp deleted file mode 100644 index a6ae0f38..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_412.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - time_t ttime1; - struct tm tm1; - struct stat buf1, buf2; - - tm1.tm_year = 90; // test number 90 for year - tm1.tm_mon = 1; // test number 1 for mon - tm1.tm_mday = 1; // test number 1 for mday - tm1.tm_hour = 12; // test number 12 for hour - tm1.tm_min = 12; // test number 12 for min - tm1.tm_sec = 12; // test number 12 for sec - ttime1 = mktime(&tm1); - utime1.actime = ttime1; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = utime(pathname1, &utime1); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs412(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_412", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_413.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_413.cpp deleted file mode 100644 index 4aba508e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_413.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct stat buf1, buf2; - struct utimbuf utime1; - time_t ttime1; - struct tm ttm1; - - ttm1.tm_year = 90; // random test year 90 - ttm1.tm_mon = 0; // random test mon 0 - ttm1.tm_mday = 1; // random test mday 1 - ttm1.tm_hour = 12; // random test hour 12 - ttm1.tm_min = 12; // random test min 12 - ttm1.tm_sec = 12; // random test sec 12 - ttm1.tm_isdst = 0; - ttime1 = mktime(&ttm1); - utime1.modtime = ttime1; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname1, "/1463"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - JffsStatPrintf(buf1); - - ret = utime(pathname1, &utime1); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - JffsStatPrintf(buf1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs413(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_413", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_414.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_414.cpp deleted file mode 100644 index 66293604..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_414.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - struct stat buf1, buf2, buf3; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname1, "/1464"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - JffsStatPrintf(buf1); - - ret = utime(pathname1, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - sleep(2); // wait 2s - - ret = utime(pathname1, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - JffsStatPrintf(buf2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = utime(pathname1, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - JffsStatPrintf(buf3); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs414(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_414", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_415.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_415.cpp deleted file mode 100644 index 8d65e4d2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_415.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1465_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1465_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1465_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1465_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1465_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1465_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = read(fd3, bufW3, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT6); // compare ret len with target len 20 - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1465_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - JffsStrcat2(pathname1, "/1465_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - JffsStrcat2(pathname1, "/1465_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1465_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1465_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1465_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs415(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_415", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_416.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_416.cpp deleted file mode 100644 index 3a84fd92..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_416.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1472_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1472_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1472_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1472_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1472_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = 0; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = 0; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 0, lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1472_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1472_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1472_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1472_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1472_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1472_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs416(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_416", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_417.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_417.cpp deleted file mode 100644 index 1c8e2560..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_417.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1473_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1473_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1473_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1473_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1473_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH + 1; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH + 1; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 2 * (JFFS_SHORT_ARRAY_LENGTH + 1), lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1473_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1473_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1473_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1473_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1473_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1473_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs417(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_417", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_418.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_418.cpp deleted file mode 100644 index f715046a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_418.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1474_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1474_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1474_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1474_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1474_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH + 1; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH + 1; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 2 * (JFFS_SHORT_ARRAY_LENGTH + 1), lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1474_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1474_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1474_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1474_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1474_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1474_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs418(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_418", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_419.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_419.cpp deleted file mode 100644 index a1be828c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_419.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1475_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1475_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1475_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1475_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1475_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH - 1; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH - 1; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 2 * (JFFS_SHORT_ARRAY_LENGTH - 1), lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1475_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1475_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1475_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1475_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1475_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1475_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs419(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_419", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_420.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_420.cpp deleted file mode 100644 index b31e1713..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_420.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1476_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1476_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1476_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1476_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1476_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, -1); - ICUNIT_GOTO_EQUAL(lenV, -1, lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1476_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1476_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1476_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1476_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1476_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1476_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs420(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_420", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_421.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_421.cpp deleted file mode 100644 index 39258b97..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_421.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1477_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1477_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1477_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1477_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1477_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 1); - ICUNIT_GOTO_EQUAL(lenV, 10, lenV, EXIT6); // compare ret lenV to target 10 lenV - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1477_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1477_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1477_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1477_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1477_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1477_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs421(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_421", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_422.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_422.cpp deleted file mode 100644 index aa6ce0b1..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_422.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1478_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1478_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1478_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1478_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1478_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 0); - ICUNIT_GOTO_EQUAL(lenV, -1, lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1478_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1478_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1478_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1478_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1478_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1478_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs422(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_422", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_423.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_423.cpp deleted file mode 100644 index 51fe628e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_423.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1479_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1479_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1479_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1479_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1479_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 3); // writes 3 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1479_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1479_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1479_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1479_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1479_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1479_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs423(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_423", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_424.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_424.cpp deleted file mode 100644 index 0802fd32..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_424.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1480_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1480_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1480_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1480_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1480_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - lenV = readv(fd3, g_jffsIov, 2); // reads 2 buffers from the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1480_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1480_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1480_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1480_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1480_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1480_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs424(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_424", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_425.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_425.cpp deleted file mode 100644 index 8bca7a88..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_425.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1481_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1481_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1481_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1481_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1481_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = readv(fd3, g_jffsIov, 3); // reads 3 buffers from the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1481_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1481_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1481_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1481_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1481_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1481_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs425(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_425", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_426.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_426.cpp deleted file mode 100644 index 239a4ead..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_426.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1488_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1488_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1488_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1488_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1488_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = 0; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = 0; - - lenV = readv(fd3, g_jffsIov, 2); // reads 2 buffers from the fd - ICUNIT_GOTO_EQUAL(lenV, 0, lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1488_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1488_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1488_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1488_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1488_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1488_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs426(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_426", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_427.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_427.cpp deleted file mode 100644 index 4f3b227c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_427.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1489_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1489_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1489_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1489_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1489_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = readv(fd3, g_jffsIov, 2); // reads 2 buffers from the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1489_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1489_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1489_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1489_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1489_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1489_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs427(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_427", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_428.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_428.cpp deleted file mode 100644 index 32b6faa5..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_428.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1490_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1490_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1490_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1490_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1490_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH + 2; // set length to JFFS_SHORT_ARRAY_LENGTH + 2 - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH + 2; // set length to JFFS_SHORT_ARRAY_LENGTH + 2 - - lenV = readv(fd3, g_jffsIov, 2); // reads 2 buffers from the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1490_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1490_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1490_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1490_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1490_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1490_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs428(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_428", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_429.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_429.cpp deleted file mode 100644 index f7163e35..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_429.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1491_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1491_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1491_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1491_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1491_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH - 1; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH - 1; - - lenV = readv(fd3, g_jffsIov, 2); // reads 2 buffers from the fd - ICUNIT_GOTO_EQUAL(lenV, 2 * (JFFS_SHORT_ARRAY_LENGTH - 1), lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1491_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1491_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1491_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1491_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1491_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1491_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs429(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_429", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_430.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_430.cpp deleted file mode 100644 index 35d57a4a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_430.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1492_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1492_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1492_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1492_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1492_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = readv(fd3, g_jffsIov, -1); - ICUNIT_GOTO_EQUAL(lenV, -1, lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1492_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1492_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1492_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1492_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1492_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1492_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs430(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_430", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_431.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_431.cpp deleted file mode 100644 index abdbabfa..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_431.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1493_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1493_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1493_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1493_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1493_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = readv(fd3, g_jffsIov, 1); - ICUNIT_GOTO_EQUAL(lenV, 10, lenV, EXIT6); // compare ret lenV to target 10 lenV - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1493_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1493_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1493_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1493_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1493_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1493_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs431(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_431", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_432.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_432.cpp deleted file mode 100644 index 2f350944..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_432.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1494_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1494_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1494_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1494_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1494_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = readv(fd3, g_jffsIov, 0); - ICUNIT_GOTO_EQUAL(lenV, -1, lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1494_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1494_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1494_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1494_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1494_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1494_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs432(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_432", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_433.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_433.cpp deleted file mode 100644 index d9f3e442..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_433.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = "/dev"; - struct stat buf1, buf2; - struct utimbuf utime1; - time_t ttime1; - struct tm ttm1; - - ttm1.tm_year = 90; // random test year 90 - ttm1.tm_mon = 0; // random test mon 0 - ttm1.tm_mday = 1; // random test mday 1 - ttm1.tm_hour = 12; // random test hour 12 - ttm1.tm_min = 12; // random test min 12 - ttm1.tm_sec = 12; // random test sec 12 - ttm1.tm_isdst = 0; - ttime1 = mktime(&ttm1); - utime1.modtime = ttime1; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = utime(pathname2, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - sleep(2); // wait 2s - - ret = utime(pathname2, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs433(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_433", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_434.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_434.cpp deleted file mode 100644 index 0839be5e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_434.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rename(NULL, pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - strcat(pathname1, "/test"); - ret = rename(NULL, pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs434(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_434", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_435.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_435.cpp deleted file mode 100644 index fbcf1be8..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_435.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rename(pathname1, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs435(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_435", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_454.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_454.cpp deleted file mode 100644 index 25d2d360..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_454.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/589.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = ioctl(fd, 0, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs454(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_454", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_455.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_455.cpp deleted file mode 100644 index fd9d148d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_455.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/590.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 0, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs455(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_455", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_456.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_456.cpp deleted file mode 100644 index ee77adb1..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_456.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs456(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_456", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_457.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_457.cpp deleted file mode 100644 index 0ca9c9ce..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_457.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 0xffff, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs457(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_457", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_458.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_458.cpp deleted file mode 100644 index e84abd4f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_458.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, -1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs458(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_458", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_459.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_459.cpp deleted file mode 100644 index ce14620a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_459.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/594.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 10, 0); // ioctl request 10 to the fd - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs459(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_459", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_460.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_460.cpp deleted file mode 100644 index 87713790..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_460.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/595.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 0, 1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs460(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_460", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_461.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_461.cpp deleted file mode 100644 index 5bac61b8..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_461.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/596.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 0, 0xffff); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs461(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_461", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_462.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_462.cpp deleted file mode 100644 index 73b0d76e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_462.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/603.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = isatty(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = isatty(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs462(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_462", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_487.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_487.cpp deleted file mode 100644 index 8ff00789..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_487.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = fsync(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = fsync(fd); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs487(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_487", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_488.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_488.cpp deleted file mode 100644 index 9fc22401..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_488.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pread(fd, readbuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - len = pread(fd, readbuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pread64(fd, readbuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - len = pread64(fd, readbuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs488(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_488", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_489.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_489.cpp deleted file mode 100644 index cb964c35..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_489.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pread(fd, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pread64(fd, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs489(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_489", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_490.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_490.cpp deleted file mode 100644 index 9fc1b460..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_490.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 0, 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 0, 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs490(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_490", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_491.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_491.cpp deleted file mode 100644 index ce6f64a4..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_491.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs491(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_491", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_492.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_492.cpp deleted file mode 100644 index c41ad8ff..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_492.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *writebuf = NULL; - CHAR *readbuf = NULL; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - writebuf = (CHAR *)malloc(0xffff + 2); // malloc 0xffff + 2 bytes buffer - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT2); - memset(writebuf, 0, 0xffff + 2); // memset 0xffff + 2 bytes - - for (i = 0; i < 256; i++) { // generate 256 * 260 bytes writebuf - strcat(writebuf, filebuf); - } - writebuf[0xffff] = '\0'; - - readbuf = (CHAR *)malloc(0xffff + 1); - ICUNIT_GOTO_NOT_EQUAL(readbuf, NULL, readbuf, EXIT3); - memset(readbuf, 0, 0xffff + 1); - - len = write(fd, writebuf, 0xffff); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT4); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 0xffff, 0); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT4); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 0xffff, off, EXIT4); - - free(readbuf); - free(writebuf); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - writebuf = (CHAR *)malloc(0xffff + 2); // malloc 0xffff + 2 bytes buffer - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT2); - memset(writebuf, 0, 0xffff + 2); // memset 0xffff + 2 bytes - - for (i = 0; i < 256; i++) { // generate 256 * 260 bytes writebuf - strcat(writebuf, filebuf); - } - writebuf[0xffff] = '\0'; - - readbuf = (CHAR *)malloc(0xffff + 1); - ICUNIT_GOTO_NOT_EQUAL(readbuf, NULL, readbuf, EXIT3); - memset(readbuf, 0, 0xffff + 1); - - len = write(fd, writebuf, 0xffff); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT4); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 0xffff, 0); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT4); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 0xffff, off, EXIT4); - - free(readbuf); - free(writebuf); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT4: - free(readbuf); -EXIT3: - free(writebuf); -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs492(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_492", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_493.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_493.cpp deleted file mode 100644 index cf82ff01..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_493.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[10] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 10); // memset 10 bytes - len = pread(fd, readbuf, 9, 1); // read 9 bytes from fd at offset 1 - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 10); // memset 10 bytes - len = pread64(fd, readbuf, 9, 1); // read 9 bytes from fd at offset 1 - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs493(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_493", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_494.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_494.cpp deleted file mode 100644 index 6b4720ff..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_494.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[11] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 10); // memset 10 bytes - len = pread(fd, readbuf, 10, 0); // read 10 bytes from fd at offset 0 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 10); // memset 10 bytes - len = pread64(fd, readbuf, 10, 0); // read 10 bytes from fd at offset 0 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs494(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_494", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_495.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_495.cpp deleted file mode 100644 index 9db1dbf3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_495.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[5] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 5); // memset 5 bytes - len = pread(fd, readbuf, 6, 0); // read 6 bytes from fd at offset 0 - dprintf("len=:%d,readbuf=:%s\n", len, readbuf); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 5); // memset 5 bytes - len = pread64(fd, readbuf, 6, 0); // read 6 bytes from fd at offset 0 - dprintf("len=:%d,readbuf=:%s\n", len, readbuf); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs495(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_495", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_496.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_496.cpp deleted file mode 100644 index cc11d7b8..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_496.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, 1); // read 10 bytes from fd at offset 1 - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "234567890", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, 1); // read 10 bytes from fd at offset 1 - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "234567890", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs496(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_496", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_497.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_497.cpp deleted file mode 100644 index b7b32ba6..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_497.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, 0xffff); // read 10 bytes from fd at offset 0xffff - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, 0xffff); // read 10 bytes from fd at offset 0xffff - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs497(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_497", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_498.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_498.cpp deleted file mode 100644 index 24423089..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_498.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, 10 + 1); // read 10 bytes from fd at offset 10 + 1 = 11 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, 10 + 1); // read 10 bytes from fd at offset 10 + 1 = 11 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs498(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_498", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_499.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_499.cpp deleted file mode 100644 index ab5fc1e7..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_499.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, 10); // read 10 bytes from fd at offset 10 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, 10); // read 10 bytes from fd at offset 10 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs499(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_499", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_500.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_500.cpp deleted file mode 100644 index af0f4cbc..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_500.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, strlen(writebuf) - 1); // read 10 bytes from fd at offset strlen(writebuf) - 1 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, strlen(writebuf) - 1); // read 10 bytes from fd at offset strlen(writebuf) - 1 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs500(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_500", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_501.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_501.cpp deleted file mode 100644 index 5d087171..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_501.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, -1); // read 10 bytes from fd at offset -1 - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, -1); // read 10 bytes from fd at offset -1 - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs501(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_501", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_502.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_502.cpp deleted file mode 100644 index 8099fc35..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_502.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pwrite(fd, writebuf, 10, 0); // write 10 bytes from fd at offset 0 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - len = pwrite(fd, writebuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pwrite64(fd, writebuf, 10, 0); // write 10 bytes from fd at offset 0 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - len = pwrite64(fd, writebuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs502(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_502", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_503.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_503.cpp deleted file mode 100644 index 40daec16..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_503.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pwrite(fd, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pwrite64(fd, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs503(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_503", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_504.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_504.cpp deleted file mode 100644 index a9c58d57..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_504.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - len = pwrite(fd, writebuf, 0, 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - ret = read(fd, readbuf, 10); // read 10 bytes to buffer - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - len = pwrite64(fd, writebuf, 0, 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - ret = read(fd, readbuf, 10); // read 10 bytes to buffer - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs504(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_504", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_505.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_505.cpp deleted file mode 100644 index c1e21748..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_505.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - len = pwrite(fd, writebuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - len = pwrite64(fd, writebuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs505(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_505", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_506.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_506.cpp deleted file mode 100644 index 1a7df68b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_506.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *writebuf = NULL; - CHAR *readbuf = NULL; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - writebuf = (CHAR *)malloc(0xffff + 2); // malloc 0xffff + 2 bytes buffer - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT2); - memset(writebuf, 0, 0xffff + 2); // memset 0xffff + 2 bytes - - for (i = 0; i < 256; i++) { // generate 256 * 260 bytes writebuf - strcat(writebuf, filebuf); - } - writebuf[0xffff] = '\0'; - - readbuf = (CHAR *)malloc(0xffff + 1); - ICUNIT_GOTO_NOT_EQUAL(readbuf, NULL, readbuf, EXIT3); - memset(readbuf, 0, 0xffff + 1); - - len = pwrite(fd, writebuf, 0xffff, 0); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT4); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT4); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 0xffff); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT4); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 0xffff, off, EXIT4); - - free(readbuf); - free(writebuf); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - writebuf = (CHAR *)malloc(0xffff + 2); // malloc 0xffff + 2 bytes buffer - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT2); - memset(writebuf, 0, 0xffff + 2); // memset 0xffff + 2 bytes - - for (i = 0; i < 256; i++) { // generate 256 * 260 bytes writebuf - strcat(writebuf, filebuf); - } - writebuf[0xffff] = '\0'; - - readbuf = (CHAR *)malloc(0xffff + 1); - ICUNIT_GOTO_NOT_EQUAL(readbuf, NULL, readbuf, EXIT3); - memset(readbuf, 0, 0xffff + 1); - - len = pwrite64(fd, writebuf, 0xffff, 0); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT4); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT4); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 0xffff); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT4); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 0xffff, off, EXIT4); - - free(readbuf); - free(writebuf); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT4: - free(readbuf); -EXIT3: - free(writebuf); -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs506(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_506", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_507.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_507.cpp deleted file mode 100644 index 6e474d9a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_507.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, filebuf, strlen(filebuf) - 1, 0); - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read buffer len 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "lalalalal0", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, filebuf, strlen(filebuf) - 1, 0); - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read buffer len 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "lalalalal0", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs507(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_507", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_508.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_508.cpp deleted file mode 100644 index c1b26679..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_508.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, JFFS_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT2); // compare ret len with target len 20 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, JFFS_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT2); // compare ret len with target len 20 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs508(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_508", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_509.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_509.cpp deleted file mode 100644 index 5bbd37d2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_509.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, JFFS_STANDARD_NAME_LENGTH + 1, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH + 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 25); // read buffer len 25 - ICUNIT_GOTO_EQUAL(len, 25, len, EXIT2); // compare ret len with target len 25 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, JFFS_STANDARD_NAME_LENGTH + 1, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH + 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 25); // read buffer len 25 - ICUNIT_GOTO_EQUAL(len, 25, len, EXIT2); // compare ret len with target len 25 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs509(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_509", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_510.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_510.cpp deleted file mode 100644 index f75c0b75..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_510.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 1, off, EXIT2); - - len = pwrite(fd, writebuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 1, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read buffer len 10 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 1, off, EXIT2); - - len = pwrite64(fd, writebuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 1, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read buffer len 10 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs510(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_510", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_511.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_511.cpp deleted file mode 100644 index cf9485f7..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_511.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, strlen(writebuf), 0xffff); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0xffff - 1, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0xffff - 1, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + 1, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, strlen(writebuf), 0xffff); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0xffff - 1, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0xffff - 1, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + 1, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs511(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_511", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_512.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_512.cpp deleted file mode 100644 index 57d618fd..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_512.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, 10, off + 1); // write 10 bytes from fd at offset off + 1 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf) + 1, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, 10, off + 1); // write 10 bytes from fd at offset off + 1 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf) + 1, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs512(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_512", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_513.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_513.cpp deleted file mode 100644 index 7d2a5425..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_513.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, 10, off); // write 10 bytes from fd at offset off - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "12345678901234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, 10, off); // write 10 bytes from fd at offset off - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "12345678901234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs513(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_513", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_514.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_514.cpp deleted file mode 100644 index c0714170..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_514.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, 10, off - 1); // write 10 bytes from fd at offset off - 1 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf) - 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567891234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, 10, off - 1); // write 10 bytes from fd at offset off - 1 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf) - 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567891234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs514(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_514", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_515.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_515.cpp deleted file mode 100644 index 30e5d3f9..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_515.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, 10, -1); // write 10 bytes from fd at offset -1 - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, 10, -1); // write 10 bytes from fd at offset -1 - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs515(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_515", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_516.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_516.cpp deleted file mode 100644 index a931be66..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_516.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs516(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_516", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_517.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_517.cpp deleted file mode 100644 index 03c0ec4e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_517.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname2, "/test"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs517(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_517", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_518.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_518.cpp deleted file mode 100644 index 59f48e02..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_518.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove("//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs518(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_518", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_519.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_519.cpp deleted file mode 100644 index c9c25439..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_519.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove("/"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs519(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_519", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_520.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_520.cpp deleted file mode 100644 index 244fe4f5..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_520.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *realName = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - realName = realpath(pathname2, NULL); - ICUNIT_GOTO_NOT_EQUAL(realName, JFFS_TO_NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname2, realName, EXIT1); - free(realName); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(realName); - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_520 -* -@tspec The API test for realpath -* -@ttitle The API test for realpath with NULL for the second parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. mkdir a directory in the mount dir; -2. use the function realpath to get the full-path; -3. rmdir the directory; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs520(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_520", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_521.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_521.cpp deleted file mode 100644 index 0f2feaa8..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_521.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *realName = NULL; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - close(fd); - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_521 -* -@tspec The Function test for realpath -* -@ttitle Get the realpath about the file; -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file; -2. use the function realpath to get the full-path; -3. rmdir the directory; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs521(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_521", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_522.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_522.cpp deleted file mode 100644 index 358799c9..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_522.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *realName = NULL; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_522 -* -@tspec The Function test for realpath -* -@ttitle Get the realpath about the directory; -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. use the function realpath to get the full-path; -3. rmdir the directory; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs522(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_522", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_523.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_523.cpp deleted file mode 100644 index c7e7c5d4..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_523.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *realName = NULL; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - close(fd); - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_523 -* -@tspec The Function test for realpath -* -@ttitle Get the realpath about the file which has removed; -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. use the function realpath to get the full-path; -3. rmdir the directory; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs523(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_523", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_524.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_524.cpp deleted file mode 100644 index 8ac29452..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_524.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *realName = NULL; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_EQUAL(realName, NULL, realName, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_524 -* -@tspec The Function test for realpath -* -@ttitle Get the realpath about the directory which has removed; -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. use the function realpath to get the full-path; -3. rmdir the directory; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs524(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_524", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_526.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_526.cpp deleted file mode 100644 index c8de79ea..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_526.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *realName = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT); - printf("%s-%d \n", __FUNCTION__, __LINE__); - - strcat(pathname2, "/////"); - strcat(pathname2, "test"); - - realName = realpath(pathname2, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_526 -* -@tspec The Function test for realpath -* -@ttitle Get the realpath about the directory which contains many connection symbols; -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. use the function realpath to get the full-path; -3. rmdir the directory; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs526(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_526", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_528.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_528.cpp deleted file mode 100644 index a66516d9..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_528.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(VOID *argument) -{ - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *realName = NULL; - - g_TestCnt++; - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT); - - g_TestCnt++; - - return NULL; - -EXIT: - g_TestCnt++; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_t newTh1; - pthread_attr_t attr; - - g_TestCnt = 0; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - - PosixPthreadInit(&attr, 4); // init pthread with attr 4 - - ret = pthread_create(&newTh1, &attr, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - while (g_TestCnt < 2) { // wait for test count 2 complete - sleep(1); - } - - ICUNIT_GOTO_EQUAL(g_TestCnt, 2, g_TestCnt, EXIT2); // compare g_TestCnt to 2 - - ret = PosixPthreadDestroy(&attr, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(pathname1); - - return JFFS_NO_ERROR; -EXIT2: - PosixPthreadDestroy(&attr, newTh1); -EXIT1: - remove(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_528 -* -@tspec The Function test for realpath -* -@ttitle Get the realpath about the directory in another task; -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. use the function realpath to get the full-path in another task; -3. N/A; -4. N/A. -* -@texpect -1. Return successed -2. Successful operation -3. N/A -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs528(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_528", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_529.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_529.cpp deleted file mode 100644 index 79fab231..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_529.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *realName = NULL; - BOOL bool1 = 0; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - realName = realpath(".", bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_616 -* -@tspec The Function test for realpath -* -@ttitle Get the realpath about the directory which was deleted; -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. delete the directory; -3. use the function realpath to get the full-pathN/A; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs529(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_529", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_530.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_530.cpp deleted file mode 100644 index 5cf1da66..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_530.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 i = 0; - INT32 ret; - INT32 fd; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_MAIN_DIR0 }; - CHAR bufname[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR *realName = NULL; - BOOL bool1 = 0; - - strcat(pathname1, "/"); - - // PATH_MAX test. The dirname has occupied 9 bytes. - while (i < 246) { // generate 246 length name - i++; - strcat(pathname1, "t"); - } - ICUNIT_GOTO_EQUAL(strlen(pathname1), 255, strlen(pathname1), EXIT); // compare pathname length with 255 - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - close(fd); - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_616 -* -@tspec The Function test for realpath -* -@ttitle Get the realpath about the directory which is multi-level directory; -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. use the function realpath to get the full-path in another task; -3. N/A; -4. N/A. -* -@texpect -1. Return successed -2. Successful operation -3. N/A -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs530(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_530", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_531.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_531.cpp deleted file mode 100644 index 49a80b0e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_531.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 flags; - - fd = open(pathname, O_CREAT | O_RDONLY | O_EXCL | O_APPEND, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - flags = fcntl(fd, F_GETFL, 0); - ICUNIT_GOTO_EQUAL(flags & O_ACCMODE, O_RDONLY, flags & O_ACCMODE, EXIT1); - ICUNIT_GOTO_EQUAL(flags & O_APPEND, O_APPEND, flags & O_APPEND, EXIT1); - ICUNIT_GOTO_NOT_EQUAL(flags & O_NONBLOCK, O_NONBLOCK, flags & O_NONBLOCK, EXIT1); - - flags |= O_NONBLOCK | O_RDWR; - flags = fcntl(fd, F_SETFL, flags); - ICUNIT_GOTO_EQUAL(flags, 0, flags, EXIT1); - - len = read(fd, readbuf, 50); // read buffer len 50 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - flags = fcntl(fd, F_GETFL, 0); - ICUNIT_GOTO_EQUAL(flags & O_APPEND, O_APPEND, flags & O_APPEND, EXIT1); - ICUNIT_GOTO_EQUAL(flags & O_NONBLOCK, O_NONBLOCK, flags & O_NONBLOCK, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs531(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_531", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_532.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_532.cpp deleted file mode 100644 index 1d344dd6..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_532.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 flags; - - fd = open(pathname, O_CREAT | O_RDONLY | O_EXCL | O_APPEND, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - flags = fcntl(fd, F_GETFL, 0); - ICUNIT_GOTO_EQUAL(flags & O_ACCMODE, O_RDONLY, flags & O_ACCMODE, EXIT1); - ICUNIT_GOTO_EQUAL(flags & O_APPEND, O_APPEND, flags & O_APPEND, EXIT1); - ICUNIT_GOTO_NOT_EQUAL(flags & O_NONBLOCK, O_NONBLOCK, flags & O_NONBLOCK, EXIT1); - - flags |= O_NONBLOCK | O_RDWR; - flags = fcntl(fd, F_SETFL, flags); - ICUNIT_GOTO_EQUAL(flags, 0, flags, EXIT1); - - len = read(fd, readbuf, 50); // read buffer len 50 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - flags = fcntl(fd, F_GETFL, 0); - ICUNIT_GOTO_EQUAL(flags & O_APPEND, O_APPEND, flags & O_APPEND, EXIT1); - ICUNIT_GOTO_EQUAL(flags & O_NONBLOCK, O_NONBLOCK, flags & O_NONBLOCK, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs532(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_532", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_533.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_533.cpp deleted file mode 100644 index 4369c7ce..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_533.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - struct flock fl = { 0 }; - CHAR filebuf[10] = "good"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = fcntl(fd, F_GETLK, &fl); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // compare ret len with target len 4 - - fl.l_type = F_UNLCK; - fl.l_whence = SEEK_SET; - fl.l_start = 10; // star from 10 - fl.l_len = 10; // length 10 - ret = fcntl(fd, F_SETLK, &fl); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = fcntl(fd, F_GETLK, &fl); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // compare ret len with target len 4 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs533(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_533", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_534.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_534.cpp deleted file mode 100644 index 92fdc335..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_534.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - struct flock fl = { 0 }; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // compare ret len with target len 4 - - ret = fcntl(fd, F_GETLK, &fl); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - fl.l_type = F_WRLCK; - fl.l_whence = SEEK_SET; - fl.l_start = 10; // star from 10 - fl.l_len = 10; // length 10 - - if (fcntl(fd, F_SETLK, &fl) == -1) { - if (errno == EACCES || errno == EAGAIN || errno == ENOSYS) { - ICUNIT_GOTO_EQUAL(1, 1, errno, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(1, 0, errno, EXIT1); - } - } - - len = read(fd, readbuf, 50); // read buffer len 50 - - fl.l_type = F_UNLCK; - fl.l_whence = SEEK_SET; - fl.l_start = 10; // star from 10 - fl.l_len = 10; // length 10 - ret = fcntl(fd, F_SETLK, &fl); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = fcntl(fd, F_GETLK, &fl); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - len = read(fd, readbuf, 50); // read buffer len 50 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs534(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_534", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_541.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_541.cpp deleted file mode 100644 index 70e33a05..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_541.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1134.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, -1, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_IS_ERROR, off, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - off = lseek64(fd, -10, SEEK_CUR); // seek -10 from current pos - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs541(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_541", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_542.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_542.cpp deleted file mode 100644 index 9b24a5aa..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_542.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1135.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, 0xffff, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0xffff, off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs542(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_542", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_543.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_543.cpp deleted file mode 100644 index 4e290310..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_543.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1136.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, len, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, len, off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs543(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_543", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_544.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_544.cpp deleted file mode 100644 index bd92bd39..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_544.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1137.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, (len + 2), SEEK_SET); // seek to len + 2 - ICUNIT_GOTO_EQUAL(off, (len + 2), off, EXIT1); // compare ret off to target len + 2 off - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs544(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_544", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_545.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_545.cpp deleted file mode 100644 index fbdb2356..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_545.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1138.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, -1, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 9, off, EXIT1); // compare ret off with target off 9 - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "eiteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs545(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_545", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_546.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_546.cpp deleted file mode 100644 index 1ddb3d5c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_546.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1139.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, JFFS_SHORT_ARRAY_LENGTH, off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs546(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_546", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_547.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_547.cpp deleted file mode 100644 index 7eb746c1..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_547.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1140.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, 0xffff, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 0x10009, off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs547(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_547", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_548.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_548.cpp deleted file mode 100644 index 7d93cd07..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_548.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1141.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, len, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 0x14, off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs548(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_548", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_549.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_549.cpp deleted file mode 100644 index 660d41d4..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_549.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "637.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, (len + 2), SEEK_CUR); // seek len + 2 from current pos - ICUNIT_GOTO_EQUAL(off, (len + len + 2), off, EXIT1); // compare ret off to target len + len + 2 off - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs549(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_549", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_550.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_550.cpp deleted file mode 100644 index 202b33b8..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_550.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1143.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, JFFS_SHORT_ARRAY_LENGTH, off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs550(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_550", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_551.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_551.cpp deleted file mode 100644 index bee29690..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_551.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1144.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, -1, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 9, off, EXIT1); // compare ret off with target off 9 - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "9iteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs551(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_551", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_552.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_552.cpp deleted file mode 100644 index 194f7f38..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_552.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1145.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, 0xffff, SEEK_END); - ICUNIT_GOTO_EQUAL(off, (0xffff + JFFS_SHORT_ARRAY_LENGTH), off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs552(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_552", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_553.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_553.cpp deleted file mode 100644 index 66868f3f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_553.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1146.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, len, SEEK_END); - ICUNIT_GOTO_EQUAL(off, (len + len), off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs553(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_553", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_554.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_554.cpp deleted file mode 100644 index 29fe4223..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_554.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1147.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, (len + 2), SEEK_END); // seek to len + 2 from file end - ICUNIT_GOTO_EQUAL(off, (len + len + 2), off, EXIT1); // compare ret off to target len + len + 2 off - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs554(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_554", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_555.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_555.cpp deleted file mode 100644 index 584eaac3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_555.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1147.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, 0, -1); - ICUNIT_GOTO_EQUAL(off, JFFS_IS_ERROR, off, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs555(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_555", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_556.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_556.cpp deleted file mode 100644 index 7fab5bf0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_556.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1147.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, 0, 0xffff); - ICUNIT_GOTO_EQUAL(off, JFFS_IS_ERROR, off, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs556(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_556", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_557.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_557.cpp deleted file mode 100644 index 95067eb4..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_557.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1147.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, 0, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(off, JFFS_IS_ERROR, off, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs557(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_557", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_560.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_560.cpp deleted file mode 100644 index e031c54f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_560.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/aaaaa"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = stat64("aaaaa", &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - close(fd); -EXIT1: - remove("aaaaa"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs560(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_560", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_562.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_562.cpp deleted file mode 100644 index 8f4eba97..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_562.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat64("", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs562(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_562", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_563.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_563.cpp deleted file mode 100644 index c822a78d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_563.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat64("..", &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs563(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_563", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_564.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_564.cpp deleted file mode 100644 index 301b8e78..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_564.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat64(".", &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs564(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_564", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_565.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_565.cpp deleted file mode 100644 index 4fca7116..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_565.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/"); - strcat(pathname2, pathname3); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = stat64(pathname3, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - close(fd); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs565(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_565", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_566.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_566.cpp deleted file mode 100644 index 86e69651..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_566.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat64("" - "", - &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs566(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_566", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_567.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_567.cpp deleted file mode 100644 index 13c82c5d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_567.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat64(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs567(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_567", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_568.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_568.cpp deleted file mode 100644 index 755f5f0f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_568.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - - ret = stat64(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs568(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_568", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_569.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_569.cpp deleted file mode 100644 index 25c4fcc6..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_569.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs569(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_569", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_570.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_570.cpp deleted file mode 100644 index 1d90fb84..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_570.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs570(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_570", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_571.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_571.cpp deleted file mode 100644 index 04b541d0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_571.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/jffs_1350.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = fstat64(fd, &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs571(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_571", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_572.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_572.cpp deleted file mode 100644 index bdcb506a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_572.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/1351.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs572(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_572", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_573.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_573.cpp deleted file mode 100644 index c87f6298..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_573.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/1352.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs573(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_573", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_574.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_574.cpp deleted file mode 100644 index e9738efe..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_574.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd; - INT32 ret = 0; - INT32 len = 0; - INT32 size = 0xffff; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *writebuf = NULL; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - struct statfs buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - off_t off; - - writebuf = (CHAR *)malloc(size); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); - memset(writebuf, 0x61, size); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatfsPrintf(buf1); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(buf3); - - ret = fallocate(fd, 1, 0, size + JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf3.st_size, size, buf3.st_size, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - free(writebuf); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - free(writebuf); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_574 -* -@tspec The function test for fallocate -* -@ttitle Fallocate allocates space while the offset + length is more than the size of the file -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one non-empty file; -2. use the function fallocate to allocates space while the offset + length is more than the size of the file ; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs574(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_574", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_583.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_583.cpp deleted file mode 100644 index 03026fea..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_583.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - int ret, i; - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - umount(JFFS_MAIN_DIR0); - for (i = 0; i < 30; i++) { // test 30 times - printf("%s-%d umount/mount: %d\n", __FUNCTION__, __LINE__, i); - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, MS_RDONLY, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - umount(JFFS_MAIN_DIR0); -EXIT: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs583(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_583", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_584.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_584.cpp deleted file mode 100644 index 45fa7f18..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_584.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - int ret, i; - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - umount(JFFS_MAIN_DIR0); - for (i = 0; i < 30; i++) { // test 30 times - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, MS_RDONLY, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - umount(JFFS_MAIN_DIR0); -EXIT: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs584(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_584", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_586.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_586.cpp deleted file mode 100644 index 8b9243b3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_586.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd; - INT32 ret = 0; - INT32 i = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = ftruncate(fd, 50); // truncate fd to 50 bytes - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_586 -* -@tspec The function test for truncate -* -@ttitle Truncate recover space for the same file fd multiple times -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one file; -2. use the function truncate to recover the space for the same file fd multiple times; -3. close and remove the file; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Successful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs586(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_586", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_589.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_589.cpp deleted file mode 100644 index cc882f40..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_589.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/589.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = ioctl(fd, 0, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs589(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_589", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_590.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_590.cpp deleted file mode 100644 index 78dd163c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_590.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/590.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 0, 0); - ICUNIT_GOTO_EQUAL(ret, -ENOSYS, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs590(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_590", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_591.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_591.cpp deleted file mode 100644 index a73e16cd..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_591.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs591(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_591", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_592.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_592.cpp deleted file mode 100644 index 7c144ae2..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_592.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 0xffff, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs592(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_592", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_593.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_593.cpp deleted file mode 100644 index d7e9096d..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_593.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, -1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs593(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_593", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_594.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_594.cpp deleted file mode 100644 index 719a6801..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_594.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/594.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 10, 0); // ioctl request 10 to the fd - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs594(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_594", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_595.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_595.cpp deleted file mode 100644 index 416e697c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_595.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/595.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 0, 1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs595(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_595", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_596.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_596.cpp deleted file mode 100644 index 4c5daf01..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_596.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/596.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 0, 0xffff); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs596(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_596", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_603.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_603.cpp deleted file mode 100644 index 4561705c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_603.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/603.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = isatty(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = isatty(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs603(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_603", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_636.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_636.cpp deleted file mode 100644 index 149f528a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_636.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = fsync(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = fsync(fd); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs636(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_636", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_643.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_643.cpp deleted file mode 100644 index f9bf593e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_643.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pread(fd, readbuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - len = pread(fd, readbuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pread64(fd, readbuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - len = pread64(fd, readbuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs643(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_643", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_644.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_644.cpp deleted file mode 100644 index fea95c63..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_644.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pread(fd, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pread64(fd, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs644(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_644", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_645.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_645.cpp deleted file mode 100644 index be6df92e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_645.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 0, 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 0, 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs645(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_645", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_646.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_646.cpp deleted file mode 100644 index 57e73f3a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_646.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs646(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_646", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_648.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_648.cpp deleted file mode 100644 index 9e5c9fb7..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_648.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[10] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 10); // memset 10 bytes - len = pread(fd, readbuf, 9, 1); // read 9 bytes from fd at offset 1 - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 10); // memset 10 bytes - len = pread64(fd, readbuf, 9, 1); // read 9 bytes from fd at offset 1 - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs648(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_648", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_649.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_649.cpp deleted file mode 100644 index 001573ea..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_649.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[11] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 10); // memset 10 bytes - len = pread(fd, readbuf, 10, 0); // read 10 bytes from fd at offset 0 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 10); // memset 10 bytes - len = pread64(fd, readbuf, 10, 0); // read 10 bytes from fd at offset 0 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs649(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_649", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_650.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_650.cpp deleted file mode 100644 index 55c48b9c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_650.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[5] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 5); // memset 5 bytes - len = pread(fd, readbuf, 6, 0); // read 6 bytes from fd at offset 0 - dprintf("len=:%d,readbuf=:%s\n", len, readbuf); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 5); // memset 5 bytes - len = pread64(fd, readbuf, 6, 0); // read 6 bytes from fd at offset 0 - dprintf("len=:%d,readbuf=:%s\n", len, readbuf); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs650(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_650", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_651.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_651.cpp deleted file mode 100644 index 5b125abb..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_651.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, 1); // read 10 bytes from fd at offset 1 - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "234567890", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, 1); // read 10 bytes from fd at offset 1 - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "234567890", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs651(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_651", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_652.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_652.cpp deleted file mode 100644 index 0fce9011..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_652.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, 0xffff); // read 10 bytes from fd at offset 0xffff - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, 0xffff); // read 10 bytes from fd at offset 0xffff - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs652(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_652", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_653.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_653.cpp deleted file mode 100644 index 673b447e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_653.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, 10 + 1); // read 10 bytes from fd at offset 10 + 1 = 11 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, 10 + 1); // read 10 bytes from fd at offset 10 + 1 = 11 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs653(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_653", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_654.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_654.cpp deleted file mode 100644 index 8b10a16b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_654.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, 10); // read 10 bytes from fd at offset 10 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, 10); // read 10 bytes from fd at offset 10 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs654(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_654", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_655.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_655.cpp deleted file mode 100644 index 51ed5996..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_655.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, strlen(writebuf) - 1); // read 10 bytes from fd at offset strlen(writebuf) - 1 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, strlen(writebuf) - 1); // read 10 bytes from fd at offset strlen(writebuf) - 1 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs655(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_655", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_656.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_656.cpp deleted file mode 100644 index f32eb61b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_656.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, -1); // read 10 bytes from fd at offset -1 - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, -1); // read 10 bytes from fd at offset -1 - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs656(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_656", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_663.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_663.cpp deleted file mode 100644 index 04297cb3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_663.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pwrite(fd, writebuf, 10, 0); // write 10 bytes from fd at offset 0 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - len = pwrite(fd, writebuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pwrite64(fd, writebuf, 10, 0); // write 10 bytes from fd at offset 0 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - len = pwrite64(fd, writebuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs663(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_663", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_664.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_664.cpp deleted file mode 100644 index 54682c62..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_664.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pwrite(fd, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pwrite64(fd, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs664(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_664", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_665.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_665.cpp deleted file mode 100644 index 85684649..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_665.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - len = pwrite(fd, writebuf, 0, 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - ret = read(fd, readbuf, 10); // read 10 bytes to buffer - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - len = pwrite64(fd, writebuf, 0, 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - ret = read(fd, readbuf, 10); // read 10 bytes to buffer - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs665(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_665", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_666.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_666.cpp deleted file mode 100644 index efb82fee..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_666.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - len = pwrite(fd, writebuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - len = pwrite64(fd, writebuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs666(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_666", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_668.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_668.cpp deleted file mode 100644 index c963779e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_668.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, filebuf, strlen(filebuf) - 1, 0); - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read buffer len 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "lalalalal0", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, filebuf, strlen(filebuf) - 1, 0); - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read buffer len 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "lalalalal0", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs668(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_668", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_669.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_669.cpp deleted file mode 100644 index f0a00fe6..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_669.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, JFFS_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT2); // compare ret len with target len 20 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, JFFS_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT2); // compare ret len with target len 20 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs669(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_669", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_670.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_670.cpp deleted file mode 100644 index a710b421..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_670.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, JFFS_STANDARD_NAME_LENGTH + 1, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH + 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 25); // read buffer len 25 - ICUNIT_GOTO_EQUAL(len, 25, len, EXIT2); // compare ret len with target len 25 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, JFFS_STANDARD_NAME_LENGTH + 1, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH + 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 25); // read buffer len 25 - ICUNIT_GOTO_EQUAL(len, 25, len, EXIT2); // compare ret len with target len 25 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs670(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_670", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_671.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_671.cpp deleted file mode 100644 index d3819d50..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_671.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 1, off, EXIT2); - - len = pwrite(fd, writebuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 1, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read buffer len 10 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 1, off, EXIT2); - - len = pwrite64(fd, writebuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 1, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read buffer len 10 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs671(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_671", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_672.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_672.cpp deleted file mode 100644 index eb041fd0..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_672.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, strlen(writebuf), 0xffff); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0xffff - 1, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0xffff - 1, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + 1, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, strlen(writebuf), 0xffff); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0xffff - 1, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0xffff - 1, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + 1, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs672(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_672", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_673.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_673.cpp deleted file mode 100644 index a987a76f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_673.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, 10, off + 1); // write 10 bytes from fd at offset off + 1 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf) + 1, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, 10, off + 1); // write 10 bytes from fd at offset off + 1 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf) + 1, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs673(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_673", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_674.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_674.cpp deleted file mode 100644 index 91a6cbc8..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_674.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, 10, off); // write 10 bytes from fd at offset off - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "12345678901234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, 10, off); // write 10 bytes from fd at offset off - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "12345678901234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs674(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_674", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_675.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_675.cpp deleted file mode 100644 index 8c10a59b..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_675.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, 10, off - 1); // write 10 bytes from fd at offset off - 1 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf) - 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567891234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, 10, off - 1); // write 10 bytes from fd at offset off - 1 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf) - 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567891234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs675(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_675", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_676.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_676.cpp deleted file mode 100644 index b05e2e0c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_676.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek64(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, 10, -1); // write 10 bytes from fd at offset -1 - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - off = lseek64(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek64(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, 10, -1); // write 10 bytes from fd at offset -1 - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - off = lseek64(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs676(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_676", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_690.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_690.cpp deleted file mode 100644 index a6e2361a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_690.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs690(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_690", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_694.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_694.cpp deleted file mode 100644 index 1a9f372a..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_694.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname2, "/test"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs694(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_694", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_696.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_696.cpp deleted file mode 100644 index b9c87281..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_696.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove("//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs696(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_696", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_697.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_697.cpp deleted file mode 100644 index 867d6be4..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_697.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove("/"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs697(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_697", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_700.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_700.cpp deleted file mode 100644 index 60401316..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_700.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - int ret, i; - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - umount(JFFS_MAIN_DIR0); - for (i = 0; i < 30; i++) { // test 30 times - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, MS_RDONLY, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - umount(JFFS_MAIN_DIR0); -EXIT: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs700(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_700", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_701.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_701.cpp deleted file mode 100644 index 7fc18b94..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_701.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - int ret, i; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - umount(JFFS_MAIN_DIR0); - for (i = 0; i < 30; i++) { // test 30 times - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, MS_RDONLY, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - umount(JFFS_MAIN_DIR0); -EXIT: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs701(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_701", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_807.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_807.cpp deleted file mode 100644 index 7d05bc61..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_807.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 i; - INT32 index = 0; - INT32 fd[JFFS_CREATFILE_NUM] = {}; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - strcat(bufname1, "/test0"); - strcat(bufname2, "/test1"); - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - for (i = 0; i < JFFS_CREATFILE_NUM; i++) { - snprintf(pathname1, JFFS_STANDARD_NAME_LENGTH, "/storage/test/test1/file%d.txt", index); - fd[index] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - - if (fd[index] == -1) { - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - index++; - } - - ret = rename(bufname1, bufname2); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - index--; - for (i = index; i >= 0; i--) { - snprintf(pathname1, JFFS_STANDARD_NAME_LENGTH, "/storage/test/test1/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT1: - for (i = index; i >= 0; i--) { - snprintf(pathname1, JFFS_STANDARD_NAME_LENGTH, "/storage/test/test1/file%d.txt", i); - unlink(pathname1); - } -EXIT: - rmdir(bufname1); - rmdir(bufname2); - rmdir(pathname); - return JFFS_NO_ERROR; -} - -/* - * -* -@test IT_FS_JFFS_807 -* -@tspec The function test for filesystem -* -@ttitle test1 and not null test2 called API rename,rename test1 to test2 -* -@tprecon The filesystem module is open -* -@tbrief -1. mkdir test1 and test2; -2. open creat five files in test1; -3. rename test1 to test2; -4. unlink files in test1 and rmdir test1 and test2. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark - * - */ - -VOID ItFsJffs807(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_807", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_808.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_jffs_808.cpp deleted file mode 100644 index ad2e8576..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_jffs_808.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_RDWR | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - closedir(dir); - goto EXIT1; -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - close(fd); -EXIT1: - remove(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -/* - * @ingroup jffs - * API test - * @brief 娴嬭瘯鏈夋枃浠舵垨鐩綍鎵撳紑鏃跺嵏杞絡ffs鏂囦欢绯荤粺 - * @par description: Test that umount the jffs filesystem when any file or directory is open - * @par precon: jffs moudle open - * 1銆乷pen a file and umount jffs.\n - * 2銆乧lose the file and umount jffs.\n - * 3銆乷pen a directory and umount jffs.\n - * 4銆乧lose the directory and umount jffs.\n - * 1銆乺eturn failed. \n - * 2銆乺eturn success. \n - * 3銆乺eturn failed. \n - * 4銆乺eturn success. \n - */ - -VOID ItFsJffs808(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_808", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_test_link_001.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_test_link_001.cpp deleted file mode 100644 index f7b70a18..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_test_link_001.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 len, ret; - struct stat statBuf1 = {0}; - struct stat statBuf2 = {0}; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890abcde&"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - - ret = link("/lib/libc.so", pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EXDEV, errno, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = link(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname1, &statBuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf1.st_nlink, 2, statBuf1.st_nlink, EXIT2); - - ret = stat(pathname2, &statBuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf2.st_ino, statBuf1.st_ino, statBuf2.st_ino, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf2.st_mode, statBuf1.st_mode, statBuf2.st_mode, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf2.st_nlink, statBuf1.st_nlink, statBuf2.st_nlink, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf2.st_uid, statBuf1.st_uid, statBuf2.st_uid, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf2.st_gid, statBuf1.st_gid, statBuf2.st_gid, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf2.st_size, statBuf1.st_size, statBuf2.st_size, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf2.st_blksize, statBuf1.st_blksize, statBuf2.st_blksize, EXIT2); - - fd1 = open(pathname2, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - len = read(fd1, readbuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT4); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - memset(&statBuf1, 0, sizeof(struct stat)); - ret = stat(pathname1, &statBuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf1.st_nlink, 1, statBuf1.st_nlink, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT4: - close(fd1); - goto EXIT2; -EXIT3: - close(fd); - goto EXIT1; -EXIT2: - unlink(pathname2); -EXIT1: - unlink(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestLink001(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_LINK_001", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_test_link_002.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_test_link_002.cpp deleted file mode 100644 index 135c4d9f..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_test_link_002.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 len, ret; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890abcde&"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = link(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd1 = open(pathname2, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT4); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT4: - close(fd1); - goto EXIT2; -EXIT3: - close(fd); - goto EXIT1; -EXIT2: - unlink(pathname2); -EXIT1: - unlink(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestLink002(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_LINK_002", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_test_link_003.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_test_link_003.cpp deleted file mode 100644 index 002ce30e..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_test_link_003.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR filebuf[PATH_MAX + 2] = {""}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME03 }; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME04 }; - - for (int i = 0; i < PATH_MAX + 1; i++) { - strcat(filebuf, "d"); - } - filebuf[PATH_MAX + 1] = '\0'; - ret = link(filebuf, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT); - - ret = link("dddddddddddddd", pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = link(JFFS_MAIN_DIR0, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EPERM, errno, EXIT); - - fd = creat(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = link(pathname2, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = creat(pathname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = link(pathname3, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT4); - - ret = unlink(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT5: - close(fd); -EXIT4: - unlink(pathname3); -EXIT3: - unlink(pathname1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - unlink(pathname2); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestLink003(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_LINK_003", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_test_linkat_001.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_test_linkat_001.cpp deleted file mode 100644 index d649f6a3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_test_linkat_001.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 len, ret; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890abcde&"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = "originfile"; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = "linkfile"; - INT32 olddirFd = -1; - INT32 newdirFd = -1; - DIR *olddir = NULL; - DIR *newdir = NULL; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - olddir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(olddir, NULL, olddir, EXIT1); - - olddirFd = dirfd(olddir); - ICUNIT_GOTO_NOT_EQUAL(olddirFd, JFFS_IS_ERROR, olddirFd, EXIT2); - - ret = mkdir(pathname2, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - newdir = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(newdir, NULL, newdir, EXIT3); - - newdirFd = dirfd(newdir); - ICUNIT_GOTO_NOT_EQUAL(newdirFd, JFFS_IS_ERROR, newdirFd, EXIT4); - - fd = openat(olddirFd, pathname3, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT4); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT6); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - ret = linkat(olddirFd, pathname3, newdirFd, pathname4, 0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT5); - - ret = unlinkat(olddirFd, pathname3, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - fd1 = openat(newdirFd, pathname4, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT5); - - len = read(fd1, readbuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT8); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT8); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT8); - - ret = unlinkat(newdirFd, pathname4, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - ret = closedir(newdir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = closedir(olddir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT8: - close(fd1); -EXIT7: - unlinkat(newdirFd, pathname4, 0); - goto EXIT5; -EXIT6: - close(fd); -EXIT5: - unlinkat(olddirFd, pathname3, 0); -EXIT4: - closedir(newdir); -EXIT3: - rmdir(pathname2); -EXIT2: - closedir(olddir); -EXIT1: - rmdir(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestLinkat001(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_LINKAT_001", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_test_linkat_002.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_test_linkat_002.cpp deleted file mode 100644 index 35759850..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_test_linkat_002.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 len, ret; - struct stat statBuf = {0}; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890abcde&"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = "originfile"; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = "symlinkfile"; - CHAR pathname6[JFFS_STANDARD_NAME_LENGTH] = "linkfile"; - CHAR pathname7[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname8[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname9[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - INT32 dirFd0 = -1; - INT32 dirFd1 = -1; - INT32 dirFd2 = -1; - DIR *dir0 = NULL; - DIR *dir1 = NULL; - DIR *dir2 = NULL; - - /* get dirfd0 */ - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir0 = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir0, NULL, dir0, EXIT1); - - dirFd0 = dirfd(dir0); - ICUNIT_GOTO_NOT_EQUAL(dirFd0, JFFS_IS_ERROR, dirFd0, EXIT2); - - /* get dirfd1 */ - ret = mkdir(pathname2, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dir1 = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir1, NULL, dir1, EXIT3); - - dirFd1 = dirfd(dir1); - ICUNIT_GOTO_NOT_EQUAL(dirFd1, JFFS_IS_ERROR, dirFd1, EXIT4); - - /* get dirfd2 */ - ret = mkdir(pathname3, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - dir2 = opendir(pathname3); - ICUNIT_GOTO_NOT_EQUAL(dir2, NULL, dir2, EXIT5); - - dirFd2 = dirfd(dir2); - ICUNIT_GOTO_NOT_EQUAL(dirFd2, JFFS_IS_ERROR, dirFd2, EXIT6); - - /* creat original file */ - fd = openat(dirFd0, pathname4, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT6); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT8); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - /* creat a symbol link to the original file */ - strcat(pathname7, "/"); - strcat(pathname7, pathname4); - ret = symlinkat(pathname7, dirFd1, pathname5); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT7); - - len = readlinkat(dirFd1, pathname5, readbuf, sizeof(readbuf)); - ICUNIT_GOTO_EQUAL(len, strlen(pathname7), len, EXIT9); - ICUNIT_GOTO_STRING_EQUAL(readbuf, pathname7, readbuf, EXIT9); - - /* creat a hard link to the symlink file */ - ret = linkat(dirFd1, pathname5, dirFd2, pathname6, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT9); - - strcat(pathname9, "/"); - strcat(pathname9, pathname6); - ret = stat(pathname9, &statBuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT10); - ICUNIT_GOTO_EQUAL(statBuf.st_mode & S_IFMT, S_IFLNK, statBuf.st_mode & S_IFMT, EXIT10); - ICUNIT_GOTO_EQUAL(statBuf.st_size, strlen(pathname7), statBuf.st_size, EXIT10); - - len = readlink(pathname9, readbuf, sizeof(readbuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_IS_ERROR, len, EXIT10); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT10); - - ret = unlink(pathname9); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT10); - - /* creat a hard link to the original file by linking to the symlink file */ - ret = linkat(dirFd1, pathname5, dirFd2, pathname6, AT_SYMLINK_FOLLOW); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT9); - - memset(&statBuf, 0, sizeof(struct stat)); - ret = stat(pathname9, &statBuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT10); - ICUNIT_GOTO_EQUAL(statBuf.st_mode & S_IFMT, S_IFREG, statBuf.st_mode & S_IFMT, EXIT10); - - fd1 = openat(dirFd2, pathname6, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT10); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd1, readbuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT11); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT11); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT11); - - ret = unlinkat(dirFd2, pathname6, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT10); - - ret = unlinkat(dirFd1, pathname5, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT9); - - ret = unlinkat(dirFd0, pathname4, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - ret = closedir(dir2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = closedir(dir1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = closedir(dir0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT11: - close(fd1); -EXIT10: - unlinkat(dirFd2, pathname6, 0); -EXIT9: - unlinkat(dirFd1, pathname5, 0); - goto EXIT7; -EXIT8: - close(fd); -EXIT7: - unlinkat(dirFd0, pathname4, 0); -EXIT6: - closedir(dir2); -EXIT5: - rmdir(pathname3); -EXIT4: - closedir(dir1); -EXIT3: - rmdir(pathname2); -EXIT2: - closedir(dir0); -EXIT1: - rmdir(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestLinkat002(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_LINKAT_002", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_test_linkat_003.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_test_linkat_003.cpp deleted file mode 100644 index 83190062..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_test_linkat_003.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = "symlinkfile1"; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = "symlinkfile2"; - CHAR pathname6[JFFS_STANDARD_NAME_LENGTH] = "linkfile"; - CHAR pathname7[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname8[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname9[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - INT32 dirFd0 = -1; - INT32 dirFd1 = -1; - INT32 dirFd2 = -1; - DIR *dir0 = NULL; - DIR *dir1 = NULL; - DIR *dir2 = NULL; - - /* get dirfd0 */ - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir0 = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir0, NULL, dir0, EXIT1); - - dirFd0 = dirfd(dir0); - ICUNIT_GOTO_NOT_EQUAL(dirFd0, JFFS_IS_ERROR, dirFd0, EXIT2); - - /* get dirfd1 */ - ret = mkdir(pathname2, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dir1 = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir1, NULL, dir1, EXIT3); - - dirFd1 = dirfd(dir1); - ICUNIT_GOTO_NOT_EQUAL(dirFd1, JFFS_IS_ERROR, dirFd1, EXIT4); - - /* get dirfd2 */ - ret = mkdir(pathname3, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - dir2 = opendir(pathname3); - ICUNIT_GOTO_NOT_EQUAL(dir2, NULL, dir2, EXIT5); - - dirFd2 = dirfd(dir2); - ICUNIT_GOTO_NOT_EQUAL(dirFd2, JFFS_IS_ERROR, dirFd2, EXIT6); - - /* creat a dangling symbolic link */ - strcat(pathname9, "/not_exist"); - ret = symlinkat(pathname9, dirFd1, pathname5); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT6); - - /* creat a hard link to the dangling symlink file */ - ret = linkat(dirFd1, pathname5, dirFd2, pathname6, 1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT7); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT7); - - ret = linkat(dirFd1, pathname5, dirFd2, pathname6, AT_SYMLINK_FOLLOW); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT7); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT7); - - ret = linkat(dirFd1, pathname5, dirFd2, pathname6, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - ret = unlinkat(dirFd1, pathname5, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - ret = unlinkat(dirFd2, pathname6, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT8); - - /* creat two looped symbolic link */ - strcat(pathname7, "/"); - strcat(pathname7, pathname4); - ret = symlinkat(pathname7, dirFd1, pathname5); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT6); - - strcat(pathname8, "/"); - strcat(pathname8, pathname5); - ret = symlinkat(pathname8, dirFd0, pathname4); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT7); - - /* creat a hard link to the looped symlink file */ - ret = linkat(dirFd1, pathname5, dirFd2, pathname6, AT_SYMLINK_FOLLOW); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT9); - ICUNIT_GOTO_EQUAL(errno, ELOOP, errno, EXIT9); - - ret = linkat(dirFd1, pathname5, dirFd2, pathname6, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT9); - - /* remove all */ - ret = unlinkat(dirFd2, pathname6, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT10); - - ret = unlinkat(dirFd0, pathname4, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT9); - - ret = unlinkat(dirFd1, pathname5, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - ret = closedir(dir2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = closedir(dir1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = closedir(dir0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT10: - unlinkat(dirFd2, pathname6, 0); -EXIT9: - unlinkat(dirFd0, pathname4, 0); - goto EXIT7; -EXIT8: - unlinkat(dirFd2, pathname6, 0); -EXIT7: - unlinkat(dirFd1, pathname5, 0); -EXIT6: - closedir(dir2); -EXIT5: - rmdir(pathname3); -EXIT4: - closedir(dir1); -EXIT3: - rmdir(pathname2); -EXIT2: - closedir(dir0); -EXIT1: - rmdir(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestLinkat003(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_LINKAT_003", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_001.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_001.cpp deleted file mode 100644 index 338927ad..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_001.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2021-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - - fd = creat(pathname1, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, MS_RDONLY, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - fd = open(pathname1, O_RDWR); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT4); - - ret = symlink(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT5); - - ret = rename(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT5); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT5: - unlink(pathname2); - goto EXIT3; -EXIT4: - close(fd); -EXIT3: - umount(JFFS_MAIN_DIR0); -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - unlink(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestMountRdonly001(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_MOUNT_RDONLY_001", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_002.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_002.cpp deleted file mode 100644 index 7fc30971..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_002.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2021-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, MS_RDONLY, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - fd = creat(pathname1, 0755); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); - - fd = open(pathname1, O_CREAT | O_RDONLY, 0755); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); - - fd = open(pathname1, O_CREAT | O_RDWR, 0755); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); - - ret = mkdir(pathname1, 0755); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - remove(pathname1); -EXIT1: - umount(JFFS_MAIN_DIR0); - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestMountRdonly002(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_MOUNT_RDONLY_002", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_003.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_003.cpp deleted file mode 100644 index 68cd07aa..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_test_mount_rdonly_003.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2021-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - const CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd = creat(pathname1, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(ret, strlen(writebuf), ret, EXIT4); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, MS_RDONLY, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - fd = open(pathname1, O_RDWR); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT4); - - fd = open(pathname1, O_RDONLY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT4); - - ret = read(fd, readbuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(ret, strlen(writebuf), ret, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT4); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT4: - close(fd); -EXIT3: - umount(JFFS_MAIN_DIR0); -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - unlink(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestMountRdonly003(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_MOUNT_RDONLY_003", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_test_readlink_001.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_test_readlink_001.cpp deleted file mode 100644 index e80aa975..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_test_readlink_001.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 ret; - size_t readSize = 3; - CHAR filebuf[PATH_MAX + 2] = {""}; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - - for (int i = 0; i < PATH_MAX + 1; i++) { - strcat(filebuf, "d"); - } - filebuf[PATH_MAX + 1] = '\0'; - - fd = creat(pathname1, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = symlink(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = readlink(pathname1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT3); - - ret = readlink(pathname2, readbuf, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT3); - - ret = readlink(filebuf, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT3); - - ret = readlink(pathname2, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(ret, strlen(pathname1), ret, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, pathname1, readbuf, EXIT3); - - ret = readlink(pathname2, readbuf, readSize); - ICUNIT_GOTO_EQUAL(ret, readSize - 1, ret, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "/s", readbuf, EXIT3); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - return JFFS_NO_ERROR; - -EXIT3: - unlink(pathname2); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestReadlink001(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_READLINK_001", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_test_symlink_001.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_test_symlink_001.cpp deleted file mode 100644 index ceabe1c3..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_test_symlink_001.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 len, ret; - struct stat statBuf1 = {0}; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890abcde&"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = symlink(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname2, &statBuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf1.st_mode & S_IFMT, S_IFLNK, statBuf1.st_mode & S_IFMT, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf1.st_size, strlen(pathname1), statBuf1.st_size, EXIT2); - - len = readlink(pathname2, readbuf, sizeof(readbuf)); - ICUNIT_GOTO_EQUAL(len, strlen(pathname1), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, pathname1, readbuf, EXIT2); - - fd1 = open(pathname2, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd1, readbuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT4); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT4: - close(fd1); - goto EXIT2; -EXIT3: - close(fd); - goto EXIT1; -EXIT2: - unlink(pathname2); -EXIT1: - unlink(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestSymlink001(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_SYMLINK_001", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_test_symlink_002.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_test_symlink_002.cpp deleted file mode 100644 index fb647dba..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_test_symlink_002.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 len, ret; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - - ret = symlink(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - len = readlink(pathname2, readbuf, sizeof(readbuf)); - ICUNIT_GOTO_EQUAL(len, strlen(pathname1), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, pathname1, readbuf, EXIT1); - - ret = symlink(pathname2, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - memset(readbuf, 0, sizeof(readbuf)); - len = readlink(pathname1, readbuf, sizeof(readbuf)); - ICUNIT_GOTO_EQUAL(len, strlen(pathname2), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, pathname2, readbuf, EXIT2); - - fd = open(pathname2, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ELOOP, errno, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT2: - unlink(pathname1); -EXIT1: - unlink(pathname2); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestSymlink002(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_SYMLINK_002", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_test_symlink_003.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_test_symlink_003.cpp deleted file mode 100644 index 463f3afb..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_test_symlink_003.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR filebuf[PATH_MAX + 2] = {""}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME03 }; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME04 }; - - for (int i = 0; i < PATH_MAX + 1; i++) { - strcat(filebuf, "d"); - } - filebuf[PATH_MAX + 1] = '\0'; - ret = symlink(filebuf, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT); - - ret = symlink("dddddddddddddd", pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname2, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = symlink("aaaaaaaaaaaaaaa", pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT1); - - ret = symlink("", pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd = open(pathname3, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - fd = creat(pathname4, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = symlink(pathname4, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - fd = open(pathname5, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT5); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - fd = open(pathname5, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT7); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT7); - - ret = unlink(pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - ret = unlink(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT7: - unlink(pathname5); - goto EXIT2; -EXIT6: - close(fd); -EXIT5: - unlink(pathname5); - goto EXIT3; -EXIT4: - close(fd); -EXIT3: - unlink(pathname4); -EXIT2: - unlink(pathname3); -EXIT1: - unlink(pathname2); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestSymlink003(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_SYMLINK_003", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/It_vfs_test_symlinkat_001.cpp b/testsuites/unittest/fs/jffs/full/It_vfs_test_symlinkat_001.cpp deleted file mode 100644 index 2124ab0c..00000000 --- a/testsuites/unittest/fs/jffs/full/It_vfs_test_symlinkat_001.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 len, ret; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890abcde&"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = "originfile"; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = "linkfile"; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - INT32 olddirFd = -1; - INT32 newdirFd = -1; - DIR *olddir = NULL; - DIR *newdir = NULL; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - olddir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(olddir, NULL, olddir, EXIT1); - - olddirFd = dirfd(olddir); - ICUNIT_GOTO_NOT_EQUAL(olddirFd, JFFS_IS_ERROR, olddirFd, EXIT2); - - ret = mkdir(pathname2, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - newdir = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(newdir, NULL, newdir, EXIT3); - - newdirFd = dirfd(newdir); - ICUNIT_GOTO_NOT_EQUAL(newdirFd, JFFS_IS_ERROR, newdirFd, EXIT4); - - fd = openat(olddirFd, pathname3, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT4); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT6); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - strcat(pathname5, "/"); - strcat(pathname5, pathname3); - ret = symlinkat(pathname5, newdirFd, pathname4); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT5); - - len = readlinkat(newdirFd, pathname4, readbuf, sizeof(readbuf)); - ICUNIT_GOTO_EQUAL(len, strlen(pathname5), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, pathname5, readbuf, EXIT2); - - fd1 = openat(newdirFd, pathname4, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, JFFS_IS_ERROR, fd1, EXIT5); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd1, readbuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT8); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT8); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT8); - - ret = unlinkat(newdirFd, pathname4, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - ret = unlinkat(olddirFd, pathname3, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = closedir(newdir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = closedir(olddir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT8: - close(fd1); -EXIT7: - unlinkat(newdirFd, pathname4, 0); - goto EXIT5; -EXIT6: - close(fd); -EXIT5: - unlinkat(olddirFd, pathname3, 0); -EXIT4: - closedir(newdir); -EXIT3: - rmdir(pathname2); -EXIT2: - closedir(olddir); -EXIT1: - rmdir(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestSymlinkat001(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_SYMLINKAT_001", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_001.cpp b/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_001.cpp deleted file mode 100644 index 10c9c819..00000000 --- a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_001.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -#define FILEPATH "/storage/testfdopen.txt" -#define TESTFILE "/storage/testfopen" -#define MAXFD 512 -#define MINFD 8 - -static int TestCase0(void) -{ - FILE *fp = NULL; - int fd = -1; - char buf[10U] = "123456789"; - char rdbuf[10U] = {0}; - int ret = -1; - - fd = open(FILEPATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - /* r+ */ - fp = fdopen(fd, "r+"); - ICUNIT_GOTO_NOT_EQUAL(fp, JFFS_TO_NULL, fp, EXIT); - - ret = fwrite(buf, 10U, 1, fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fseek(fp, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fread(rdbuf, 10U, 1, fp); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - - ret = fclose(fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - fp = NULL; - - /* a+ /appen + rw */ - fd = open(FILEPATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - fp = fdopen(fd, "a+"); - ICUNIT_GOTO_NOT_EQUAL(fp, JFFS_TO_NULL, fp, EXIT); - - ret = fwrite(buf, 10U, 1, fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fseek(fp, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fread(rdbuf, 10U, 1, fp); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - - ret = fclose(fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - fp = NULL; - - /* r / only read */ - fd = open(FILEPATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - fp = fdopen(fd, "r"); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_TO_NULL, fd, EXIT); - - ret = fwrite(buf, 10u, 1, fp); - ICUNIT_GOTO_NOT_EQUAL(ret, 1, ret, EXIT); - - ret = fclose(fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - fp = NULL; - - /* w / only write */ - fd = open(FILEPATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - fp = fdopen(fd, "w"); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_TO_NULL, fd, EXIT); - - ret = fread(rdbuf, 10u, 1, fp); - ICUNIT_GOTO_NOT_EQUAL(ret, 1, ret, EXIT); - - ret = fclose(fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - fp = NULL; - - /* w+ */ - fd = open(FILEPATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - fp = fdopen(fd, "w+"); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_TO_NULL, fd, EXIT); - - ret = fwrite(buf, 10u, 1, fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fseek(fp, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fread(rdbuf, 10u, 1, fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fclose(fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - fp = NULL; - - /* a */ - fd = open(FILEPATH, O_WRONLY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - fp = fdopen(fd, "a"); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_TO_NULL, fd, EXIT); - - ret = fwrite(buf, 10u, 1, fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fseek(fp, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fread(rdbuf, 10u, 1, fp); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = fclose(fp); - - return JFFS_NO_ERROR; - -EXIT: - if(fp != NULL) { - fclose(fp); - } else { - remove(FILEPATH); - } - - return JFFS_IS_ERROR; -} - -/* error */ -static int TestCase1(void) -{ - FILE *fp = NULL; - int fd = -1; - int errFd = -1; - int i = 0; - - fd = open(FILEPATH, O_RDWR, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - /* EIVNAL */ - fp = fdopen(fd, "hello"); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_TO_NULL, fd, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - close(fd); - remove(TESTFILE); - - return JFFS_NO_ERROR; - -EXIT: - close(fd); - remove(TESTFILE); - - return JFFS_IS_ERROR; -} - -static int TestCase(void) -{ - int ret = -1; - int fd = -1; - - fd = open(FILEPATH, O_RDWR | O_EXCL | O_CREAT, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = TestCase0(); - ICUNIT_GOTO_EQUAL(ret, JFFS_TO_NULL, ret, EXIT); - - ret = TestCase1(); - ICUNIT_GOTO_EQUAL(ret, JFFS_TO_NULL, ret, EXIT); - - close(fd); - remove(FILEPATH); - - return JFFS_NO_ERROR; - -EXIT: - close(fd); - remove(FILEPATH); - - return JFFS_IS_ERROR; -} - -void ItTestFsJffs001(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_001", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_002.cpp b/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_002.cpp deleted file mode 100644 index ebdbdef2..00000000 --- a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_002.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -#include -#include -#include - -#define FILEPATH "/storage/testfstatvfs.txt" -#define FILEPATHLEN (strlen(FILEPATH) + 1U) - -static int TestCase0(void) -{ - INT32 fd = -1; - INT32 ret = 0; - struct statvfs fileInfo = {0}; - - fd=open(FILEPATH, O_RDWR, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, 1, fd, EXIT); - - ret= fstatvfs(fd, &fileInfo); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - /*ICUNIT_GOTO_EQUAL(fileInfo.f_flag, 0, fileInfo.f_flag, EXIT);*/ - close(fd); - return JFFS_NO_ERROR; - -EXIT: - close(fd); - return JFFS_IS_ERROR; -} - -static int TestCase1(void) -{ - INT32 fd = -1; - INT32 ret= 0; - INT32 errFd = -1; - struct statvfs fileInfo = {0}; - - fd = open(FILEPATH, O_RDWR, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - /* EBADF */ - ret=fstatvfs(errFd, &fileInfo); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - /* EBADF(When the file does not exist, an error occurs when the file is - converted from the fd file to the system FD file.) */ - close(fd); - ret= remove(FILEPATH); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - errno =0; - ret=fstatvfs(fd, &fileInfo); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - close(fd); - - return JFFS_NO_ERROR; -EXIT: - close(fd); - return JFFS_IS_ERROR; -} - -static int TestCase(void) -{ - INT32 fd=-1; - int ret =-1; - - fd=open(FILEPATH, O_CREAT | O_RDWR | O_EXCL, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, 1, fd, EXIT); - - close(fd); - ret= TestCase0(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret= TestCase1(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - remove(FILEPATH); - return JFFS_NO_ERROR; -EXIT: - remove(FILEPATH); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs002(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_002", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_003.cpp b/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_003.cpp deleted file mode 100644 index ad5f3264..00000000 --- a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_003.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -#define DIRPATH1 "/storage/test1" -#define DIRPATH2 "/storage/test2" -#define TEST_MAXPATHLEN 4098 - -static int TestCase0(void) -{ - INT32 ret = -1; - INT32 dirFd = -1; - INT32 fd = -1; - INT32 len = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = DIRPATH1; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = DIRPATH2; - DIR *dir = NULL; - - ret = mkdir(pathname1, JFFS_FILE_MODE); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = renameat(AT_FDCWD, DIRPATH1, AT_FDCWD, DIRPATH2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dir = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dirFd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(dirFd, JFFS_IS_ERROR, dirFd, EXIT1); - - ret = strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test1.txt"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname2, O_EXCL | O_CREAT | O_RDWR, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, "01234567890", 11); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = renameat(dirFd, "test1.txt", dirFd, "test2.txt"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink("/storage/test2/test2.txt"); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = rmdir(DIRPATH2); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); -EXIT2: - unlink(pathname2); - closedir(dir); -EXIT: - rmdir(DIRPATH2); - return JFFS_NO_ERROR; -} - -static int TestCase1(void) -{ - int ret = -1; - char pathName[TEST_MAXPATHLEN] = {0}; - int errFd = -1; - /* ENAMETOOLONG */ - ret = memset_s(pathName, TEST_MAXPATHLEN, 1, TEST_MAXPATHLEN); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = renameat(AT_FDCWD, pathName, AT_FDCWD, pathName); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, ret, EXIT); - /* EINVAL */ - ret = renameat(AT_FDCWD, "\0", AT_FDCWD, "\0"); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - /* ENOENT */ - ret = renameat(errFd, "/storage/test.txt", errFd, "/storage/test1.txt"); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_IS_ERROR; -} - -static int TestCase(void) -{ - int ret = -1; - ret = TestCase0(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = TestCase1(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_IS_ERROR; -} - -void ItTestFsJffs003(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_003", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_004.cpp b/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_004.cpp deleted file mode 100644 index 24562d37..00000000 --- a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_004.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -#define MOUNT_FILEPATH "/storage/mounts" -#define TESTFILE "/storage/hellomnt" -#define MAXFD 512 -#define MINFD 8 - -static int TestCase0(void) -{ - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = MOUNT_FILEPATH; - struct mntent *mnt = NULL; - FILE *fp = NULL; - int ret = -1; - struct mntent mountsData = { - .mnt_fsname = "jffs", - .mnt_dir = "/", - .mnt_type = "jffs", - .mnt_opts = nullptr, - .mnt_freq = 0, - .mnt_passno = 0, - }; - - fp = setmntent(pathname1, "r+"); - ICUNIT_GOTO_NOT_EQUAL(fp, NULL, fp, EXIT); - - mnt = getmntent(fp); - ICUNIT_GOTO_NOT_EQUAL(mnt, NULL, mnt, EXIT); - - ret = strcmp(mnt->mnt_fsname, mountsData.mnt_fsname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = strcmp(mnt->mnt_dir, mountsData.mnt_dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = strcmp(mnt->mnt_type, mountsData.mnt_type); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ICUNIT_GOTO_EQUAL(mnt->mnt_freq, mountsData.mnt_freq, mnt.mnt_freq, EXIT); - ICUNIT_GOTO_EQUAL(mnt->mnt_passno, mountsData.mnt_passno, mnt.mnt_passno, EXIT); - - endmntent(fp); - return JFFS_NO_ERROR; - -EXIT: - endmntent(fp); - return JFFS_IS_ERROR; -} - -static int TestCase1(void) -{ - int ret = -1; - FILE *fp = NULL; - int i = 0; - int fd =-1; - /* EINVAL */ - fp = setmntent(MOUNT_FILEPATH, "+r"); - ICUNIT_GOTO_EQUAL(fp, NULL, fp, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, fp, EXIT); - - /* EISDIR */ - fp = setmntent("./", "r+"); - ICUNIT_GOTO_EQUAL(fp, NULL, fp, EXIT); - ICUNIT_GOTO_EQUAL(errno, EISDIR, fp, EXIT); - /* ENOENT */ - fp = setmntent("/storage/testmnt", "r+"); - ICUNIT_GOTO_EQUAL(fp, NULL, fp, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, fp, EXIT); - remove(TESTFILE); - - return JFFS_NO_ERROR; -EXIT: - remove(TESTFILE); - return JFFS_IS_ERROR; -} - -static int TestCase(void) -{ - int ret = -1; - ret = TestCase0(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = TestCase1(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - return JFFS_IS_ERROR; -} - -void ItTestFsJffs004(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_004", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_100.cpp b/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_100.cpp deleted file mode 100644 index d21b1ca9..00000000 --- a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_100.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static int TestCase(void) -{ - INT32 ret, dirFd, fd, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - DIR *dir = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dirFd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(dirFd, JFFS_IS_ERROR, dirFd, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); - unlink(pathname1); - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs100(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_100", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_101.cpp b/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_101.cpp deleted file mode 100644 index e84f0d8a..00000000 --- a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_101.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -#define TEST_STRLEN 30 - -static int TestCase(void) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname[TEST_STRLEN] = JFFS_MAIN_DIR0; - CHAR pathname1[TEST_STRLEN] = JFFS_PATH_NAME0; - CHAR pathname2[TEST_STRLEN] = JFFS_PATH_NAME0; - CHAR *pathname3 = NULL; - CHAR buf1[TEST_STRLEN] = ""; - CHAR buf2[TEST_STRLEN] = ""; - CHAR *pret = NULL; - DIR *dir = NULL; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - pathname3 = pathname2; - (void)strcat_s(pathname2, TEST_STRLEN, "/test1"); - ret = mkdir(pathname2, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname2, O_DIRECTORY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - /* EBADF */ - ret = fchdir(-1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EBADF, ret, EXIT1); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - pret = getcwd(buf1, TEST_STRLEN); - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(buf1, pathname, buf1, EXIT1); - - ret = fchdir(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - pret = getcwd(buf2, TEST_STRLEN); - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(buf2, pathname3, buf2, EXIT1); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - if (fd > 0) { - close(fd); - } - unlink(pathname2); -EXIT: - rmdir(pathname2); - rmdir(pathname1); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs101(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_101", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_102.cpp b/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_102.cpp deleted file mode 100644 index 52211c12..00000000 --- a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_102.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -#define TEST_STRLEN 30 - -static int TestCase(void) -{ - INT32 fd = 0; - INT32 ret = JFFS_IS_ERROR; - CHAR pathname1[TEST_STRLEN] = JFFS_PATH_NAME0; - struct stat info = {0}; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - /* EBADF */ - ret = fchmod(-1, S_IREAD); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EBADF, ret, EXIT1); - - /* S_IRWXU */ - ret = fchmod(fd, S_IRWXU); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IRWXU; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* S_IRUSR */ - ret = fchmod(fd, S_IRUSR); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IRUSR; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* S_IWUSR */ - ret = fchmod(fd, S_IWUSR); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IWUSR; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* S_IXUSR */ - ret = fchmod(fd, S_IXUSR); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IXUSR; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* S_IRWXG */ - ret = fchmod(fd, S_IRWXG); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IRWXG; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* SIRGRP */ - ret = fchmod(fd, S_IRGRP); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IRGRP; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* S_IXGRP */ - ret = fchmod(fd, S_IXGRP); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IXGRP; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* S_IRWXO */ - ret = fchmod(fd, S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode &S_IRWXO; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* S_IROTH */ - ret = fchmod(fd, S_IROTH); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IROTH; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* S_IXOTH */ - ret = fchmod(fd, S_IXOTH); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IXOTH; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - if (fd > 0) { - close(fd); - } - unlink(pathname1); -EXIT: - rmdir(pathname1); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs102(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_102", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_103.cpp b/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_103.cpp deleted file mode 100644 index b4cec5c4..00000000 --- a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_103.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -#define TEST_STRLEN 30 - -static int TestCase(void) -{ - INT32 dirfd = 0; - INT32 fd = 0; - INT32 ret = JFFS_IS_ERROR; - CHAR pathname0[TEST_STRLEN] = JFFS_PATH_NAME0; - CHAR pathname1[TEST_STRLEN] = JFFS_PATH_NAME0; - CHAR pathname2[TEST_STRLEN] = JFFS_PATH_NAME0; - CHAR pathname3[TEST_STRLEN] = JFFS_PATH_NAME01; - CHAR filebuf[256] = "abcdeab89abcedcde01234567fghij9876543210abcdeabc89abcedfghde0123456710abcdeabcde012876543289abcedfghij987654345673210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfg10abcdeahij9876543289abcedfghlbcde01234567I0lalalalalalalal"; - struct stat info = {0}; - - ret = mkdir(pathname0, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, TEST_STRLEN, "/test1"); - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chmod(pathname1, S_IRUSR | S_IRGRP | S_IROTH); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - stat(pathname1, &info); - ret = info.st_mode & (S_IRUSR | S_IRGRP | S_IROTH); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - dirfd = open(pathname0, O_DIRECTORY); - ICUNIT_GOTO_NOT_EQUAL(dirfd, JFFS_IS_ERROR, dirfd, EXIT); - - /* ENAMETOOLONG */ - ret = fchmodat(dirfd, filebuf, S_IREAD, 0); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, ENAMETOOLONG, ret, EXIT); - - /* ENOENT */ - ret = fchmodat(-1, "test1", S_IREAD, 0); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, ENOENT, ret, EXIT); - - /* EINVAL */ - ret = fchmodat(dirfd, NULL, S_IREAD, 0); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - - /* absolute path */ - ret = fchmodat(0, pathname1, S_IRUSR | S_IWUSR | S_IXUSR, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - stat(pathname1, &info); - ret = info.st_mode & (S_IRUSR | S_IWUSR | S_IXUSR); - ICUNIT_GOTO_EQUAL(ret, (S_IRUSR | S_IWUSR | S_IXUSR), ret, EXIT); - - /* S_IRUSR | S_IWUSR | S_IXUSR */ - ret = fchmodat(dirfd, "test1", S_IRUSR | S_IWUSR | S_IXUSR, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - stat(pathname1, &info); - ret = info.st_mode & (S_IRUSR | S_IWUSR | S_IXUSR); - ICUNIT_GOTO_EQUAL(ret, (S_IRUSR | S_IWUSR | S_IXUSR), ret, EXIT); - - /* AT_FDCWD */ - ret = fchmodat(AT_FDCWD, "test/test1", S_IRUSR | S_IWUSR | S_IXUSR, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - stat(pathname1, &info); - ret = info.st_mode & (S_IRUSR | S_IWUSR | S_IXUSR); - ICUNIT_GOTO_EQUAL(ret, (S_IRUSR | S_IWUSR | S_IXUSR), ret, EXIT); - ret = close(dirfd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - /* ENOTDIR */ - dirfd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - ret = fchmodat(dirfd, "test1", S_IROTH | S_IWOTH | S_IXOTH, 0); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, ENOTDIR, ret, EXIT); - ret = close(dirfd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = remove(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dirfd = open(pathname0, O_DIRECTORY); - ICUNIT_GOTO_NOT_EQUAL(dirfd, JFFS_IS_ERROR, dirfd, EXIT); - - (void)strcat_s(pathname2, TEST_STRLEN, "/test.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = chmod(pathname2, S_IRUSR | S_IRGRP | S_IROTH); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - stat(pathname2, &info); - ret = info.st_mode & (S_IRUSR | S_IRGRP | S_IROTH); - ICUNIT_GOTO_EQUAL(ret, (S_IRUSR | S_IRGRP | S_IROTH), ret, EXIT); - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = fchmodat(dirfd, "test.txt", S_IRUSR | S_IWUSR | S_IXUSR, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - stat(pathname2, &info); - ret = info.st_mode & (S_IRUSR | S_IWUSR | S_IXUSR); - ICUNIT_GOTO_EQUAL(ret, (S_IRUSR | S_IWUSR | S_IXUSR), ret, EXIT); - - ret = close(dirfd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT1: - if (dirfd > 0) { - close(dirfd); - } - if (fd > 0) { - close(fd); - } -EXIT: - remove(pathname3); - remove(pathname2); - remove(pathname1); - remove(pathname0); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs103(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_103", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_106.cpp b/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_106.cpp deleted file mode 100644 index 202b3ecc..00000000 --- a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_106.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -#define TEST_STR "abcdefghijk" - -static int TestCase(void) -{ - INT32 ret = JFFS_IS_ERROR; - INT32 fd = 0; - INT32 len = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME0; - CHAR buf[JFFS_STANDARD_NAME_LENGTH] = TEST_STR; - CHAR str[JFFS_STANDARD_NAME_LENGTH] = ""; - FILE *ptr = NULL; - - fd = open(pathname1, O_CREAT, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - ptr = freopen(pathname1, "w+", stdin); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT1); - - ret = fwrite(buf, JFFS_STANDARD_NAME_LENGTH, 1, ptr); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - ret = fclose(ptr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd = open(pathname1, O_RDWR, 0777); - ret = read(fd, str, JFFS_STANDARD_NAME_LENGTH); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - ret = strcmp(buf, str); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - if (fd > 0) { - close(fd); - } -EXIT: - unlink(pathname1); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs106(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_106", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_112.cpp b/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_112.cpp deleted file mode 100644 index cbeea4dc..00000000 --- a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_112.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static int TestCase(void) -{ - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_MAIN_DIR0; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_MAIN_DIR0; - CHAR *dname = NULL; - INT32 ret; - INT32 fd = 0; - DIR *dir1 = NULL; - DIR *dir2 = NULL; - - dir1 = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir1, NULL, dir1, EXIT); - - ret = closedir(dir1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test123"); - ret = mkdir(pathname2, 0777); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - fd = open(pathname2, O_DIRECTORY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - dir2 = fdopendir(fd); - ICUNIT_GOTO_NOT_EQUAL(dir2, NULL, dir2, EXIT2); - - ret = closedir(dir2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - if (fd) { - close(fd); - } - if (dir2) { - closedir(dir2); - } -EXIT1: - remove(pathname2); - return JFFS_IS_ERROR; -EXIT: - if (dir1) { - closedir(dir1); - } - return JFFS_IS_ERROR; -} - -void ItTestFsJffs112(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_112", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_113.cpp b/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_113.cpp deleted file mode 100644 index f728d117..00000000 --- a/testsuites/unittest/fs/jffs/full/it_test_fs_jffs_113.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -#include - -static FILE *g_filep; -#define NUM 64 -#define COUNT 10 - -void *DoChild(void *) -{ - int ret, count; - char buf[NUM]; - - flockfile(g_filep); - - if (fseek(g_filep, 0L, SEEK_SET) == -1) { - perror("fseek()"); - } - ret = fread(buf, NUM, 1, g_filep); - - count = atoi(buf); - ++count; - (void)sprintf_s(buf, NUM, "%d", count); - if (fseek(g_filep, 0L, SEEK_SET) == -1) { - perror("fseek()"); - } - ret = fwrite(buf, strlen(buf), 1, g_filep); - - funlockfile(g_filep); - - return NULL; -} - -static int TestCase(void) -{ - INT32 ret = JFFS_IS_ERROR; - INT32 fd = 0; - INT32 count = 0; - pthread_t tid[COUNT]; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR buf[COUNT]; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test12345.txt"); - g_filep = fopen(pathname2, "w+"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (count = 0; count < COUNT; count++) { - ret = pthread_create(tid + count, NULL, DoChild, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (count = 0; count < COUNT; count++) { - ret = pthread_join(tid[count], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = fclose(g_filep); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname2, O_RDONLY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = read(fd, buf, COUNT); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = atoi(buf); - ICUNIT_GOTO_EQUAL(ret, COUNT, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname2); - g_filep = nullptr; - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - if (fd > 0) { - close(fd); - } - unlink(pathname2); - g_filep = nullptr; -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs113(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_113", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_001.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_001.cpp deleted file mode 100644 index 8b216632..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_001.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[JFFS_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm *pstTM = NULL; - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - - (void)memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - (void)snprintf_s(fileName, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname1, - (INT32)(INTPTR)arg); - - (void)snprintf_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "performance_001_%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname1, 0, 0, 0); - - ret = JffsRandWrite(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_WR_TYPE_TEST1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsRandRead(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_WR_TYPE_TEST1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return JFFS_NO_ERROR; - -EXIT: - g_TestCnt = 0; - return JFFS_NO_ERROR; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - pthread_t threadId; - pthread_attr_t attr; - INT32 priority = 14; - INT32 testNum = 2; - - g_TestCnt = 0; - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId, &attr, PthreadF01, NULL); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - while (g_TestCnt < testNum) { - sleep(1); - } - - ret = pthread_join(threadId, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - pthread_join(threadId, NULL); - pthread_attr_destroy(&attr); - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance001(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance001", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_002.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_002.cpp deleted file mode 100644 index 6d453e9d..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_002.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[JFFS_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm *pstTM = NULL; - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - (void)memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - (void)snprintf_s(fileName, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname1, - (INT32)(INTPTR)arg); - - (void)snprintf_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "performance_002_%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname1, 0, 0, 0); - - ret = JffsFixWrite(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_PRESSURE_W_R_SIZE1, JFFS_WR_TYPE_TEST1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsFixRead(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_PRESSURE_W_R_SIZE1, JFFS_WR_TYPE_TEST1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_NO_ERROR; - g_TestCnt = 0; -} - -static UINT32 TestCase(VOID) -{ - INT32 i; - INT32 ret; - struct sched_param param; - pthread_t threadId; - pthread_attr_t attr; - INT32 priority = 14; - INT32 testNum = 2; - - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId, &attr, PthreadF01, NULL); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - while (g_TestCnt < testNum) { - sleep(1); - } - - ret = pthread_join(threadId, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - pthread_join(threadId, NULL); - pthread_attr_destroy(&attr); - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance002(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance002", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_003.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_003.cpp deleted file mode 100644 index b37abfc5..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_003.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[JFFS_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm *pstTM = NULL; - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - (void)memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - (void)snprintf_s(fileName, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname1, - (INT32)(INTPTR)arg); - - (void)snprintf_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "performance_003_%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname1, 0, 0, 0); - - ret = JffsRandWrite(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_WR_TYPE_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsRandRead(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_WR_TYPE_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_NO_ERROR; - g_TestCnt = 0; -} - -static UINT32 TestCase(VOID) -{ - INT32 i; - INT32 ret; - struct sched_param param; - pthread_t threadId; - pthread_attr_t attr; - INT32 priority = 14; - INT32 testNum = 2; - - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId, &attr, PthreadF01, NULL); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - while (g_TestCnt < testNum) { - sleep(1); - } - - ret = pthread_join(threadId, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - pthread_join(threadId, NULL); - pthread_attr_destroy(&attr); - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance003(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance003", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_004.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_004.cpp deleted file mode 100644 index 12b11ea7..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_004.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[JFFS_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm *pstTM = NULL; - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - (void)memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - (void)snprintf_s(fileName, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname1, - (INT32)(INTPTR)arg); - - (void)snprintf_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "performance_004_%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname1, 0, 0, 0); - - ret = JffsFixWrite(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_PRESSURE_W_R_SIZE1, JFFS_WR_TYPE_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsFixRead(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_PRESSURE_W_R_SIZE1, JFFS_WR_TYPE_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_NO_ERROR; - g_TestCnt = 0; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - pthread_t threadId; - pthread_attr_t attr; - INT32 priority = 14; - INT32 testNum = 2; - - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId, &attr, PthreadF01, NULL); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - while (g_TestCnt < testNum) { - sleep(1); - } - - ret = pthread_join(threadId, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - pthread_join(threadId, NULL); - pthread_attr_destroy(&attr); - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance004(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance004", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_005.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_005.cpp deleted file mode 100644 index 30398ba1..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_005.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[JFFS_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm *pstTM = NULL; - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - (void)memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - (void)snprintf_s(fileName, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname1, - (INT32)(INTPTR)arg); - - (void)snprintf_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "performance_005_%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname1, 0, 0, 0); - - ret = JffsFixWrite(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_PRESSURE_W_R_SIZE1, JFFS_WR_TYPE_TEST1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsFixRead(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_PRESSURE_W_R_SIZE1, JFFS_WR_TYPE_TEST1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_NO_ERROR; - g_TestCnt = 0; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_t threadId[JFFS_MAX_THREADS]; - pthread_attr_t attr; - INT32 priority = 14; - INT32 testNum = 4; - - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)(i + 1)); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - while (g_TestCnt < testNum) { - sleep(1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - pthread_attr_destroy(&attr); - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance005(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance005", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_006.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_006.cpp deleted file mode 100644 index b17a2b85..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_006.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[JFFS_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm *pstTM = NULL; - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - (void)memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - (void)snprintf_s(fileName, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname1, - (INT32)(INTPTR)arg); - - (void)snprintf_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "performance_006_%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname1, 0, 0, 0); - - ret = JffsRandWrite(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_WR_TYPE_TEST1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsRandRead(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_WR_TYPE_TEST1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_NO_ERROR; - g_TestCnt = 0; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_t threadId[3]; - pthread_attr_t attr; - INT32 priority = 14; - INT32 testNum = 6; - - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - while (g_TestCnt < testNum) { - sleep(1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - pthread_attr_destroy(&attr); - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance006(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance006", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_007.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_007.cpp deleted file mode 100644 index 33c032b0..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_007.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[JFFS_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm *pstTM = NULL; - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - (void)memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - (void)snprintf_s(fileName, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname1, - (INT32)(INTPTR)arg); - - (void)snprintf_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "performance_007_%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname1, 0, 0, 0); - - ret = JffsRandWrite(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_WR_TYPE_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsRandRead(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_WR_TYPE_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_NO_ERROR; - g_TestCnt = 0; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_t threadId[3]; - pthread_attr_t attr; - INT32 priority = 14; - INT32 testNum = 6; - - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - while (g_TestCnt < testNum) { - sleep(1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - pthread_attr_destroy(&attr); - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance007(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance007", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_008.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_008.cpp deleted file mode 100644 index a0363181..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_008.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[JFFS_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm *pstTM = NULL; - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - (void)memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - (void)snprintf_s(fileName, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname1, - (INT32)(INTPTR)arg); - - (void)snprintf_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "performance_008_%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname1, 0, 0, 0); - - ret = JffsFixWrite(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_PRESSURE_W_R_SIZE1, JFFS_WR_TYPE_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsFixRead(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_PRESSURE_W_R_SIZE1, JFFS_WR_TYPE_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_NO_ERROR; - g_TestCnt = 0; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_t threadId[3]; - pthread_attr_t attr; - INT32 priority = 14; - INT32 testNum = 6; - - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - while (g_TestCnt < testNum) { - sleep(1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - pthread_attr_destroy(&attr); - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance008(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance008", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_009.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_009.cpp deleted file mode 100644 index 51993d05..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_009.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, i, j, index, index1, len; - INT32 fd[JFFS_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR pathname0[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname0[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dir = NULL; - INT32 bufWLen = 500 * BYTES_PER_KBYTE; // 500 KB - struct dirent *ptr = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL(bufW, NULL, bufW); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = mkdir(pathname0, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(pathname0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - index = 0; - for (i = 0; i < JFFS_FILE_LIMITTED_NUM; i++) { - (void)snprintf_s(bufname0, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(bufname0, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - - ICUNIT_GOTO_NOT_EQUAL(fd[index], JFFS_IS_ERROR, fd, EXIT2); - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - index++; - } - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - (void)snprintf_s(bufname0, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(bufname0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - dprintf("FF--%s:%d, time: %d\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec)); - - free(bufW); - return JFFS_NO_ERROR; -EXIT3: - for (i = index; i >= 0; i--) { - (void)snprintf_s(bufname0, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(bufname0); - } -EXIT2: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT1: - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance009(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance009", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_010.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_010.cpp deleted file mode 100644 index 97e08159..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_010.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -#define MS_NOSYNC 2 - -static UINT32 TestCase(VOID) -{ - INT32 ret, i, j, index, index1, len; - INT32 fd[JFFS_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dir = NULL; - INT32 bufWLen = 300 * BYTES_PER_KBYTE; // 300 KB - struct dirent *ptr = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL(bufW, NULL, bufW); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - index = 0; - for (i = 0; i < JFFS_FILE_LIMITTED_NUM; i++) { - errno = 0; - (void)snprintf_s(bufname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(bufname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - printf("[%d] name:%s, fd:%d, errno:%d\n", __LINE__, bufname1, fd[index], errno); - if (errno == ENOSPC) { - index; - goto EXIT3; - } - ICUNIT_GOTO_NOT_EQUAL(fd[index], JFFS_IS_ERROR, fd, EXIT3); - - len = write(fd[index], bufW, strlen(bufW)); - printf("[%d] name:%s,len:%d, errno:%d\n", __LINE__, bufname1, len, errno); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - if (len <= 0) { - flag = 1; - break; - } - - index++; - } - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - sync(); - for (i = index; i >= 0; i--) { - (void)snprintf_s(bufname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(bufname1); - printf("[%d] name:%s,ret:%d, errno:%d\n", __LINE__, bufname1, ret, errno); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - dprintf("FF--%s:%d, time: %d\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec)); - - free(bufW); - return JFFS_NO_ERROR; -EXIT4: - umount(JFFS_MOUNT_DIR0); -EXIT3: - for (i = index - 1; i >= 0; i--) { - close(fd[i]); - } -EXIT2: - for (i = index - 1; i >= 0; i--) { - errno = 0; - (void)snprintf_s(bufname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(bufname1); - printf("[%d] name:%s,ret:%d, errno:%d\n", __LINE__, bufname1, ret, errno); - } -EXIT1: -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance010(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance010", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_011.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_011.cpp deleted file mode 100644 index d22d7714..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_011.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static constexpr INT32 USLEEP_TIME = 10; - -static VOID *PthreadF01(void *arg) -{ - INT32 i, ret, len, index; - INT32 fd[JFFS_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct timeval testTime1; - struct timeval testTime2; - INT32 bufWLen = BYTES_PER_KBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < JFFS_FILE_LIMITTED_NUM; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/file%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - - usleep(SLEEP_TIME); - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - dprintf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec)); - - g_TestCnt++; - free(bufW); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (i; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - free(bufW); -EXIT: - rmdir(bufname); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, ret, len, index; - INT32 fd[JFFS_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct timeval testTime1; - struct timeval testTime2; - INT32 bufWLen = BYTES_PER_KBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < JFFS_FILE_LIMITTED_NUM; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - - usleep(SLEEP_TIME); - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - dprintf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec)); - - g_TestCnt++; - free(bufW); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (i; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - free(bufW); -EXIT: - rmdir(bufname); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, ret, len, index; - INT32 fd[JFFS_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct timeval testTime1; - struct timeval testTime2; - INT32 bufWLen = BYTES_PER_KBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < JFFS_FILE_LIMITTED_NUM; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - - usleep(SLEEP_TIME); - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - dprintf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec)); - - g_TestCnt++; - free(bufW); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (i; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname); - } - free(bufW); -EXIT: - rmdir(bufname); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - errno = 0; - - i = 0; - ret = PosixPthreadInit(&attr[i], TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } - - return JFFS_NO_ERROR; -} - -/* * -* - @test ItFsJffsPerformance011 -* - @tspec function test -* - @ttitle Multi-threaded takes time to delete directory files -* - @tbrief -1. Create 200 files per directory; -2. The size of each file is 300K; -3. Call the gettimeofday() to get the time; -4. Delete files and directories; -5. Call the gettimeofday() to get the time and View the time of serial port printing. -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsJffsPerformance011(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance011", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_012.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_012.cpp deleted file mode 100644 index 6c96e446..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_012.cpp +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[JFFS_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct timeval testTime1; - struct timeval testTime2; - INT32 bufWLen = 300 * BYTES_PER_KBYTE; // 300 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < JFFS_FILE_LIMITTED_NUM; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], bufW, strlen(bufW)); - - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - if (len <= 0) { - flag = 1; - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - dprintf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec)); - - g_TestCnt++; - free(bufW); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (i; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - free(bufW); -EXIT: - rmdir(bufname); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, ret, len, index; - INT32 fd[JFFS_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct timeval testTime1; - struct timeval testTime2; - INT32 bufWLen = 300 * BYTES_PER_KBYTE; // 300 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < JFFS_FILE_LIMITTED_NUM; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], bufW, strlen(bufW)); - - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - if (len <= 0) { - flag = 1; - break; - } - - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - dprintf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec)); - - g_TestCnt++; - free(bufW); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (i; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - free(bufW); -EXIT: - rmdir(bufname); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[JFFS_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct timeval testTime1; - struct timeval testTime2; - INT32 bufWLen = 300 * BYTES_PER_KBYTE; // 300 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < JFFS_FILE_LIMITTED_NUM; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], bufW, strlen(bufW)); - - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - if (len <= 0) { - flag = 1; - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - dprintf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec)); - - g_TestCnt++; - free(bufW); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (i; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname); - } - free(bufW); -EXIT: - rmdir(bufname); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - i = 0; - ret = PosixPthreadInit(&attr[i], TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - return JFFS_NO_ERROR; -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } - return JFFS_NO_ERROR; -} - -/* * -* - @test ItFsJffsPerformance012 -* - @tspec function test -* - @ttitle Multi-threaded takes time to delete directory files -* - @tbrief -1. Create 200 files per directory; -2. The size of each file is 300K; -3. Call the gettimeofday() to get the time; -4. Delete files and directories; -5. Call the gettimeofday() to get the time and View the time of serial port printing. -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsJffsPerformance012(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance012", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_013.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_013.cpp deleted file mode 100644 index 6a0e16f8..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_performance_013.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - - -static void *PthreadFunc(void *arg) -{ - int fd = -1; - int ret; - int num = JFFS_MAX_NUM_TEST; - char *fileName = { JFFS_PATH_NAME0 }; - char *filebuf = "helloworld"; - - while (num-- > 0) { - fd = open(fileName, O_RDWR | O_CREAT, S_IRUSR); - if (fd < 0) { - printf("open %s failed, error: %s\n", fileName, strerror(errno)); - } - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - ret = write(fd, filebuf, strlen(filebuf)); - if (ret != strlen(filebuf)) { - printf("write %s failed, ret: %d, error: %s\n", fileName, ret, strerror(errno)); - } - ICUNIT_GOTO_EQUAL(ret, strlen(filebuf), ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(fileName); - if (ret != 0) { - printf("remove %s failed, ret: %d, error: %s\n", fileName, ret, strerror(errno)); - } - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - pthread_exit(0); -EXIT1: - close(fd); -EXIT2: - unlink(fileName); -EXIT: - pthread_exit(0); -} - -static UINT32 TestCase(VOID) -{ - pthread_attr_t attr1, attr2; - pthread_t newTh1, newTh2; - int ret; - int num = 100; - int priority = 14; - - while (num-- > 0) { - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&newTh1, &attr1, PthreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh2, &attr2, PthreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - ret = pthread_join(newTh1, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_join(newTh2, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_attr_destroy(&attr2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - return JFFS_NO_ERROR; -EXIT2: - pthread_join(newTh2, NULL); - pthread_attr_destroy(&attr2); -EXIT1: - pthread_join(newTh1, NULL); - pthread_attr_destroy(&attr1); -EXIT: - return JFFS_NO_ERROR; -} - - -VOID ItFsJffsPerformance013(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance013", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_001.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_001.cpp deleted file mode 100644 index 9658b7e1..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_001.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - struct flock fl = { 0 }; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/jffs_1600.txt"); - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - ret = rename(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rename(pathname2, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0000000000111111111122222222223333333333", readbuf, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rename(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rename(pathname2, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(buf2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(fd); - goto EXIT1; -EXIT2: - close(fd1); -EXIT1: - remove(pathname1); - remove(pathname2); -EXIT: - rmdir(pathname3); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure001(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure001", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_002.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_002.cpp deleted file mode 100644 index 6deddb01..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_002.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test/test1"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - JffsStrcat2(pathname1, "/test/test2", strlen(pathname1)); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - JffsStrcat2(pathname1, "/test/test3", strlen(pathname1)); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - JffsStrcat2(pathname1, "/test/jffs_1601.txt", strlen(pathname1)); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, "/123"); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - ret = rename(pathname2, pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rename(pathname3, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - dir = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 0, offset, EXIT); // dir offset: 0 - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 1, offset, EXIT3); // dir offset: 1 - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 2, offset, EXIT); // dir offset: 2 - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 3, offset, EXIT); // dir offset: 3 - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 4, offset, EXIT); // dir offset: 4 - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 4, offset, EXIT); // dir offset: 4 - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - JffsStrcat2(pathname1, "/test/jffs_1601.txt", strlen(pathname1)); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - JffsStrcat2(pathname1, "/test/test1", strlen(pathname1)); - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - JffsStrcat2(pathname1, "/test/test2", strlen(pathname1)); - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - JffsStrcat2(pathname1, "/test/test3", strlen(pathname1)); - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - JffsStrcat2(pathname2, "/test", strlen(pathname2)); - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/test/jffs_1601.txt", strlen(pathname1)); - remove(pathname1); - JffsStrcat2(pathname1, "/test/test3", strlen(pathname1)); - remove(pathname1); - JffsStrcat2(pathname1, "/test/test2", strlen(pathname1)); - remove(pathname1); - JffsStrcat2(pathname1, "/test/test1", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "/123/jffs_1601.txt", strlen(pathname1)); - remove(pathname1); - JffsStrcat2(pathname1, "/123/test3", strlen(pathname1)); - remove(pathname1); - JffsStrcat2(pathname1, "/123/test2", strlen(pathname1)); - remove(pathname1); - JffsStrcat2(pathname1, "/123/test1", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(pathname3); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure002(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure002", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_003.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_003.cpp deleted file mode 100644 index 7ffab02d..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_003.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1602_%d", i); - JffsStrcat2(pathname2, bufname, strlen(bufname)); - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - closedir(dir); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname4); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure003(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure003", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_004.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_004.cpp deleted file mode 100644 index e64d9d2a..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_004.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dirbuf[JFFS_SHORT_ARRAY_LENGTH] = {NULL}; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - (void)memset_s(pathname1, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - (void)strcpy_s(pathname1, JFFS_NAME_LIMITTED_SIZE, pathname2); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)memset_s(pathname[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1603_%d", i); - (void)strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, bufname); - (void)strcpy_s(pathname[i], JFFS_NAME_LIMITTED_SIZE, pathname1); - - ret = mkdir(pathname[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dirbuf[i] = opendir(pathname[i]); - ICUNIT_GOTO_NOT_EQUAL(dirbuf[i], NULL, dirbuf[i], EXIT2); - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - JffsStatPrintf(buf2); - - for (i = JFFS_PRESSURE_CYCLES - 1; i >= 0; i--) { - ret = closedir(dirbuf[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - closedir(dirbuf[i]); - } - -EXIT1: - for (i = JFFS_PRESSURE_CYCLES - 1; i >= 0; i--) { - rmdir(pathname[i]); - } -EXIT: - remove(pathname3); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure004(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure004", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_005.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_005.cpp deleted file mode 100644 index c0c87411..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_005.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - static UINT32 flag = 0; - signed long long offset; - - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname5[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname6[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - DIR *dir1 = NULL; - DIR *dir2 = NULL; - DIR *dir3 = NULL; - DIR *dir4 = NULL; - DIR *dir5 = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - (void)strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "/test1"); - (void)strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, "/test2"); - (void)strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, "/test3"); - (void)strcat_s(pathname4, JFFS_NAME_LIMITTED_SIZE, "/test4"); - (void)strcat_s(pathname5, JFFS_NAME_LIMITTED_SIZE, "/test5"); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = mkdir(pathname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = mkdir(pathname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - dir1 = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir1, NULL, dir1, EXIT6); - - dir2 = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir2, NULL, dir2, EXIT7); - - dir3 = opendir(pathname3); - ICUNIT_GOTO_NOT_EQUAL(dir3, NULL, dir3, EXIT8); - - dir4 = opendir(pathname4); - ICUNIT_GOTO_NOT_EQUAL(dir4, NULL, dir4, EXIT9); - - dir5 = opendir(pathname5); - ICUNIT_GOTO_NOT_EQUAL(dir5, NULL, dir5, EXIT10); - - ret = closedir(dir1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = closedir(dir2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = closedir(dir3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = closedir(dir4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = closedir(dir5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = rmdir(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = rmdir(pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT10: - closedir(dir5); -EXIT9: - closedir(dir4); -EXIT8: - closedir(dir3); -EXIT7: - closedir(dir2); -EXIT6: - closedir(dir1); -EXIT5: - rmdir(pathname5); -EXIT4: - rmdir(pathname4); -EXIT3: - rmdir(pathname3); -EXIT2: - rmdir(pathname2); -EXIT1: - rmdir(pathname1); -EXIT: - rmdir(pathname6); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure005(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure005", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_006.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_006.cpp deleted file mode 100644 index e3b77ef3..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_006.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - DIR *dir = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - JffsStrcat2(pathname2, "/", strlen(pathname2)); - - for (j = 0; j < 40; j++) { // loop times: 40 - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "test%d", j); - (void)strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, bufname); - } - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT3); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0000000000111111111122222222223333333333", readbuf, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - remove(pathname2); - goto EXIT; -EXIT1: - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure006(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure006", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_007.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_007.cpp deleted file mode 100644 index 9af4f1b7..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_007.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname4[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname5[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, strlen(readbuf)); - (void)memset_s(pathname2, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, pathname6); - - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - (void)memset_s(pathname3[j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", j); - (void)strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, bufname); - (void)strcpy_s(pathname3[j], JFFS_NAME_LIMITTED_SIZE, pathname2); - - ret = mkdir(pathname3[j], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)strcpy_s(pathname4[j], JFFS_NAME_LIMITTED_SIZE, pathname3[j]); - (void)strcat_s(pathname4[j], JFFS_NAME_LIMITTED_SIZE, ".txt"); - } - - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - fd = open(pathname4[j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0000000000111111111122222222223333333333", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname4[j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - - for (j = JFFS_SHORT_ARRAY_LENGTH - 1; j >= 0; j--) { - ret = rmdir(pathname3[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(pathname4[i]); - } -EXIT1: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - rmdir(pathname3[i]); - } -EXIT: - rmdir(pathname5); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure007(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure007", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_008.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_008.cpp deleted file mode 100644 index c196aa39..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_008.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - (void)memset_s(pathname2, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - JffsStrcat2(pathname2, "/_", strlen(pathname2)); - - for (j = 0; j < 31; j++) { // loop times: 31 - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "test%d", j); - JffsStrcat2(pathname2, bufname, strlen(bufname)); - } - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - closedir(dir); -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname3); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure008(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure008", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_009.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_009.cpp deleted file mode 100644 index a67455ab..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_009.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - (void)strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, "/1608.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - fd = open(pathname2, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0000000000111111111122222222223333333333", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname2); -EXIT: - rmdir(pathname3); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure009(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure009", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_010.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_010.cpp deleted file mode 100644 index 29ba871c..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_010.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname5[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname6[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - (void)strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, "/1609.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, strlen(readbuf)); - - fd = open(pathname2, O_NONBLOCK | O_TRUNC | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0000000000111111111122222222223333333333", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname2); -EXIT: - rmdir(pathname3); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure010(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure010", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_011.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_011.cpp deleted file mode 100644 index 6c9e72de..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_011.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname3[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - INT32 even = 2; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - JffsStrcat2(pathname2, bufname, strlen(pathname2)); - (void)strcpy_s(pathname[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - - ret = mkdir(pathname[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1016_%d", i); - JffsStrcat2(pathname2, bufname, strlen(pathname2)); - (void)strcpy_s(pathname3[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - } - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - if ((j % even) == 0) { - ret = rename(pathname[i], pathname3[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } else { - ret = rename(pathname3[i], pathname[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - } - if ((j % even) == 0) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = rmdir(pathname[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } else { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = rmdir(pathname3[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = rmdir(pathname3[i]); - } - -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = rmdir(pathname[i]); - } -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure011(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure011", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_012.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_012.cpp deleted file mode 100644 index f0bef5f7..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_012.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH], fd1, ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname3[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname5[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname6[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - INT32 even = 2; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - JffsStrcat2(pathname2, bufname, strlen(pathname2)); - (void)strcpy_s(pathname[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - - (void)strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, "/test.txt"); - (void)strcpy_s(pathname5[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1011_%d", i); - JffsStrcat2(pathname2, bufname, strlen(pathname2)); - (void)strcpy_s(pathname3[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - - (void)strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, "/test.txt"); - (void)strcpy_s(pathname6[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - - ret = mkdir(pathname[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd[i] = open(pathname5[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT3); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - } - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - if ((j % even) == 0) { - ret = rename(pathname[i], pathname3[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } else { - ret = rename(pathname3[i], pathname[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - } - - if ((j % even) == 1) { - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = unlink(pathname6[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname3[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } else { - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = unlink(pathname5[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[i]); - } -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(pathname5[i]); - unlink(pathname6[i]); - } - -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - rmdir(pathname[i]); - rmdir(pathname3[i]); - } -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure012(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure012", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_014.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_014.cpp deleted file mode 100644 index f7b31249..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_014.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - DIR *dir = NULL; - DIR *dirbuf[BYTES_PER_KBYTE] = {NULL}; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - JffsStrcat2(pathname3, "/1613.txt", strlen(pathname3)); - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT3); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0000000000111111111122222222223333333333", readbuf, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT4); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - JffsStatPrintf(buf2); - - ret = unlink(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT4: - closedir(dir); - goto EXIT2; -EXIT3: - close(fd); -EXIT2: - unlink(pathname3); -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure014(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure014", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_015.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_015.cpp deleted file mode 100644 index d44defc9..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_015.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dirbuf[JFFS_SHORT_ARRAY_LENGTH] = {NULL}; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1614_%d", i); - (void)strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, bufname); - (void)strcpy_s(pathname[i], JFFS_NAME_LIMITTED_SIZE, pathname1); - - ret = mkdir(pathname[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - dirbuf[i] = opendir(pathname[i]); - ICUNIT_GOTO_NOT_EQUAL(dirbuf[i], NULL, dirbuf[i], EXIT2); - } - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = closedir(dirbuf[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = rmdir(pathname[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - closedir(dirbuf[i]); - } -EXIT1: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - rmdir(pathname[i]); - } - -EXIT: - rmdir(pathname3); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure015(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure015", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_016.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_016.cpp deleted file mode 100644 index 6decae82..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_016.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_SHORT_ARRAY_LENGTH][JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)memset_s(pathname[i], JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1615_%d", i); - JffsStrcat2(pathname2, bufname, strlen(pathname2)); - (void)strcat_s(pathname[i], JFFS_STANDARD_NAME_LENGTH, pathname2); - } - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - fd[i] = open(pathname[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - - len = write(fd[i], filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - len = read(fd[i], readbuf, 45); // read length: 45 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[i]); - } - -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(pathname[i]); - } - -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure016(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure016", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_017.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_017.cpp deleted file mode 100644 index 11c95ee9..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_017.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1616_%d", i); - JffsStrcat2(pathname2, bufname, strlen(pathname2)); - (void)strcat_s(pathname[i], JFFS_STANDARD_NAME_LENGTH, pathname2); - - fd[i] = open(pathname[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - } - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = write(fd[i], filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - } - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[i]); - } -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(pathname[i]); - } -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure017(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure017", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_018.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_018.cpp deleted file mode 100644 index d0011d6b..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_018.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1617_%d", i); - JffsStrcat2(pathname2, bufname, strlen(pathname2)); - (void)strcat_s(pathname[i], JFFS_STANDARD_NAME_LENGTH, pathname2); - - fd[i] = open(pathname[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT); - - len = write(fd[i], filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT); - } - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT); - - len = read(fd[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT); - } - } - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT); - - len = read(fd[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink(pathname[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[i]); - } -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(pathname[i]); - } -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure018(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure018", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_019.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_019.cpp deleted file mode 100644 index 47e55eed..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_019.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname1[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR bufname2[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname5[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)memset_s(pathname3, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)snprintf_s(bufname1, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - (void)strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, bufname1); - (void)strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, pathname2); - (void)strcpy_s(pathname4[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - - ret = mkdir(pathname4[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, ".txt"); - (void)strcpy_s(pathname5[i], JFFS_NAME_LIMITTED_SIZE, pathname3); - - fd[i] = open(pathname5[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - } - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = write(fd[i], filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - } - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - } - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - } - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = write(fd[i], filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - } - } - - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - len = read(fd[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname5[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname4[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[i]); - } -EXIT1: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - unlink(pathname5[i]); - rmdir(pathname4[i]); - } -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure019(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure019", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_020.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_020.cpp deleted file mode 100644 index d3328e0e..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_020.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)memset_s(pathname[i], JFFS_NAME_LIMITTED_SIZE, 0, strlen(pathname[i])); - } - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1616_%d", i); - JffsStrcat2(pathname2, bufname, strlen(pathname2)); - (void)strcat_s(pathname[i], JFFS_STANDARD_NAME_LENGTH, pathname2); - - fd[i] = open(pathname[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - } - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[i]); - } -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(pathname[i]); - } -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure020(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure020", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_021.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_021.cpp deleted file mode 100644 index 2ef3fa35..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_021.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname1[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname5[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)memset_s(pathname4[i], JFFS_NAME_LIMITTED_SIZE, 0, strlen(pathname4[i])); - (void)memset_s(pathname5[i], JFFS_NAME_LIMITTED_SIZE, 0, strlen(pathname5[i])); - } - (void)memset_s(pathname2, JFFS_NAME_LIMITTED_SIZE, 0, strlen(pathname2)); - (void)strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, pathname1); - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)memset_s(pathname3, JFFS_NAME_LIMITTED_SIZE, 0, strlen(pathname3)); - - (void)snprintf_s(bufname1, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - (void)strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, bufname1); - (void)strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, pathname2); - (void)strcpy_s(pathname4[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - - ret = mkdir(pathname4[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, ".txt"); - (void)strcpy_s(pathname5[i], JFFS_NAME_LIMITTED_SIZE, pathname3); - - fd[i] = open(pathname5[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - } - - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname5[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname4[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - LosTaskDelay(10); // delay time: 10 - } - LosTaskDelay(100); // delay time: 100 - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - close(fd[i]); - } -EXIT1: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - unlink(pathname5[i]); - rmdir(pathname4[i]); - } - -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure021(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure021", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_022.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_022.cpp deleted file mode 100644 index 0608be59..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_022.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - CHAR filebuf[70] = "1111111111222222222233333333334444444444555555555566666666667777"; - CHAR readbuf[70] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - struct stat statfile; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1621.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - for (i = 0; i < 16 * 1024; i++) { // loop times: 16 * 1024 - errno = 0; - ret = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(ret, strlen(filebuf), ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (strlen(filebuf) * (i + 1)), off, EXIT2); - } - - off = lseek(fd, 64, SEEK_SET); // seek offset: 64 - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); - - len = read(fd, readbuf, 64); // read length: 64 - ICUNIT_GOTO_EQUAL(len, 64, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1111111111222222222233333333334444444444555555555566666666667777", readbuf, - EXIT2); - - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // file size: 1024 * 1024 - ICUNIT_GOTO_EQUAL(statfile.st_size, 1024 * 1024, statfile.st_size, EXIT2); - - printf("[%d] cycle:%d errno:%d\n", __LINE__, j, errno); - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure022(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure022", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_023.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_023.cpp deleted file mode 100644 index 89e2397b..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_023.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - INT32 jffsPressureCycles = 4; // write size 4 * 1024 * 1024 - signed long long offset; - - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[70] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - struct stat statfile; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL(bufW, NULL, 0); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - (void)memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - (void)memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - (void)strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - (void)strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - (void)strcat_s(bufW, bufWLen + 1, bufW1); - } - - free(bufW1); - free(bufW2); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - JffsStatPrintf(buf1); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1622.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - for (j = 0; j < jffsPressureCycles; j++) { - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - for (i = 0; i < jffsPressureCycles; i++) { - ret = write(fd, bufW, strlen(bufW)); - printf("cnt=%d %d\n", i, j); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (i + 1)), off, EXIT2); - } - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // file size: 4 * 1024 * 1024 - ICUNIT_GOTO_EQUAL(statfile.st_size, 4 * 1024 * 1024, statfile.st_size, EXIT2); - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - free(bufW); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - free(bufW1); -EXIT2: - free(bufW); - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure023(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure023", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_024.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_024.cpp deleted file mode 100644 index 3de5bd9c..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_024.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[70] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - struct stat statfile; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL(bufW, NULL, 0); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - (void)memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - (void)memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - (void)strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - (void)strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - (void)strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - JffsStatPrintf(buf1); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1623.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - for (j = 0; j < 1; j++) { - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - for (i = 0; i < 100; i++) { // loop times: 100 - ret = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (i + 1)), off, EXIT2); - } - - off = lseek(fd, 64, SEEK_SET); // seek offset: 64 - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); // file position: 64 - - len = read(fd, readbuf, 64); // read length: 64 - ICUNIT_GOTO_EQUAL(len, 64, len, EXIT2); - - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // 100 * 1024 * 1024: filesize - ICUNIT_GOTO_EQUAL(statfile.st_size, 100 * 1024 * 1024, statfile.st_size, EXIT2); - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - free(bufW); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - free(bufW1); -EXIT2: - free(bufW); - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure024(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure024", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_025.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_025.cpp deleted file mode 100644 index 10ab6078..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_025.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - static INT32 count = 0; - signed long long offset; - - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333 333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = "123"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_SHORT_ARRAY_LENGTH][JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname4[JFFS_SHORT_ARRAY_LENGTH][JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 even = 2; - - struct stat statfile; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)memset_s(pathname2, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(pathname3[i], JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(pathname4[i], JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - - (void)strcpy_s(pathname2, JFFS_STANDARD_NAME_LENGTH, pathname1); - (void)snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/1623_%d.txt", i); - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, bufname); - (void)strcat_s(pathname3[i], JFFS_STANDARD_NAME_LENGTH, pathname2); - - (void)memset_s(pathname2, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)strcpy_s(pathname2, JFFS_STANDARD_NAME_LENGTH, pathname1); - (void)snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/test_%d.c", i); - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, bufname); - (void)strcat_s(pathname4[i], JFFS_STANDARD_NAME_LENGTH, pathname2); - - fd[i] = open(pathname3[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - if ((j % even) == 0) { - ret = rename(pathname3[i], pathname4[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } else { - ret = rename(pathname4[i], pathname3[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - } - - if ((j % even) == 0) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = unlink(pathname3[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } else { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = unlink(pathname4[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[i]); - } -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - remove(pathname3[i]); - remove(pathname4[i]); - } -EXIT: - chdir(JFFS_MAIN_DIR0); - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure025(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure025", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_026.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_026.cpp deleted file mode 100644 index 4832f184..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_026.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333 333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = "123"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname4[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname5[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - struct stat statfile; - INT32 even = 2; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/test%d", i); - (void)strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, bufname); - - (void)strcpy_s(pathname3[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - - ret = mkdir(pathname3[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcpy_s(pathname4[i], JFFS_NAME_LIMITTED_SIZE, pathname3[i]); - (void)strcat_s(pathname4[i], JFFS_NAME_LIMITTED_SIZE, ".txt"); - - (void)strcpy_s(pathname5[i], JFFS_NAME_LIMITTED_SIZE, pathname3[i]); - (void)strcat_s(pathname5[i], JFFS_NAME_LIMITTED_SIZE, ".c"); - - fd[i] = open(pathname4[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT3); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - if ((j % even) == 0) { - ret = rename(pathname4[i], pathname5[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } else { - ret = rename(pathname5[i], pathname4[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - } - - if ((j % even) == 0) { - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = unlink(pathname4[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname3[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } else { - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = unlink(pathname5[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname3[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[i]); - } -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - remove(pathname4[i]); - remove(pathname5[i]); - } -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - remove(pathname3[i]); - } -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure026(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure026", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_027.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_027.cpp deleted file mode 100644 index a6960abd..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_027.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, scandirCount1, scandirCount2; - INT64 i; - INT64 perTime; - INT64 totalSize = 0; - INT64 totalTime = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct timeval testTime1; - struct timeval testTime2; - struct dirent **namelist = NULL; - DOUBLE mountSpeed; - - totalTime = 0; - totalSize = 0; - - scandirCount1 = scandir(pathname2, &namelist, 0, alphasort); - if (scandirCount1 >= 0) { - JffsScandirFree(namelist, scandirCount1); - } - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - gettimeofday(&testTime1, 0); - - ret = umount(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - dprintf("the size:%lld th,umount/mount cost %lld us \n", i, perTime); - } - - totalSize = i; - - mountSpeed = totalSize * 1.0; - mountSpeed = totalTime / mountSpeed; - - dprintf("total_size %lld,cost %lld us, speed: %0.3lf us/Size\n", totalSize, totalTime, mountSpeed); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - scandirCount2 = scandir(pathname2, &namelist, 0, alphasort); - if (scandirCount2 >= 0) { - JffsScandirFree(namelist, scandirCount2); - } - - ICUNIT_GOTO_EQUAL(scandirCount1, scandirCount2, scandirCount2, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure027(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure027", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_028.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_028.cpp deleted file mode 100644 index 5902b09d..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_028.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, scandirCount1, scandirCount2; - INT64 i, j; - INT64 writeCount = 0; - INT64 readCount = 0; - INT64 perTime; - INT64 totalSize = 0; - INT64 totalTime = 0; - INT32 fileLen = 2 * BYTES_PER_KBYTE; // 2 KB - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - struct timeval testTime1; - struct timeval testTime2; - struct dirent **namelist = NULL; - DOUBLE mountSpeed; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - struct statfs buf3 = { 0 }; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL(bufW, NULL, 0); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - (void)memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - (void)memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - (void)strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - (void)strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - (void)strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - for (i = 0; i < fileLen / (INT32)bufW; i++) { - ret = write(fd, bufW, strlen(filebuf)); - writeCount++; - } - - free(bufW); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = statfs(JFFS_MAIN_DIR0, &buf3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatfsPrintf(buf3); - - totalTime = 0; - totalSize = 0; - - scandirCount1 = scandir(pathname2, &namelist, 0, alphasort); - if (scandirCount1 >= 0) { - JffsScandirFree(namelist, scandirCount1); - } - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - gettimeofday(&testTime1, 0); - - ret = umount(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - dprintf("the size:%lld th,umount/mount cost %lld us \n", i, perTime); - } - - totalSize = i; - - mountSpeed = totalSize * 1.0; - mountSpeed = totalTime / mountSpeed; - - dprintf("total_size %lld,cost %lld us, speed: %0.3lf us/Size\n", totalSize, totalTime, mountSpeed); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - scandirCount2 = scandir(pathname2, &namelist, 0, alphasort); - if (scandirCount2 >= 0) { - JffsScandirFree(namelist, scandirCount2); - } - - ICUNIT_GOTO_EQUAL(scandirCount1, scandirCount2, scandirCount2, EXIT); - - fd = open(pathname1, O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - do { - ret = read(fd, filebuf, 1); // read length: 1 - readCount++; - } while (ret == 1); - - readCount--; - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = statfs(JFFS_MAIN_DIR0, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatfsPrintf(buf2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = statfs(JFFS_MAIN_DIR0, &buf3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatfsPrintf(buf3); - - return JFFS_NO_ERROR; -EXIT4: - free(bufW1); -EXIT3: - free(bufW); - goto EXIT1; -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - goto EXIT; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure028(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure028", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_029.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_029.cpp deleted file mode 100644 index 42615952..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_029.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, scandirCount1, scandirCount2; - INT64 i, j; - INT64 writeCount = 0; - INT64 readCount = 0; - INT64 perTime; - INT64 totalSize = 0; - INT64 totalTime = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - struct timeval testTime1; - struct timeval testTime2; - struct dirent **namelist = NULL; - DOUBLE mountSpeed; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - struct statfs buf3 = { 0 }; - off_t off; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL(bufW, NULL, 0); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - (void)memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - (void)memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - (void)strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - (void)strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - (void)strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - while (writeCount < 100) { // loop times: 100 - ret = write(fd, bufW, strlen(bufW)); - dprintf("write_count=:%lld\n", writeCount); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT3); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (writeCount + 1)), off, EXIT1); - - writeCount++; - } - - free(bufW); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = statfs(JFFS_MAIN_DIR0, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatfsPrintf(buf3); - - totalTime = 0; - totalSize = 0; - - scandirCount1 = scandir(pathname2, &namelist, 0, alphasort); - if (scandirCount1 >= 0) { - JffsScandirFree(namelist, scandirCount1); - } - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - gettimeofday(&testTime1, 0); - - ret = umount(pathname2); - if (ret != 0) { - dprintf("umount jffs is error\n"); - goto EXIT2; - } - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - if (ret != 0) { - dprintf("mount jffs is error\n"); - goto EXIT2; - } - - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - dprintf("the size:%lld th,umount/mount cost %lld us \n", i, perTime); - } - - totalSize = i; - - mountSpeed = totalSize * 1.0; - mountSpeed = totalTime / mountSpeed; - - dprintf("total_size %lld,cost %lld us, speed: %0.3lf us/Size\n", totalSize, totalTime, mountSpeed); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - scandirCount2 = scandir(pathname2, &namelist, 0, alphasort); - if (scandirCount2 >= 0) { - JffsScandirFree(namelist, scandirCount2); - } - - ICUNIT_GOTO_EQUAL(scandirCount1, scandirCount2, scandirCount2, EXIT); - - fd = open(pathname1, O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 100 * 1024 * 1024, off, EXIT1); // 100 * 1024 * 1024: filesize - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = statfs(JFFS_MAIN_DIR0, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatfsPrintf(buf2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = statfs(JFFS_MAIN_DIR0, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatfsPrintf(buf3); - - return JFFS_NO_ERROR; -EXIT4: - free(bufW1); -EXIT3: - free(bufW); - goto EXIT1; -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - goto EXIT; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure029(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure029", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_030.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_030.cpp deleted file mode 100644 index da153276..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_030.cpp +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - INT32 i = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - (void)memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, pathname); - (void)strcat_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, pathname); - (void)strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, "/"); - (void)strcat_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, "/"); - - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "AAAA%d", i); - (void)strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, bufname); - - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "BBBB%d", i); - (void)strcat_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, bufname); - - ret = mkdir(g_jffsPathname11[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - ICUNIT_GOTO_NOT_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT); // even number: 2 - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - ret = rmdir(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; - -EXIT: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - rmdir(g_jffsPathname11[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - INT32 even = 2; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - for (i = 0; i < JFFS_MAXIMUM_OPERATIONS; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - if (i % even == 0) { - ret = rename(g_jffsPathname11[j], g_jffsPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } else { - ret = rename(g_jffsPathname12[j], g_jffsPathname11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - } - - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT); // even number: 2 - - g_jffsFlagF02++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - return NULL; -EXIT1: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - rmdir(g_jffsPathname12[i]); - } -EXIT: - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - rmdir(g_jffsPathname11[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(10); // delay time: 10 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag:=%d\t", g_jffsFlag); - } - dprintf("\n"); - - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure030(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure030", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_031.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_031.cpp deleted file mode 100644 index f3fdfb6e..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_031.cpp +++ /dev/null @@ -1,287 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 dirCount1 = 0; - INT32 dirCount2 = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - (void)memset_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)strcat_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, pathname1); - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - (void)memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - - (void)strcat_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, bufname); - (void)strcpy_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname6); - - ret = mkdir(g_jffsPathname11[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dirCount1++; - } - ICUNIT_GOTO_EQUAL(dirCount1, JFFS_SHORT_ARRAY_LENGTH, dirCount1, EXIT); - ICUNIT_GOTO_NOT_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT); // even number: 2 - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - len = read(g_jffsFd11[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - - len = write(g_jffsFd11[i], filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT); - - len = read(g_jffsFd11[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - - off = lseek(g_jffsFd11[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT); - - len = read(g_jffsFd11[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(3); // delay time: 3 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(g_jffsPathname12[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - g_TestCnt++; - - return NULL; -EXIT1: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - close(g_jffsFd11[i]); - unlink(g_jffsPathname12[i]); - } -EXIT: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - rmdir(g_jffsPathname11[i]); - } - g_TestCnt++; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - off_t off; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF02++; - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)memset_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, g_jffsPathname11[i]); - (void)strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, ".txt"); - (void)strcpy_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname7); - - g_jffsFd11[i] = open(g_jffsPathname12[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT); - } - - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT); // even number: 2 - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - len = read(g_jffsFd11[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - - off = lseek(g_jffsFd11[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT); - - len = read(g_jffsFd11[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - LosTaskDelay(2); // delay time: 2 - - g_TestCnt++; - - return NULL; -EXIT: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - close(g_jffsFd11[i]); - unlink(g_jffsPathname12[i]); - } - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - g_TestCnt++; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - UINT64 start, end; - INT32 priority = 20; - INT32 testNum = 4; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - while (g_TestCnt != testNum) { - LosTaskDelay(1); // delay time: 1 - } - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure031(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure031", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_032.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_032.cpp deleted file mode 100644 index e16bfa12..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_032.cpp +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - INT32 fileCount1 = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - (void)memset_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - (void)strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, pathname1); - (void)strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, bufname); - (void)strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, ".txt"); - (void)strcpy_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname2); - g_jffsFd11[i] = open(g_jffsPathname12[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT1); - - if (i % JFFS_SHORT_ARRAY_LENGTH == JFFS_SHORT_ARRAY_LENGTH - 1) { - for (k = (i / JFFS_SHORT_ARRAY_LENGTH) * JFFS_SHORT_ARRAY_LENGTH; k <= i; k++) { - ret = close(g_jffsFd11[k]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - } - } - - ICUNIT_GOTO_NOT_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT1); // even number: 2 - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - g_jffsFd11[i] = open(g_jffsPathname12[i], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT1); - - off = lseek(g_jffsFd11[i], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 1 * 1024, off, EXIT1); // file size: 1 * 1024 - - if (i % JFFS_SHORT_ARRAY_LENGTH == JFFS_SHORT_ARRAY_LENGTH - 1) { - for (k = (i / JFFS_SHORT_ARRAY_LENGTH) * JFFS_SHORT_ARRAY_LENGTH; k <= i; k++) { - ret = close(g_jffsFd11[k]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - } - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - ret = unlink(g_jffsPathname12[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; -EXIT1: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - close(g_jffsFd11[i]); - } -EXIT: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - unlink(g_jffsPathname12[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd1, ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - INT32 fileCount2 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR *bufW = NULL; - off_t off; - INT32 bufWLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT1); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (j = 0; j < bufWLen / strlen(filebuf); j++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - g_jffsFd11[i] = open(g_jffsPathname12[i], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT2); - - len = read(g_jffsFd11[i], readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(g_jffsFd11[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = write(g_jffsFd11[i], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT2); - - if (i % JFFS_SHORT_ARRAY_LENGTH == JFFS_SHORT_ARRAY_LENGTH - 1) { - for (k = (i / JFFS_SHORT_ARRAY_LENGTH) * JFFS_SHORT_ARRAY_LENGTH; k <= i; k++) { - ret = close(g_jffsFd11[k]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - } - - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT2); // even number: 2 - - free(bufW); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - close(g_jffsFd11[i]); - } -EXIT: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - unlink(g_jffsPathname12[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - UINT64 start, end; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - g_TestCnt = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(1); // delay time: 1 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure032(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure032", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_033.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_033.cpp deleted file mode 100644 index 842fde17..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_033.cpp +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -static INT32 g_testNum = 100; - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[101] = "liteos"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start first get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT2); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - (void)memset_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - (void)strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, pathname1); - (void)strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, bufname); - (void)strcpy_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname2); - (void)strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, ".cpp"); - - (void)strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, ".txt"); - (void)strcpy_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname2); - - g_jffsFd11[i] = open(g_jffsPathname12[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT3); - } - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - len = write(g_jffsFd11[i], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT3); - } - - free(bufW); - - ICUNIT_GOTO_NOT_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT2); // even number: 2 - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(3); // delay time: 3 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start second get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - g_jffsFd11[i] = open(g_jffsPathname11[i], O_NONBLOCK | O_APPEND | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT2); - } - (void)memset_s(writebuf, sizeof(writebuf), 0, strlen(writebuf)); - - for (i = 0; i < g_testNum; i++) { - (void)strcat_s(writebuf, sizeof(writebuf), "a"); - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - len = write(g_jffsFd11[j], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(10); // delay time: 10 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start third get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - errno = 0; - ret = unlink(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; -EXIT3: - free(bufW); -EXIT2: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - close(g_jffsFd11[i]); - } -EXIT1: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - unlink(g_jffsPathname11[i]); - } -EXIT: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - unlink(g_jffsPathname12[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd1, ret; - INT32 i = 0; - INT32 j = 0; - UINT32 len; - INT32 fileCount2 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR *bufR = NULL; - CHAR *bufW = NULL; - off_t off; - INT32 bufRSize = 6074; // 6074: read length - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 Start frist get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - bufR = (CHAR *)malloc(BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR, NULL, 0, EXIT3); - (void)memset_s(bufR, BYTES_PER_KBYTE + 1, 0, BYTES_PER_KBYTE + 1); - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - len = read(g_jffsFd11[i], readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT3); - - off = lseek(g_jffsFd11[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT3); - - len = read(g_jffsFd11[i], bufR, BYTES_PER_KBYTE); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT3); - - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - ret = rename(g_jffsPathname12[i], g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT3); // even number: 2 - - free(bufR); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(5); // delay time: 5 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 Start second get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - bufR = (CHAR *)malloc(bufRSize); - ICUNIT_TRACK_NOT_EQUAL(bufR, NULL, 0); - (void)memset_s(bufR, bufRSize, 0, bufRSize); - - for (i = 0; i < g_testNum; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - off = lseek(g_jffsFd11[j], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT3); - - len = read(g_jffsFd11[j], bufR, bufRSize + 1); - ICUNIT_GOTO_EQUAL(len, bufRSize, len, EXIT3); - } - } - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - g_jffsFlagF02++; - - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT3); // even number: 2 - - free(bufR); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - return NULL; -EXIT3: - free(bufR); -EXIT2: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - close(g_jffsFd11[i]); - } -EXIT1: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - unlink(g_jffsPathname11[i]); - } -EXIT: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - unlink(g_jffsPathname12[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(100); // delay time: 100 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag:=%d\t", g_jffsFlag); - } - - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure033(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure033", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_034.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_034.cpp deleted file mode 100644 index 0e717e09..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_034.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -static INT32 g_testNum = 100; - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[101] = "liteos"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT1); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - (void)memset_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - (void)strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, pathname1); - (void)strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, bufname); - (void)strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, ".txt"); - (void)strcpy_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname2); - - g_jffsFd11[i] = open(g_jffsPathname12[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT2); - } - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - len = write(g_jffsFd11[i], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT2); - } - - ICUNIT_GOTO_NOT_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT2); // even number: 2 - - free(bufW); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)memset_s(writebuf, sizeof(writebuf), 0, strlen(writebuf)); - - for (i = 0; i < g_testNum; i++) { - (void)strcat_s(writebuf, sizeof(writebuf), "a"); - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - g_jffsFd11[j] = open(g_jffsPathname12[j], O_NONBLOCK | O_TRUNC | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT1); - - len = write(g_jffsFd11[j], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(5); // delay time: 5 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - ret = unlink(g_jffsPathname12[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - close(g_jffsFd11[i]); - } -EXIT: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - unlink(g_jffsPathname12[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd1, ret; - INT32 i = 0; - INT32 j = 0; - UINT32 len; - INT32 fileCount2 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[101] = "liteos"; - CHAR *bufR = NULL; - off_t off; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - bufR = (CHAR *)malloc(BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR, NULL, 0, EXIT2); - (void)memset_s(bufR, BYTES_PER_KBYTE + 1, 0, BYTES_PER_KBYTE + 1); - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - len = read(g_jffsFd11[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(g_jffsFd11[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(g_jffsFd11[i], bufR, BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT2); - - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT2); // even number: 2 - - free(bufR); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < g_testNum; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - g_jffsFd11[j] = open(g_jffsPathname12[j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT1); - - off = lseek(g_jffsFd11[j], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(g_jffsFd11[j], readbuf, 101); // read length: 101 - ICUNIT_GOTO_EQUAL(len, 100, len, EXIT1); // read length: 100 - } - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - - g_jffsFlagF02++; - - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT1); // even number: 2 - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - return NULL; -EXIT2: - free(bufR); -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(g_jffsFd11[i]); - } -EXIT: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(g_jffsPathname12[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority1 = 18; - INT32 priority2 = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(10); // delay time: 10 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag:=%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure034(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure034", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_035.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_035.cpp deleted file mode 100644 index 21d74631..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_035.cpp +++ /dev/null @@ -1,357 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -static INT32 g_testNum = 100; - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[101] = "liteos"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = "/storage/jffs_035"; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufR = NULL; - CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start get lock 1\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT2); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - (void)strcat_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, pathname1); - (void)strcat_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, bufname); - (void)strcat_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, ".txt"); - (void)strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, pathname2); - (void)strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, bufname); - (void)strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, ".txt"); - (void)strcpy_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname1); - (void)strcpy_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname2); - - g_jffsFd11[i] = open(g_jffsPathname12[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT3); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - len = write(g_jffsFd11[i], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT3); - } - - ICUNIT_GOTO_NOT_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT3); // even number: 2 - free(bufW); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(3); // delay time: 3 - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start get lock 2\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)memset_s(writebuf, sizeof(writebuf), 0, strlen(writebuf)); - - for (i = 0; i < g_testNum; i++) { - errno = 0; - (void)strcat_s(writebuf, sizeof(writebuf), "a"); - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - g_jffsFd11[j] = open(g_jffsPathname11[j], O_NONBLOCK | O_TRUNC | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT2); - - len = write(g_jffsFd11[j], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - } - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(15); // delay time: 15 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start get lock 3\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = unlink(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_jffsFlag++; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - return NULL; -EXIT3: - free(bufW); -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(g_jffsFd11[i]); - } -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(g_jffsPathname11[i]); - } -EXIT: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(g_jffsPathname12[i]); - } - g_TestCnt = 0; - mkdir(pathname2, HIGHEST_AUTHORITY); - remove(pathname1); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd1, ret; - INT32 i = 0; - INT32 j = 0; - UINT32 len; - INT32 fileCount2 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[101] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = "/storage/jffs_035"; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufR = NULL; - off_t off; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 Start get lock 1\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF02++; - - bufR = (CHAR *)malloc(BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR, NULL, 0, EXIT3); - (void)memset_s(bufR, BYTES_PER_KBYTE + 1, 0, BYTES_PER_KBYTE + 1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - len = read(g_jffsFd11[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT3); - - off = lseek(g_jffsFd11[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT3); - - len = read(g_jffsFd11[i], bufR, BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT3); - - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = rename(pathname2, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT3); // even number: 2 - free(bufR); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(10); // delay time: 10 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 Start get lock 2\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < g_testNum; i++) { - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - errno = 0; - g_jffsFd11[j] = open(g_jffsPathname11[j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT2); - - off = lseek(g_jffsFd11[j], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(g_jffsFd11[j], readbuf, 101); // read length: 101 - ICUNIT_GOTO_EQUAL(len, 100, len, EXIT2); // read length: 100 - - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT2); // even number: 2 - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - return NULL; -EXIT3: - free(bufR); -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(g_jffsFd11[i]); - } -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(g_jffsPathname11[i]); - } -EXIT: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(g_jffsPathname12[i]); - } - g_TestCnt = 0; - remove(pathname1); - mkdir(pathname2, HIGHEST_AUTHORITY); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - void *tret = NULL; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(100); // delay time: 100 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag:=%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure035(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure035", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_036.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_036.cpp deleted file mode 100644 index 140a27d3..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_036.cpp +++ /dev/null @@ -1,369 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static CHAR g_jffs1647Pathname4[JFFS_SHORT_ARRAY_LENGTH][JFFS_MAXIMUM_SIZES][JFFS_STANDARD_NAME_LENGTH] = {0}; -static CHAR g_jffs1647Pathname5[JFFS_SHORT_ARRAY_LENGTH][JFFS_MAXIMUM_SIZES][JFFS_STANDARD_NAME_LENGTH] = {0}; - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876547210abcdeabcde0123456789abcedfghij9876547210abcdeabcde0123" - "456789abcedfghij9876547210abcdeabcde0123456789abcedfghij9876547210abcdeabcde0123456789abcedfgh" - "ij9876547210abcdeabcde0123456789abcedfghij9876547210lalalalalalalala"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufR = NULL; - CHAR *bufW = NULL; - INT32 bufLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - (void)strcat_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, pathname1); - (void)strcat_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, bufname); - (void)strcpy_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname1); - - ret = mkdir(g_jffsPathname11[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - bufW = (CHAR *)malloc(bufLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT3); - (void)memset_s(bufW, bufLen + 1, 0, bufLen + 1); - - for (i = 0; i < bufLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufLen + 1, filebuf); - } - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - g_jffsFd12[i][j] = open(g_jffs1647Pathname4[i][j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT4); - - len = write(g_jffsFd12[i][j], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT4); - - ret = close(g_jffsFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - } - } - - free(bufW); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(5); // delay time: 5 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - bufR = (CHAR *)malloc(bufLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR, NULL, 0, EXIT3); - (void)memset_s(bufR, bufLen + 1, 0, bufLen + 1); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - g_jffsFd12[i][j] = open(g_jffs1647Pathname5[i][j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT5); - - off = lseek(g_jffsFd12[i][j], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT5); - - len = read(g_jffsFd12[i][j], bufR, bufLen + 1); - ICUNIT_GOTO_EQUAL(len, bufLen, len, EXIT5); - - ret = close(g_jffsFd12[i][k]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - } - } - - free(bufR); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - ret = remove(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - g_jffsFlag++; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; -EXIT5: - free(bufR); - goto EXIT3; -EXIT4: - free(bufW); -EXIT3: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - close(g_jffsFd12[i][j]); - } - } -EXIT2: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - unlink(g_jffs1647Pathname5[i][j]); - } - } -EXIT1: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - unlink(g_jffs1647Pathname4[i][j]); - } - } -EXIT: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - remove(g_jffsPathname11[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd1, ret; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - UINT32 len; - INT32 fileCount2 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - (void)memset_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(g_jffs1647Pathname4[i][j], JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(g_jffs1647Pathname5[i][j], JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", j); - (void)strcat_s(g_jffsPathname2, JFFS_NAME_LIMITTED_SIZE, g_jffsPathname11[i]); - (void)strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, bufname); - (void)strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, ".txt"); - (void)strcpy_s(g_jffs1647Pathname4[i][j], JFFS_STANDARD_NAME_LENGTH, g_jffsPathname2); - - (void)memset_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)strcat_s(g_jffsPathname2, JFFS_NAME_LIMITTED_SIZE, g_jffsPathname11[i]); - (void)strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, bufname); - (void)strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, ".cpp"); - (void)strcpy_s(g_jffs1647Pathname5[i][j], JFFS_STANDARD_NAME_LENGTH, g_jffsPathname2); - - g_jffsFd12[i][j] = open(g_jffs1647Pathname4[i][j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, - HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT1); - - ret = close(g_jffsFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - ret = rename(g_jffs1647Pathname4[i][j], g_jffs1647Pathname5[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - ret = unlink(g_jffs1647Pathname5[i][j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - g_jffsFlagF02++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; -EXIT3: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - close(g_jffsFd12[i][j]); - } - } -EXIT2: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - unlink(g_jffs1647Pathname5[i][j]); - } - } -EXIT1: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - unlink(g_jffs1647Pathname4[i][j]); - } - } -EXIT: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - remove(g_jffsPathname11[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(1); // delay time: 1 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure036(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure036", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_037.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_037.cpp deleted file mode 100644 index 58614efe..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_037.cpp +++ /dev/null @@ -1,363 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static CHAR g_jffs1648Pathname4[5][JFFS_MAXIMUM_SIZES][JFFS_NAME_LIMITTED_SIZE] = {0}; -static CHAR g_jffs1648Pathname5[5][JFFS_MAXIMUM_SIZES][JFFS_NAME_LIMITTED_SIZE] = {0}; - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876548210abcdeabcde0123456789abcedfghij9876548210abcdeabcde0123" - "456789abcedfghij9876548210abcdeabcde0123456789abcedfghij9876548210abcdeabcde0123456789abcedfgh" - "ij9876548210abcdeabcde0123456789abcedfghij9876548210lalalalalalalala"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufR = NULL; - CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)memset_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)strcat_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, pathname1); - - g_TestCnt++; - g_jffsFlagF01++; - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - (void)memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - (void)strcat_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, bufname); - (void)strcpy_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname6); - - ret = mkdir(g_jffsPathname11[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT2); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - g_jffsFd12[i][j] = open(g_jffs1648Pathname4[i][j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT3); - - len = write(g_jffsFd12[i][j], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT3); - - ret = close(g_jffsFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - } - } - free(bufW); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(5); // delay time: 5 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - bufR = (CHAR *)malloc(BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR, NULL, 0, EXIT2); - (void)memset_s(bufR, BYTES_PER_KBYTE + 1, 0, BYTES_PER_KBYTE + 1); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - g_jffsFd12[i][j] = open(g_jffs1648Pathname5[i][j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT4); - - off = lseek(g_jffsFd12[i][j], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT4); - - len = read(g_jffsFd12[i][j], bufR, BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT4); - - ret = close(g_jffsFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - } - } - - free(bufR); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = JFFS_MAX_CYCLES - 1; i >= 0; i--) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - ret = unlink(g_jffs1648Pathname5[i][j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - ret = remove(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; -EXIT4: - free(bufR); - goto EXIT2; -EXIT3: - free(bufW); -EXIT2: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - close(g_jffsFd12[i][j]); - } - } -EXIT1: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - unlink(g_jffs1648Pathname4[i][j]); - } - } -EXIT: - for (i = JFFS_MAX_CYCLES - 1; i >= 0; i--) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - unlink(g_jffs1648Pathname5[i][j]); - } - remove(g_jffsPathname11[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd1, ret; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - UINT32 len; - INT32 fileCount2 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876548210abcdeabcde0123456789abcedfghij9876548210abcdeabcde0123" - "456789abcedfghij9876548210abcdeabcde0123456789abcedfghij9876548210abcdeabcde0123456789abcedfgh" - "ij9876548210abcdeabcde0123456789abcedfghij9876548210lalalalalalalala"; - CHAR readbuf[101] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF02++; - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - (void)memset_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(g_jffsPathname8, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(g_jffs1648Pathname4[i][j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(g_jffs1648Pathname5[i][j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", j); - (void)strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, g_jffsPathname11[i]); - (void)strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, ".txt"); - (void)strcpy_s(g_jffs1648Pathname4[i][j], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname7); - - (void)strcat_s(g_jffsPathname8, JFFS_NAME_LIMITTED_SIZE, g_jffsPathname11[i]); - (void)strcat_s(g_jffsPathname8, JFFS_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_jffsPathname8, JFFS_NAME_LIMITTED_SIZE, ".cpp"); - (void)strcpy_s(g_jffs1648Pathname5[i][j], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname8); - g_jffsFd12[i][j] = open(g_jffs1648Pathname4[i][j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, - HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT2); - - ret = close(g_jffsFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - ret = rename(g_jffs1648Pathname4[i][j], g_jffs1648Pathname5[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - return NULL; -EXIT2: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - close(g_jffsFd12[i][j]); - } - } -EXIT1: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - unlink(g_jffs1648Pathname4[i][j]); - } - } -EXIT: - for (i = JFFS_MAX_CYCLES - 1; i >= 0; i--) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - unlink(g_jffs1648Pathname5[i][j]); - } - remove(g_jffsPathname11[i]); - } - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority1 = 18; - INT32 priority2 = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(10); // delay time: 10 - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure037(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure037", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_038.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_038.cpp deleted file mode 100644 index afd83693..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_038.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876549210abcdeabcde0123456789abcedfghij9876549210abcdeabcde0123" - "456789abcedfghij9876549210abcdeabcde0123456789abcedfghij9876549210abcdeabcde0123456789abcedfgh" - "ij9876549210abcdeabcde0123456789abcedfghij9876549210lalalalalalalala"; - CHAR writebuf[200] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - (void)memset_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)strcat_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, pathname1); - (void)strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, pathname1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - (void)memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(g_jffsPathname13[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - (void)strcat_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, bufname); - (void)strcpy_s(g_jffsPathname13[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname6); - - (void)strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, "A"); - (void)strcpy_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname7); - - if (i == 0) { - (void)strcpy_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname12[i]); - } else { - (void)strcpy_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname13[i]); - (void)strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, "A"); - } - - ret = mkdir(g_jffsPathname13[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = rmdir(g_jffsPathname13[i]); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH - 1; i++) { - ret = rmdir(g_jffsPathname12[i]); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = rmdir(g_jffsPathname12[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - return NULL; -EXIT1: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - remove(g_jffsPathname12[i]); - remove(g_jffsPathname13[i]); - } -EXIT: - remove(JFFS_PATH_NAME0); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd1, ret; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - UINT32 len; - INT32 dirCount2 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876549210abcdeabcde0123456789abcedfghij9876549210abcdeabcde0123" - "456789abcedfghij9876549210abcdeabcde0123456789abcedfghij9876549210abcdeabcde0123456789abcedfgh" - "ij9876549210abcdeabcde0123456789abcedfghij9876549210lalalalalalalala"; - CHAR readbuf[101] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF02++; - - for (j = JFFS_SHORT_ARRAY_LENGTH - 1; j >= 0; j--) { - ret = rename(g_jffsPathname13[j], g_jffsPathname11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - return NULL; - -EXIT: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - remove(g_jffsPathname12[i]); - remove(g_jffsPathname13[i]); - } - remove(JFFS_PATH_NAME0); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(1); // delay time: 1 - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure038(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure038", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_039.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_039.cpp deleted file mode 100644 index a91af8df..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_039.cpp +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static CHAR g_jffs1650Pathname4[JFFS_SHORT_ARRAY_LENGTH][JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; -static CHAR g_jffs1650Pathname5[JFFS_SHORT_ARRAY_LENGTH][JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR writebuf[200] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufR = NULL; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start get lock 1\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)memset_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)strcat_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, pathname1); - - g_TestCnt++; - g_jffsFlagF01++; - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - (void)memset_s(g_jffs1650Pathname4[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(g_jffs1650Pathname5[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - (void)strcat_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, bufname); - (void)strcpy_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname6); - - ret = mkdir(g_jffsPathname11[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - (void)memset_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", j); - (void)strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, g_jffsPathname6); - (void)strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, ".txt"); - (void)strcpy_s(g_jffs1650Pathname4[i][j], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname7); - - (void)memset_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, g_jffsPathname6); - (void)strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, ".cpp"); - (void)strcpy_s(g_jffs1650Pathname5[i][j], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname7); - - g_jffsFd12[i][j] = open(g_jffs1650Pathname4[i][j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, - HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT1); - - ret = close(g_jffsFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start get lock 2\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - bufR = (CHAR *)malloc(BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR, NULL, 0, EXIT1); - (void)memset_s(bufR, BYTES_PER_KBYTE + 1, 0, BYTES_PER_KBYTE + 1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - g_jffsFd12[i][j] = open(g_jffs1650Pathname4[i][j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT2); - - len = read(g_jffsFd12[i][j], bufR, BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT2); - - ret = close(g_jffsFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - - free(bufR); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start get lock 3\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - return NULL; -EXIT2: - free(bufR); -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - close(g_jffsFd12[i][j]); - } - } -EXIT: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - for (j = JFFS_SHORT_ARRAY_LENGTH - 1; j >= 0; j--) { - remove(g_jffs1650Pathname4[i][j]); - remove(g_jffs1650Pathname5[i][j]); - } - - remove(g_jffsPathname11[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd1, ret; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - UINT32 len; - INT32 fileCount2 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR readbuf[101] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 Start get lock 1\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT1); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (j = 0; j < bufWLen / strlen(filebuf); j++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - g_jffsFd12[i][j] = open(g_jffs1650Pathname4[i][j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT2); - - len = write(g_jffsFd12[i][j], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT2); - - ret = close(g_jffsFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - free(bufW); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 Start get lock 2\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - ret = rename(g_jffs1650Pathname4[i][j], g_jffs1650Pathname5[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 Start get lock 3\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - for (j = JFFS_SHORT_ARRAY_LENGTH - 1; j >= 0; j--) { - ret = remove(g_jffs1650Pathname5[i][j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - ret = remove(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - g_jffsFlagF02++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - close(g_jffsFd12[i][j]); - } - } -EXIT: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - for (j = JFFS_SHORT_ARRAY_LENGTH - 1; j >= 0; j--) { - remove(g_jffs1650Pathname4[i][j]); - remove(g_jffs1650Pathname5[i][j]); - } - remove(g_jffsPathname11[i]); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - g_TestCnt = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(10); // delay time: 10 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure039(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure039", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_040.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_040.cpp deleted file mode 100644 index 4e35f995..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_040.cpp +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - INT32 dirCount = 0; - INT32 dirCount1 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufR = NULL; - CHAR *bufW = NULL; - INT32 bufLen = 2 * BYTES_PER_KBYTE; // 2 KB - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, pathname); - (void)strcat_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, pathname); - (void)strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, "/"); - (void)strcat_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, "/"); - - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "AAAA%d", i); - (void)strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, bufname); - - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "BBBB%d", i); - (void)strcat_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, bufname); - - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "%d", i); - (void)strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, bufname); - - g_jffsFd11[i] = open(g_jffsPathname11[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT); - - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - bufR = (CHAR *)malloc(bufLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR, NULL, 0, EXIT2); - (void)memset_s(bufR, bufLen + 1, 0, bufLen + 1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - g_jffsFd11[i] = open(g_jffsPathname11[i], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT3); - - ret = read(g_jffsFd11[i], bufR, bufLen + 1); - ICUNIT_GOTO_EQUAL(ret, bufLen, ret, EXIT3); - - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - free(bufR); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - bufR = (CHAR *)malloc(bufLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR, NULL, 0, EXIT2); - (void)memset_s(bufR, bufLen + 1, 0, bufLen + 1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - g_jffsFd11[i] = open(g_jffsPathname11[i], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT3); - - ret = read(g_jffsFd11[i], bufR, bufLen); - ICUNIT_GOTO_EQUAL(ret, bufLen, ret, EXIT3); - - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - free(bufR); - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - return NULL; -EXIT3: - free(bufR); -EXIT2: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - close(g_jffsFd11[i]); - } -EXIT1: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - remove(g_jffsPathname12[i]); - } -EXIT: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - remove(g_jffsPathname11[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 dirCount = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 2 * BYTES_PER_KBYTE; // 2 KB - - g_TestCnt++; - g_jffsFlagF02++; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT2); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - g_jffsFd11[i] = open(g_jffsPathname11[i], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT3); - - len = write(g_jffsFd11[i], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT3); - - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - free(bufW); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - if (j % 2 == 0) { // even number: 2 - ret = rename(g_jffsPathname11[i], g_jffsPathname12[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } else { - ret = rename(g_jffsPathname12[i], g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = remove(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - return NULL; -EXIT3: - free(bufW); -EXIT2: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - close(g_jffsFd11[i]); - } -EXIT1: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - remove(g_jffsPathname12[i]); - } -EXIT: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - remove(g_jffsPathname11[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(1); // delay time: 1 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag:=%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure040(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure040", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_041.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_041.cpp deleted file mode 100644 index 1e8b977d..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_041.cpp +++ /dev/null @@ -1,363 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - INT32 dirCount1 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - off_t off; - INT32 fileNum = 4; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 first get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - for (j = 0; j < fileNum; j++) { - (void)memset_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(g_jffsPathname13[j], JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", j); - (void)strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, pathname); - (void)strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, pathname); - (void)strcat_s(g_jffsPathname13[j], JFFS_NAME_LIMITTED_SIZE, pathname); - - (void)strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_jffsPathname13[j], JFFS_NAME_LIMITTED_SIZE, bufname); - - (void)strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, ".txt"); - (void)strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, ".cpp"); - (void)strcat_s(g_jffsPathname13[j], JFFS_NAME_LIMITTED_SIZE, ".jpg"); - - g_jffsFd11[j] = open(g_jffsPathname11[j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT2); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(3); // delay time: 3 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 second get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - for (j = 0; j < fileNum; j++) { - errno = 0; - off = lseek(g_jffsFd11[j], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 1 * 1024, off, EXIT2); // file size: 1 * 1024 - } - - for (j = 0; j < fileNum; j++) { - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - } - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (j = 0; j < JFFS_MAXIMUM_OPERATIONS; j++) { - ret = umount(JFFS_MAIN_DIR0); - printf("[%d] umount:%s,\n", __LINE__, JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - printf("[%d] mount:%s,\n", __LINE__, JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3); - } - ret = chdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(3); // delay time: 3 - printf("[%d] Thread1 Start third get lock\n", __LINE__); - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 third get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (j = 0; j < JFFS_MAXIMUM_OPERATIONS; j++) { - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3); - } - - ret = chdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (j = 0; j < fileNum; j++) { - ret = access(g_jffsPathname13[j], F_OK); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3); - } - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT2: - for (j = 0; j < fileNum; j++) { - close(g_jffsFd11[j]); - } -EXIT1: - for (j = 0; j < fileNum; j++) { - remove(g_jffsPathname11[j]); - remove(g_jffsPathname12[j]); - remove(g_jffsPathname13[j]); - } -EXIT: - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - INT32 fileCount = 0; - UINT64 len; - CHAR bufname[15] = "01234567890"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufR[JFFS_SHORT_ARRAY_LENGTH] = "abcde"; - CHAR writebuf[JFFS_SHORT_ARRAY_LENGTH] = "a"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufW = NULL; - off_t off; - INT32 fileNum = 4; - INT32 bufWLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 first get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT2); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (j = 0; j < fileNum; j++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - g_TestCnt++; - - for (j = 0; j < fileNum; j++) { - len = write(g_jffsFd11[j], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT3); - } - - free(bufW); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 second get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - for (j = 0; j < fileNum; j++) { - errno = 0; - ret = rename(g_jffsPathname11[j], g_jffsPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - } - - for (j = 0; j < fileNum; j++) { - ret = rename(g_jffsPathname12[j], g_jffsPathname13[j]); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 third get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - for (j = 0; j < fileNum; j++) { - g_jffsFd11[j] = open(g_jffsPathname13[j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT2); - } - - for (j = 0; j < fileNum; j++) { - off = lseek(g_jffsFd11[j], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 1 * 1024, off, EXIT2); // file size: 1 * 1024 - } - - for (j = 0; j < fileNum; j++) { - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - ret = unlink(g_jffsPathname13[j]); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1); - } - - g_jffsFlagF02++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - return NULL; -EXIT3: - free(bufW); -EXIT2: - for (j = 0; j < fileNum; j++) { - close(g_jffsFd11[j]); - } -EXIT1: - for (j = 0; j < fileNum; j++) { - remove(g_jffsPathname11[j]); - remove(g_jffsPathname12[j]); - remove(g_jffsPathname13[j]); - } -EXIT: - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufW1 = NULL; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(50); // delay time: 50 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); - - return LOS_OK; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return LOS_OK; -} - -VOID ItFsJffsPressure041(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure041", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_042.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_042.cpp deleted file mode 100644 index fb4670d0..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_042.cpp +++ /dev/null @@ -1,356 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = "/storage/jffs_042"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - off_t off; - INT32 fileNum = 4; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - for (j = 0; j < fileNum; j++) { - (void)memset_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", j); - (void)strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, pathname); - (void)strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, pathname2); - - (void)strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, bufname); - - (void)strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, ".txt"); - (void)strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, ".txt"); - - g_jffsFd11[j] = open(g_jffsPathname11[j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT2); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(3); // delay time: 3 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - printf("[%d] Thread1 second Get lock \n", __LINE__); - - for (j = 0; j < fileNum; j++) { - off = lseek(g_jffsFd11[j], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 1 * 1024, off, EXIT2); // file size: 1 * 1024 - } - - for (j = 0; j < fileNum; j++) { - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (j = 0; j < JFFS_MAXIMUM_OPERATIONS; j++) { - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(3); // delay time: 3 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - printf("[%d] Thread1 third Get lock \n", __LINE__); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (j = 0; j < JFFS_MAXIMUM_OPERATIONS; j++) { - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - for (j = 0; j < fileNum; j++) { - ret = access(g_jffsPathname12[j], F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT2: - for (j = 0; j < fileNum; j++) { - close(g_jffsFd11[j]); - } -EXIT1: - for (j = 0; j < fileNum; j++) { - remove(g_jffsPathname11[j]); - remove(g_jffsPathname12[j]); - } -EXIT: - g_TestCnt = 0; - remove(pathname2); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - CHAR bufname[15] = "01234567890"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = "/storage/jffs_042"; - CHAR bufR[JFFS_SHORT_ARRAY_LENGTH] = "abcde"; - CHAR writebuf[JFFS_SHORT_ARRAY_LENGTH] = "a"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufW = NULL; - off_t off; - INT32 fileNum = 4; - INT32 bufWLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT2); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (j = 0; j < bufWLen / strlen(filebuf); j++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - g_TestCnt++; - - for (j = 0; j < fileNum; j++) { - len = write(g_jffsFd11[j], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT3); - } - - free(bufW); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - printf("[%d] Thread2 second Get lock \n", __LINE__); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - printf("[%d] Thread2 third Get lock \n", __LINE__); - for (j = 0; j < fileNum; j++) { - g_jffsFd11[j] = open(g_jffsPathname12[j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT2); - } - - for (j = 0; j < fileNum; j++) { - off = lseek(g_jffsFd11[j], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, BYTES_PER_KBYTE, off, EXIT2); - } - - for (j = 0; j < fileNum; j++) { - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(g_jffsPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_jffsFlagF02++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - return NULL; -EXIT3: - free(bufW); -EXIT2: - for (j = 0; j < fileNum; j++) { - close(g_jffsFd11[j]); - } -EXIT1: - for (j = 0; j < fileNum; j++) { - remove(g_jffsPathname11[j]); - remove(g_jffsPathname12[j]); - } -EXIT: - g_TestCnt = 0; - remove(pathname2); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufW1 = NULL; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(10); // delay time: 10 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure042(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure042", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_043.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_043.cpp deleted file mode 100644 index 477878ca..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_043.cpp +++ /dev/null @@ -1,408 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf1[JFFS_STANDARD_NAME_LENGTH] = "0123456789LLLLLL"; - CHAR filebuf2[JFFS_STANDARD_NAME_LENGTH] = "aaaaaaaaaaaaaaaa"; - CHAR filebuf3[JFFS_STANDARD_NAME_LENGTH] = "BBBBBBBBBBBBBBBB"; - CHAR *bufR1 = NULL; - CHAR *bufR2 = NULL; - CHAR *bufR3 = NULL; - off_t off; - INT32 fileNum = 3; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - for (j = 0; j < fileNum; j++) { - (void)memset_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", j); - (void)strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, pathname); - (void)strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, pathname2); - - (void)strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, bufname); - - (void)strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, ".txt"); - (void)strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, ".cpp"); - - g_jffsFd11[j] = open(g_jffsPathname11[j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT2); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Second Get lock,ret:%d \n", __LINE__, ret); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - bufR1 = (CHAR *)malloc(BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR1, NULL, 0, EXIT2); - (void)memset_s(bufR1, BYTES_PER_KBYTE + 1, 0, BYTES_PER_KBYTE + 1); - - bufR2 = (CHAR *)malloc(BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR2, NULL, 0, EXIT3); - (void)memset_s(bufR2, BYTES_PER_KBYTE + 1, 0, BYTES_PER_KBYTE + 1); - - bufR3 = (CHAR *)malloc(BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR3, NULL, 0, EXIT4); - (void)memset_s(bufR3, BYTES_PER_KBYTE + 1, 0, BYTES_PER_KBYTE + 1); - - for (j = 0; j < fileNum; j++) { - off = lseek(g_jffsFd11[j], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, BYTES_PER_KBYTE, off, EXIT5); - } - - for (j = 0; j < fileNum; j++) { - off = lseek(g_jffsFd11[j], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT5); - } - - j = 0; - len = read(g_jffsFd11[j], bufR1, BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT5); - - j++; - len = read(g_jffsFd11[j], bufR2, BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT5); - - j++; - len = read(g_jffsFd11[j], bufR3, BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT5); - - for (j = 0; j < fileNum; j++) { - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - } - - for (j = 0; j < fileNum; j++) { - g_jffsFd11[j] = open(g_jffsPathname11[j], O_NONBLOCK | O_TRUNC | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT5); - } - - j = 0; - len = write(g_jffsFd11[j], bufR2, strlen(bufR2)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT5); - - j++; - len = write(g_jffsFd11[j], bufR3, strlen(bufR3)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT5); - - j++; - len = write(g_jffsFd11[j], bufR1, strlen(bufR1)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT5); - - for (j = 0; j < fileNum; j++) { - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - } - - free(bufR1); - free(bufR2); - free(bufR3); - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - return NULL; -EXIT5: - free(bufR3); -EXIT4: - free(bufR2); -EXIT3: - free(bufR1); -EXIT2: - for (j = 0; j < fileNum; j++) { - close(g_jffsFd11[j]); - } -EXIT1: - for (j = 0; j < fileNum; j++) { - remove(g_jffsPathname11[j]); - remove(g_jffsPathname12[j]); - } -EXIT: - g_TestCnt = 0; - remove(pathname2); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - CHAR bufname[15] = "01234567890"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf1[JFFS_STANDARD_NAME_LENGTH] = "0123456789LLLLLL"; - CHAR filebuf2[JFFS_STANDARD_NAME_LENGTH] = "aaaaaaaaaaaaaaaa"; - CHAR filebuf3[JFFS_STANDARD_NAME_LENGTH] = "BBBBBBBBBBBBBBBB"; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - CHAR *bufW3 = NULL; - off_t off; - INT32 bufWLen = BYTES_PER_KBYTE; - INT32 fileNum = 3; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 First Get lock,ret:%d \n", __LINE__, ret); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - g_TestCnt++; - - bufW1 = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - (void)memset_s(bufW1, bufWLen + 1, 0, bufWLen + 1); - - bufW2 = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - (void)memset_s(bufW2, bufWLen + 1, 0, bufWLen + 1); - - bufW3 = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW3, NULL, 0, EXIT4); - (void)memset_s(bufW3, bufWLen + 1, 0, bufWLen + 1); - - for (j = 0; j < bufWLen / strlen(filebuf1); j++) { - (void)strcat_s(bufW1, bufWLen + 1, filebuf1); - (void)strcat_s(bufW2, bufWLen + 1, filebuf2); - (void)strcat_s(bufW3, bufWLen + 1, filebuf3); - } - - j = 0; - ret = write(g_jffsFd11[j], bufW1, strlen(bufW1)); - ICUNIT_GOTO_EQUAL(ret, strlen(bufW1), ret, EXIT5); - - j++; - ret = write(g_jffsFd11[j], bufW2, strlen(bufW2)); - ICUNIT_GOTO_EQUAL(ret, strlen(bufW2), ret, EXIT5); - - j++; - ret = write(g_jffsFd11[j], bufW3, strlen(bufW3)); - ICUNIT_GOTO_EQUAL(ret, strlen(bufW3), ret, EXIT5); - - free(bufW1); - free(bufW2); - free(bufW3); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(10); // delay time: 10 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 Second Get lock,ret:%d \n", __LINE__, ret); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (j = 0; j < fileNum; j++) { - ret = rename(g_jffsPathname11[j], g_jffsPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - for (j = 0; j < JFFS_MAXIMUM_OPERATIONS; j++) { - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - } - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (j = 0; j < fileNum; j++) { - g_jffsFd11[j] = open(g_jffsPathname12[j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT2); - } - - for (j = 0; j < fileNum; j++) { - off = lseek(g_jffsFd11[j], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 1 * 1024, off, EXIT2); // file size: 1 * 1024 - } - - for (j = 0; j < fileNum; j++) { - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(g_jffsPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_jffsFlagF02++; - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - return NULL; -EXIT7: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, "vfat", 0, NULL); - goto EXIT2; -EXIT5: - free(bufW3); -EXIT4: - free(bufW2); -EXIT3: - free(bufW1); -EXIT2: - for (j = 0; j < fileNum; j++) { - close(g_jffsFd11[j]); - } -EXIT1: - for (j = 0; j < fileNum; j++) { - remove(g_jffsPathname11[j]); - remove(g_jffsPathname12[j]); - } -EXIT: - g_TestCnt = 0; - remove(pathname2); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufW1 = NULL; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(10); // delay time: 10 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure043(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure043", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_044.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_044.cpp deleted file mode 100644 index 26375564..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_044.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "a"; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "LLLLLLLLLL"; - off_t off; - - g_TestCnt++; - - fd = open(pathname, O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT); - - off = lseek(fd, -10, SEEK_END); // seek offset: -10 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT); - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT); - -EXIT: - close(fd); - g_TestCnt++; - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "a"; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - - g_TestCnt++; - - fd = open(pathname, O_RDONLY, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT); - -EXIT: - g_TestCnt++; - close(fd); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "a"; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - INT32 testNum = 4; - - g_jffsFlag = 0; - - ret = access(pathname, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - while (g_jffsFlag < JFFS_PRESSURE_CYCLES) { - g_TestCnt = 0; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT3); - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT3); - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - while (g_TestCnt != testNum) { - LosTaskDelay(1); // delay time: 1 - } - - g_jffsFlag++; - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - return JFFS_NO_ERROR; -EXIT3: - close(fd); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure044(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure044", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_045.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_045.cpp deleted file mode 100644 index 6ce4488b..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_045.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - g_TestCnt++; - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - - sleep(2); // sleep time: 2 - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - return NULL; - -EXIT: - closedir(dir); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - g_TestCnt++; - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - - sleep(3); // sleep time: 3 - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - return NULL; - -EXIT: - closedir(dir); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - INT32 testNum = 4; - - g_jffsFlag = 0; - - ret = access(pathname, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - while (g_jffsFlag < JFFS_PRESSURE_CYCLES) { - g_TestCnt = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - while (g_TestCnt != testNum) { - LosTaskDelay(1); // delay time: 1 - } - - g_jffsFlag++; - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure045(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure045", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_046.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_046.cpp deleted file mode 100644 index 59767fe1..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_046.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "a"; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "LLLLLLLLLL"; - off_t off = 0; - - g_TestCnt++; - - len = write(g_jffsFd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT); - - off = lseek(g_jffsFd, -10, SEEK_END); // seek offset: -10 - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT); // file position: 10 - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(g_jffsFd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT); - - g_TestCnt++; - - return NULL; - -EXIT: - close(g_jffsFd); - g_TestCnt++; - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret, len; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "a"; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "AAAAAAAAAA"; - off_t off = 0; - - g_TestCnt++; - - off = lseek(g_jffsFd, -10, SEEK_END); // seek offset: -10 - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT); // file position: 10 - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(g_jffsFd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT); // file size: 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "LLLLLLLLLL", readbuf, EXIT); - - len = write(g_jffsFd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT); - - off = lseek(g_jffsFd, -10, SEEK_END); // seek offset: -10 - ICUNIT_GOTO_EQUAL(off, 20, off, EXIT); // file position: 20 - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(g_jffsFd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT); // file size: 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT); - - g_TestCnt++; - - return NULL; - -EXIT: - close(g_jffsFd); - g_TestCnt++; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "a"; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - INT32 testNum = 4; - - g_jffsFlag = 0; - - ret = access(pathname, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - while (g_jffsFlag < JFFS_PRESSURE_CYCLES) { - g_TestCnt = 0; - - g_jffsFd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd, JFFS_IS_ERROR, g_jffsFd, EXIT3); - - len = write(g_jffsFd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT3); - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(g_jffsFd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT3); - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - while (g_TestCnt != testNum) { - LosTaskDelay(1); // delay time: 1 - } - - g_jffsFlag++; - - ret = close(g_jffsFd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - return JFFS_NO_ERROR; -EXIT3: - close(g_jffsFd); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure046(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure046", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_047.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_047.cpp deleted file mode 100644 index e3e80fb4..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_047.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - UINT32 writeSize = JFFS_PRESSURE_W_R_SIZE1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR *writeBuf = NULL; - struct stat64 statbuf1; - off64_t off64; - - writeBuf = (CHAR *)malloc(writeSize); - ICUNIT_GOTO_NOT_EQUAL(writeBuf, NULL, writeBuf, EXIT); - (void)memset_s(writeBuf, writeSize, 0x61, writeSize); - - g_jffsFd = open64(pathname1, O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd, JFFS_IS_ERROR, g_jffsFd, EXIT1); - - while (1) { - ret = write(g_jffsFd, writeBuf, writeSize); - printf("[%d]write_size: %d write ret:%d Fd:%d \n", __LINE__, writeSize, ret, g_jffsFd); - if (ret <= 0) { - break; - } - g_TestCnt++; - dprintf("write 5M date %d times\n", g_TestCnt); - } - - ret = stat64(pathname1, &statbuf1); - printf("[%d]stat64 ret:%d Fd:%d \n", __LINE__, ret, g_jffsFd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - off64 = lseek64(g_jffsFd, 0, SEEK_END); - printf("[%d]lseek64 off64:%lld Fd:%d \n", __LINE__, off64, g_jffsFd); - ICUNIT_GOTO_EQUAL(statbuf1.st_size, off64, statbuf1.st_size, EXIT1); - - len = write(g_jffsFd, writeBuf, strlen(writeBuf)); - printf("[%d]lseek64 len:%d Fd:%d, errno:%d\n", __LINE__, len, g_jffsFd, errno); - ICUNIT_GOTO_EQUAL(len, JFFS_IS_ERROR, len, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOSPC, errno, EXIT1); - - off64 = lseek64(g_jffsFd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(statbuf1.st_size, off64, statbuf1.st_size, EXIT1); - - off64 = lseek64(g_jffsFd, -10, SEEK_END); // seek offset: -10 - ICUNIT_GOTO_EQUAL(off64, statbuf1.st_size - 10, off64, EXIT1); - - ret = close(g_jffsFd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - free(writeBuf); - - return NULL; -EXIT1: - close(g_jffsFd); -EXIT: - free(writeBuf); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off64_t off64; - pthread_t newTh1; - pthread_attr_t attr1; - struct stat64 statbuf1; - struct stat64 statbuf2; - - g_TestCnt = 0; - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - g_jffsFd = open64(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd, JFFS_IS_ERROR, g_jffsFd, EXIT2); - - len = read(g_jffsFd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(g_jffsFd); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT2); - - ret = PosixPthreadInit(&attr1, TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_join(newTh1, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = close(g_jffsFd); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat64(pathname1, &statbuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - errno = 0; - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat64(pathname1, &statbuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(statbuf2.st_size, statbuf1.st_size, statbuf2.st_size, EXIT); - dprintf("\tcycle=:%d\t", i); - } - - g_jffsFd = open64(pathname1, O_RDONLY | O_APPEND, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd, JFFS_IS_ERROR, g_jffsFd, EXIT2); - - off64 = lseek64(g_jffsFd, -10, SEEK_END); // seek offset: -10 - ICUNIT_GOTO_EQUAL(off64, statbuf1.st_size - 10, off64, EXIT); - - len = read(g_jffsFd, readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); - - ret = close(g_jffsFd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - goto EXIT; -EXIT2: - close(g_jffsFd); - goto EXIT; -EXIT1: - pthread_join(newTh1, NULL); - pthread_attr_destroy(&attr1); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure047(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure047", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_048.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_048.cpp deleted file mode 100644 index 0675e609..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_048.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd = -1; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - struct stat statbuf1; - struct stat statbuf2; - - g_TestCnt = 0; - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(pathname1, &statbuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(statbuf1.st_size, 0, statbuf1.st_size, EXIT); - JffsStatPrintf(statbuf1); - - while (i < 1024) { // loop times: 1024 - errno = 0; - (void)memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(pathname3, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/_%d", i); - (void)strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, pathname2); - (void)strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, bufname); - - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - printf("[%d]open cycle:%d name :%s, fd:%d, errno:%d\n", __LINE__, i, pathname3, fd, errno); - if (fd == JFFS_IS_ERROR) { - dprintf("Open the files is the moust:=%d\n", i); - break; - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - } - - for (k = 0; k < JFFS_MAXIMUM_OPERATIONS; k++) { - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = stat(pathname1, &statbuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(statbuf2.st_size, statbuf1.st_size, statbuf2.st_size, EXIT1); - - for (j = 0; j < i; j++) { - (void)memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(pathname3, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/_%d", j); - (void)strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, pathname2); - (void)strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, bufname); - - ret = remove(pathname3); - printf("[%d] cycle:%d remove name :%s, errno:%d\n", __LINE__, j, pathname3, errno); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(pathname2, &statbuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - close(fd); - for (j = 0; j < i; j++) { - (void)memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(pathname3, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/_%d", j); - (void)strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, pathname2); - (void)strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, bufname); - - remove(pathname3); - } -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure048(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure048", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_049.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_049.cpp deleted file mode 100644 index fa3ecce0..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_049.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - struct stat statbuf1; - struct stat statbuf2; - - g_TestCnt = 0; - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(pathname1, &statbuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(statbuf1.st_size, 0, statbuf1.st_size, EXIT); - - while (i < 100) { // loop times: 100 - (void)memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(pathname3, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/_%d", i); - (void)strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, pathname2); - (void)strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, bufname); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - printf("[%d]mkdir cycle:%d name: %s, errno:%d\n", __LINE__, i, pathname3, errno); - if (ret == -1) { - break; - } - - i++; - } - - for (k = 0; k < JFFS_MAXIMUM_OPERATIONS; k++) { - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = stat(pathname1, &statbuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(statbuf2.st_size, statbuf1.st_size, statbuf2.st_size, EXIT1); - - for (j = 0; j < i; j++) { - errno = 0; - (void)memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(pathname3, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/_%d", j); - (void)strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, pathname2); - (void)strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, bufname); - - ret = remove(pathname3); - printf("[%d]remove cycle:%d name: %s, errno:%d\n", __LINE__, j, pathname3, errno); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = stat(pathname1, &statbuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(statbuf2.st_size, statbuf1.st_size, statbuf2.st_size, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - for (j = 0; j < i; j++) { - (void)memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)memset_s(pathname3, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/_%d", j); - (void)strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, pathname2); - (void)strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, bufname); - - remove(pathname3); - } -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure049(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure049", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_050.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_050.cpp deleted file mode 100644 index 76747e5a..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_050.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR *writeBuf = NULL; - UINT32 writeSize = JFFS_PRESSURE_W_R_SIZE1; - - writeBuf = (CHAR *)malloc(writeSize); - ICUNIT_GOTO_NOT_EQUAL(writeBuf, NULL, writeBuf, EXIT); - (void)memset_s(writeBuf, writeSize, (0x61 + (INT32)(INTPTR)arg), writeSize); - - fd = open64(g_jffsPathname11[(INT32)(INTPTR)arg], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - dprintf("(INT32)(INTPTR)arg=:%d,jffs_pathname11=:%s\n", (INT32)(INTPTR)arg, g_jffsPathname11[(INT32)(INTPTR)arg]); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - LosTaskDelay(3); // delay time: 3 - - while (1) { - ret = write(fd, writeBuf, writeSize); - if (ret <= 0) { - break; - } - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_IS_ERROR, len, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOSPC, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - free(writeBuf); - - return NULL; -EXIT1: - close(fd); -EXIT: - free(writeBuf); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len, i; - INT32 fd = -1; - UINT64 toatlSize1, toatlSize2; - UINT64 freeSize1, freeSize2; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off64_t off64; - pthread_attr_t attr; - pthread_t threadId[JFFS_THREAD_NUM_TEST]; - struct statfs statfsbuf1; - struct statfs statfsbuf2; - struct stat64 statbuf; - - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - (void)memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "_%d", i); - (void)strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - (void)strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, bufname); - } - - g_TestCnt = 0; - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = statfs(pathname1, &statfsbuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - toatlSize1 = (UINT64)statfsbuf1.f_bsize * statfsbuf1.f_blocks; - freeSize1 = (UINT64)statfsbuf1.f_bsize * statfsbuf1.f_bfree; - - ret = PosixPthreadInit(&attr, TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAXIMUM_OPERATIONS; i++) { - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - fd = open64(g_jffsPathname11[i], O_RDONLY | O_APPEND, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = stat64(g_jffsPathname11[i], &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - off64 = lseek64(fd, -10, SEEK_END); // seek offset: -10 - ICUNIT_GOTO_EQUAL(off64, statbuf.st_size - 10, off64, EXIT); - - (void)memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - ret = statfs(pathname1, &statfsbuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - toatlSize2 = (UINT64)statfsbuf2.f_bsize * statfsbuf2.f_blocks; - freeSize2 = (UINT64)statfsbuf2.f_bsize * statfsbuf2.f_bfree; - ICUNIT_GOTO_EQUAL(toatlSize1, toatlSize2, toatlSize1, EXIT); - ICUNIT_GOTO_NOT_EQUAL(freeSize1, freeSize2, freeSize1, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - goto EXIT; -EXIT2: - close(fd); - goto EXIT; -EXIT1: - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - pthread_join(threadId[i], NULL); - } - pthread_attr_destroy(&attr); -EXIT: - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - remove(g_jffsPathname11[i]); - } - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure050(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure050", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_051.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_051.cpp deleted file mode 100644 index 11491943..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_051.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len, i; - INT32 fd = -1; - INT64 total = 0; - INT64 perTime; - INT64 totalSize = 0; - INT64 totalTime = 0; - INT32 cycleCount = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR *writeBuf = NULL; - UINT32 writeSize = JFFS_PRESSURE_W_R_SIZE1; - DOUBLE testSpeed; - CHAR *pid = NULL; - struct timeval testTime1; - struct timeval testTime2; - - writeBuf = (CHAR *)malloc(writeSize); - ICUNIT_GOTO_NOT_EQUAL(writeBuf, NULL, writeBuf, EXIT); - - gettimeofday(&testTime1, 0); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - dprintf("\n open %s,task %lld ms,\n", pathname1, perTime / MSECS_PER_SEC); - - gettimeofday(&testTime1, 0); - - while (1) { - len = write(fd, writeBuf, writeSize); - if (len <= 0) { - break; - } - g_TestCnt++; - - total += len; - totalSize += len; - if (total >= JFFS_WR_CAP_SIZE_TEST) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - dprintf("%d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", cycleCount++, total, - perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - dprintf("\n total write=%lld, time=%lld,arv speed =%0.3lfMB/s,\n", totalSize, totalTime, testSpeed); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_IS_ERROR, len, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOSPC, errno, EXIT1); - - gettimeofday(&testTime1, 0); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - dprintf("\n sucess to fclose the %s,task:%lld ms,\n", pathname1, perTime / MSECS_PER_SEC); - - free(writeBuf); - - return NULL; -EXIT1: - close(fd); -EXIT: - free(writeBuf); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_t newTh1; - pthread_attr_t attr1; - - g_TestCnt = 0; - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr1, TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_join(newTh1, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure051(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure051", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_052.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_052.cpp deleted file mode 100644 index de6b6c9a..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_052.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static CHAR *g_writeBuf = NULL; - -static VOID *PthreadF01(void *arg) -{ - INT32 len, taskId; - INT64 total = 0; - INT64 perTime; - INT64 totalSize = 0; - INT64 totalTime = 0; - INT32 cycleCount = 0; - UINT32 writeSize = JFFS_PRESSURE_W_R_SIZE1; - DOUBLE testSpeed; - struct timeval testTime1; - struct timeval testTime2; - INT32 testNum = 4 * 1024 / 5; // 4 * 1024 / 5: test number - - taskId = (UINT32)(UINTPTR)arg; - - gettimeofday(&testTime1, 0); - - while (1) { - len = write(g_jffsFd, g_writeBuf, writeSize); - if (len <= 0) { - if (g_TestCnt < testNum) { - dprintf("\n TaskID:%3d, The biggest file size is smaller than the 4GB", taskId); - goto EXIT; - } - dprintf("\n TaskID:%3d, The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB", taskId, g_TestCnt, - g_TestCnt * 5, (g_TestCnt * 5) * 1.0 / BYTES_PER_KBYTE); // file size per test: 5 MB - - break; - } - g_TestCnt++; - - total += len; - totalSize += len; - if (total >= JFFS_WR_CAP_SIZE_TEST) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - dprintf("TaskID:%3d, %d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", taskId, - cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - dprintf("\n TaskID:%3d,total write=%lld, time=%lld,arv speed =%0.3lfMB/s,\n", taskId, totalSize, totalTime, - testSpeed); - - return NULL; -EXIT1: - close(g_jffsFd); -EXIT: - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len, i, j; - UINT64 toatlSize1, toatlSize2; - UINT64 freeSize1, freeSize2; - UINT32 writeSize = JFFS_PRESSURE_W_R_SIZE1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off64_t off64; - pthread_t threadId[JFFS_THREAD_NUM_TEST]; - pthread_attr_t attr; - struct statfs statfsbuf1; - struct statfs statfsbuf2; - struct stat64 statbuf; - - g_TestCnt = 0; - - g_writeBuf = (CHAR *)malloc(writeSize); - ICUNIT_GOTO_NOT_EQUAL(g_writeBuf, NULL, g_writeBuf, EXIT); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - g_jffsFd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd, JFFS_IS_ERROR, g_jffsFd, EXIT1); - - ret = statfs(pathname1, &statfsbuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - toatlSize1 = (UINT64)statfsbuf1.f_bsize * statfsbuf1.f_blocks; - freeSize1 = (UINT64)statfsbuf1.f_bsize * statfsbuf1.f_bfree; - - ret = PosixPthreadInit(&attr, TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (j = 0; j < JFFS_THREAD_NUM_TEST; j++) { - pthread_join(threadId[j], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat64(pathname1, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - off64 = lseek64(g_jffsFd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off64, statbuf.st_size, off64, EXIT1); - - ret = close(g_jffsFd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &statfsbuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - toatlSize2 = (UINT64)statfsbuf2.f_bsize * statfsbuf2.f_blocks; - freeSize2 = (UINT64)statfsbuf2.f_bsize * statfsbuf2.f_bfree; - - ICUNIT_GOTO_EQUAL(toatlSize1, toatlSize2, toatlSize1, EXIT); - ICUNIT_GOTO_EQUAL(((statfsbuf1.f_bfree - statfsbuf2.f_bfree) >= 0), TRUE, (statfsbuf1.f_bfree - statfsbuf2.f_bfree), - EXIT); - - free(g_writeBuf); - g_writeBuf = NULL; - - return JFFS_NO_ERROR; -EXIT2: - for (j = 0; j < JFFS_THREAD_NUM_TEST; j++) { - pthread_join(threadId[i], NULL); - } - pthread_attr_destroy(&attr); -EXIT1: - close(g_jffsFd); - remove(pathname1); -EXIT: - free(g_writeBuf); - g_writeBuf = NULL; - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure052(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure052", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_053.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_053.cpp deleted file mode 100644 index dc77792c..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_053.cpp +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static CHAR *g_writeBuf = NULL; -static CHAR* g_readBuf[3] = {}; - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len, taskId; - INT32 fd = -1; - INT64 total = 0; - INT64 perTime; - INT64 totalSize = 0; - INT64 totalTime = 0; - INT32 cycleCount = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - UINT32 writeSize = JFFS_PRESSURE_W_R_SIZE1; - UINT32 readSize = JFFS_PRESSURE_W_R_SIZE1; - DOUBLE testSpeed; - CHAR *pid = NULL; - struct timeval testTime1; - struct timeval testTime2; - time_t tTime; - struct tm *pstTM = NULL; - INT32 testNum = 4 * 1024; // 4 * 1024: test number - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - (void)memset_s(g_jffsPathname4, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname4, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname4, - (INT32)(INTPTR)arg); - - (void)snprintf_s(g_jffsPathname4, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "testfile#%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname4, 0, 0, 0); - - taskId = strlen(pathname1); - pid = pathname1 + taskId - 1; - taskId = atoi(pid); - - gettimeofday(&testTime1, 0); - - fd = open(pathname1, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - if (fd < 0) { - dprintf("\n Task_%d fail to open %s,\n", taskId, pathname1); - goto EXIT1; - } - - LosTaskDelay(5); // delay time: 5 - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - dprintf("\n TaskID:%3d,open %s,task %lld ms,\n", taskId, pathname1, perTime / MSECS_PER_SEC); - - gettimeofday(&testTime1, 0); - - while (1) { - len = write(fd, g_writeBuf, writeSize); - if (len <= 0) { - if (g_TestCnt < testNum) { - dprintf("\n TaskID:%3d, The biggest file size is smaller than the 4GB", taskId); - goto EXIT1; - } - dprintf("\n TaskID:%3d, The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB", taskId, g_TestCnt, - g_TestCnt, g_TestCnt / BYTES_PER_MBYTE); - - break; - } - - g_TestCnt++; - - total += len; - totalSize += len; - if (total >= JFFS_WR_CAP_SIZE_TEST) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - dprintf("TaskID:%3d, %d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", taskId, - cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - dprintf("\n TaskID:%3d,total write=%lld, time=%lld,arv speed =%0.3lfMB/s,\n", taskId, totalSize, totalTime, - testSpeed); - - gettimeofday(&testTime1, 0); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - dprintf("\n TaskID:%3d,sucess to fclose the %s,task:%lld ms,\n", taskId, pathname1, perTime / MSECS_PER_SEC); - - gettimeofday(&testTime1, 0); - - fd = open(pathname1, O_RDWR, S_IRUSR | S_IWUSR); - if (fd < 0) { - dprintf("Task_%d fail to open %s,\n", taskId, pathname1); - goto EXIT1; - } - - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - dprintf(" fix_Read TaskID:%3d,open %s, task:%lld ms,\n", taskId, pathname1, perTime / MSECS_PER_SEC); - - gettimeofday(&testTime1, 0); - - while (1) { - ret = read(fd, g_readBuf[(INT32)(INTPTR)arg], readSize); - if (ret < 0) { - dprintf("ret = %d,%s read fail!-->(X),\n", ret, pathname1); - goto EXIT1; - } - if (!ret) { - dprintf("warning: read ret = %d, errno=:%d\n", ret, errno); - goto EXIT1; - } - total += ret; - totalSize += ret; - - if (total >= JFFS_WR_CAP_SIZE_TEST) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - dprintf("fix_Read TaskID:%3d,times %d, read %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", taskId, - cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - dprintf("\n fix_Read TaskID:%3d,total read=%lld, time=%lld,arv speed =%0.3lfMB/s,\n", taskId, totalSize, totalTime, - testSpeed); - - gettimeofday(&testTime1, 0); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - dprintf("fix_Read TaskID:%3d, fclose %s!,task:%lld ms,\n", taskId, pathname1, perTime / MSECS_PER_SEC); - - return NULL; - -EXIT1: - close(fd); - remove(pathname1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i, j; - pthread_t threadId[JFFS_THREAD_NUM_TEST]; - pthread_attr_t attr; - UINT32 writeSize = JFFS_PRESSURE_W_R_SIZE1; - UINT32 readSize = JFFS_PRESSURE_W_R_SIZE1; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 priority = 4; - - g_TestCnt = 0; - - g_writeBuf = (CHAR *)malloc(writeSize + 1); - ICUNIT_GOTO_NOT_EQUAL(g_writeBuf, NULL, g_writeBuf, EXIT0); - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - g_readBuf[i] = (CHAR *)malloc(readSize + 1); - ICUNIT_GOTO_NOT_EQUAL(g_readBuf[i], NULL, g_readBuf[i], EXIT0); - } - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - while (g_TestCnt < JFFS_THREAD_NUM_TEST * 2) { // thread cnts: JFFS_THREAD_NUM_TEST * 2 - sleep(1); - } - - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - pthread_join(threadId[i], NULL); - } -EXIT: - pthread_attr_destroy(&attr); -EXIT0: - free(g_writeBuf); - g_writeBuf = NULL; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - free(g_readBuf[i]); - g_readBuf[i] = NULL; - } - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure053(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure053", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_301.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_301.cpp deleted file mode 100644 index ebf38ac6..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_301.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - INT32 n = 103; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - (void)strcat_s(buffile, sizeof(buffile), "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - while (n--) { - len = write(fd, "0123456789012345678901234567890123456789", 40); // write length: 40 - ICUNIT_GOTO_EQUAL(len, 40, len, EXIT3); - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.st_blocks, buf2.st_blocks, buf1.st_blocks, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mode, buf2.st_mode, buf1.st_mode, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure301(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure301", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_302.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_302.cpp deleted file mode 100644 index 9143b96d..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_302.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - INT32 n = 256; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - (void)strcat_s(buffile, sizeof(buffile), "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - while (n--) { - len = write(fd, "01234567890123456789012345", 16); // write length: 16 - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT3); - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure302(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure302", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_303.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_303.cpp deleted file mode 100644 index ad550ba3..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_303.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd = -1; - INT32 i = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_MIDDLE_ARRAY_LENGTH][JFFS_STANDARD_NAME_LENGTH] = {JFFS_PATH_NAME0}; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - DIR *dir = NULL; - DIR *dir1[JFFS_MIDDLE_ARRAY_LENGTH] = {NULL}; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - for (i = 0; i < JFFS_MIDDLE_ARRAY_LENGTH; i++) { - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - (void)memset_s(pathname2[i], JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - JffsStrcat2(pathname2[i], bufname, strlen(bufname)); - - ret = mkdir(pathname2[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < JFFS_MIDDLE_ARRAY_LENGTH; i++) { - dir1[i] = opendir(pathname2[i]); - ICUNIT_GOTO_NOT_EQUAL(dir1[i], NULL, dir1[i], EXIT3); - } - - for (i = 0; i < JFFS_MIDDLE_ARRAY_LENGTH; i++) { - ret = closedir(dir1[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (i = 0; i < JFFS_MIDDLE_ARRAY_LENGTH; i++) { - ret = remove(pathname2[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - for (i = 0; i < JFFS_MIDDLE_ARRAY_LENGTH; i++) { - closedir(dir1[i]); - } -EXIT2: - for (i = 0; i < JFFS_MIDDLE_ARRAY_LENGTH; i++) { - remove(pathname2[i]); - } -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure303(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure303", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_304.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_304.cpp deleted file mode 100644 index 3c8a4e03..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_304.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *argument) -{ - INT32 len; - INT32 n = 1000; - - g_TestCnt++; - while (n--) { - len = write(g_jffsFd, - "1234567890123456789012345678901234567890abcdefghjk12345678901234567890123456789012345678901234567890123456" - "7890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - 200); // write length: 200 - ICUNIT_GOTO_EQUAL(len, 200, len, EXIT); - if (g_TestCnt == 2) { // test number: 2 - break; - } - } - g_TestCnt++; - - return (void *)0; - -EXIT: - g_TestCnt = 0; - return (void *)0; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - pthread_t newTh; - pthread_attr_t attr; - CHAR readbuf[201] = {0}; - off_t off; - INT32 priority = 4; - INT32 testNum = 2; - - g_TestCnt = 0; - g_jffsFd = open(pathname, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd, -1, g_jffsFd, EXIT1); - - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh, &attr, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - while (g_TestCnt < testNum) { - LosTaskDelay(1); // delay time: 1 - } - g_TestCnt++; - - off = lseek(g_jffsFd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT2); - - len = read(g_jffsFd, readbuf, 200); // read length: 200 - ICUNIT_GOTO_EQUAL(len, 200, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, - "1234567890123456789012345678901234567890abcdefghjk123456789012345678901234567890123456789012345678901234567890" - "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - readbuf, EXIT2); - - ICUNIT_GOTO_EQUAL(g_TestCnt, 3, g_TestCnt, EXIT2); // 3: test num - - ret = PosixPthreadDestroy(&attr, newTh); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(g_jffsFd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - PosixPthreadDestroy(&attr, newTh); -EXIT1: - close(g_jffsFd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure304(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure304", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_305.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_305.cpp deleted file mode 100644 index a6370e2c..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_305.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd = -1; - INT32 i = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1[JFFS_MIDDLE_ARRAY_LENGTH] = {NULL}; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - while (i < JFFS_MIDDLE_ARRAY_LENGTH) { - dir1[i] = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir1[i], NULL, dir1[i], EXIT1); - - i++; - } - for (i = 0; i < JFFS_MIDDLE_ARRAY_LENGTH; i++) { - ret = closedir(dir1[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - return JFFS_NO_ERROR; -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return JFFS_NO_ERROR; -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure305(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure305", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_306.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_306.cpp deleted file mode 100644 index 1b5a2a7c..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_306.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, i, j; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - CHAR pathname1[300] = { JFFS_PATH_NAME0 }; - CHAR bufname[10] = ""; - CHAR pathname2[10][300] = {0}; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)memset_s(bufname, sizeof(bufname), 0, strlen(bufname)); - (void)snprintf_s(bufname, sizeof(bufname), sizeof(bufname) - 1, "/test_%d", i); - (void)strcat_s(pathname1, sizeof(pathname1), bufname); - (void)strcpy_s(pathname2[i], sizeof(pathname2[i]), pathname1); - - ret = mkdir(pathname2[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH - 1; i++) { - ret = rmdir(pathname2[i]); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - } - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = rmdir(pathname2[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - rmdir(pathname2[i]); - } -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure306(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure306", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_307.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_307.cpp deleted file mode 100644 index b9bcde07..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_307.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd[JFFS_NAME_LIMITTED_SIZE] = { 0 }; - INT32 i = 0; - INT32 fileCount = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE][JFFS_STANDARD_NAME_LENGTH] = {JFFS_PATH_NAME0}; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - DIR *dir = NULL; - struct inode *node = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - errno = 0; - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - (void)memset_s(pathname2[i], JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - JffsStrcat2(pathname2[i], bufname, strlen(bufname)); - - // system has 512 fd,when start testsuits_app,has open 11 file, - // so current usersapce only has 500 file counts,and its value is dynamic - // when it failed,please adapt it. - if (fileCount == 500) { // max file counts: 500 - fd[i] = open(pathname2[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd[i], -1, fd[i], EXIT3); - ICUNIT_GOTO_EQUAL(errno, EMFILE, errno, EXIT3); - break; - } - fd[i] = open(pathname2[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT3); - fileCount = i; - } - - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - if (i > fileCount) { - ret = close(fd[i]); - printf("[%d] close: fd:%d, errno:%d,ret:%d,i:%d,\n", __LINE__, fd[i], errno, ret, i); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT3); - break; - } - ret = close(fd[i]); - printf("[%d] close: fd:%d, errno:%d,ret:%d,i:%d\n", __LINE__, fd[i], errno, ret, i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - if (i > fileCount) { - errno = 0; - ret = remove(pathname2[i]); - printf("[%d] remove: %s, errno:%d,i:%d\n", __LINE__, pathname2[i], errno, i); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT2); - break; - } - - ret = remove(pathname2[i]); - printf("[%d] remove: %s, errno:%d,i:%d\n", __LINE__, pathname2[i], errno, i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - close(fd[i]); - } -EXIT2: - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - remove(pathname2[i]); - } -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure307(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure307", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_308.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_308.cpp deleted file mode 100644 index fa26686f..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_308.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 fd1 = -1; - INT32 i = 0; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT1); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_NUM_TEST; i++) { - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT1); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - close(fd1); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure308(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure308", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_309.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_309.cpp deleted file mode 100644 index e116cedc..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_309.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd[10]; - INT32 i = 0; - INT32 len = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[10][JFFS_STANDARD_NAME_LENGTH] = {JFFS_PATH_NAME0}; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - INT32 randTest1[10] = {2, 6, 3, 1, 0, 8, 7, 9, 4, 5}; - INT32 randTest2[10] = {5, 3, 1, 6, 7, 2, 4, 9, 0, 8}; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - (void)memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - (void)memset_s(pathname2[i], JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1071_%d", i); - (void)strcat_s(pathname2[i], JFFS_STANDARD_NAME_LENGTH, pathname1); - (void)strcat_s(pathname2[i], JFFS_STANDARD_NAME_LENGTH, bufname); - fd[i] = open(pathname2[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - } - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - len = write(fd[randTest1[i]], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - ret = close(fd[randTest1[i]]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - fd[randTest2[i]] = open(pathname2[randTest2[i]], O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - - len = read(fd[randTest2[i]], readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - ret = close(fd[randTest2[i]]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = remove(pathname2[randTest2[i]]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[randTest1[i]]); - } -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - remove(pathname2[randTest2[i]]); - } -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure309(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure309", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_310.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_310.cpp deleted file mode 100644 index df0c7953..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_310.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - INT32 scandirCount = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = "/jf"; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = "/jf/test"; - CHAR pathname6[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)memset_s(pathname2, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(pathname3, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)strcat_s(pathname6, JFFS_NAME_LIMITTED_SIZE, "/"); - // PATH_MAX test. The dirname has occupied 14 bytes. - while (i < 241) { // loop times: 241 - i++; - (void)strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, "t"); - (void)strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, "t"); - (void)strcat_s(pathname6, JFFS_NAME_LIMITTED_SIZE, "t"); - } - ICUNIT_GOTO_EQUAL(strlen(pathname6), 255, strlen(pathname6), EXIT); // pathname length: 255 - ICUNIT_GOTO_EQUAL(strlen(pathname2), 241, strlen(pathname2), EXIT); // pathname length: 241 - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mkdir(pathname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT1); - - (void)strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, "t"); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT2); - - (void)strcat_s(pathname6, JFFS_NAME_LIMITTED_SIZE, "t"); - ICUNIT_GOTO_EQUAL(strlen(pathname6), 256, strlen(pathname6), EXIT); // pathname length: 256 - ret = mkdir(pathname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT2); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - errno = 0; - ret = mkdir(pathname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, pathname4, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - ret = mkdir(pathname5, HIGHEST_AUTHORITY); - printf("[%d] errno:%d\n", __LINE__, errno); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - - ret = chdir(pathname5); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = access(pathname2, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - scandirCount = scandir(pathname5, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 2, scandirCount, EXIT5); // dir number: 2 - - JffsScandirFree(namelist, scandirCount); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - scandirCount = scandir(pathname1, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 2, scandirCount, EXIT5); // dir number: 2 - - JffsScandirFree(namelist, scandirCount); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT4); - - ret = rmdir(pathname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT4); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mkdir(pathname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, pathname4, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mkdir(pathname5, HIGHEST_AUTHORITY); - printf("[%d] errno:%d\n", __LINE__, errno); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - - ret = chdir(pathname5); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT5: - JffsScandirFree(namelist, scandirCount); -EXIT4: - umount(pathname4); - remove(pathname4); -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT2: - remove(pathname3); - remove(pathname6); -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure310(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure310", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_311.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_311.cpp deleted file mode 100644 index 06993eda..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_311.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - INT32 fd = -1; - INT32 scandirCount = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_MAIN_DIR0 }; - CHAR pathname4[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR pathname5[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR pathname6[JFFS_STANDARD_NAME_LENGTH] = "/jf"; - CHAR pathname7[JFFS_STANDARD_NAME_LENGTH] = "/jf"; - - struct dirent **namelist = NULL; - - ret = chdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)memset_s(pathname4, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)memset_s(pathname5, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - (void)strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, "/"); - - // PATH_MAX test. The dirname has occupied 9 bytes. - while (i < 246) { // loop times: 246 - i++; - (void)strcat_s(pathname4, JFFS_NAME_LIMITTED_SIZE, "t"); - (void)strcat_s(pathname5, JFFS_NAME_LIMITTED_SIZE, "t"); - (void)strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, "t"); - } - ICUNIT_GOTO_EQUAL(strlen(pathname3), 255, strlen(pathname3), EXIT); // pathname length: 255 - ICUNIT_GOTO_EQUAL(strlen(pathname4), 246, strlen(pathname4), EXIT); // pathname length: 246 - - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT2); - - (void)strcat_s(pathname5, JFFS_NAME_LIMITTED_SIZE, "t"); - fd = open(pathname5, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT2); - - (void)strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, "t"); - ICUNIT_GOTO_EQUAL(strlen(pathname3), 256, strlen(pathname3), EXIT); // pathname length: 256 - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = mkdir(pathname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, pathname6, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = access(pathname4, F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - fd = open(pathname5, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT4); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - scandirCount = scandir(pathname7, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 2, scandirCount, EXIT5); // dir number: 2 - - JffsScandirFree(namelist, scandirCount); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - scandirCount = scandir(pathname1, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 2, scandirCount, EXIT5); // dir number: 2 - - JffsScandirFree(namelist, scandirCount); - - ret = remove(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mkdir(pathname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, pathname6, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname5); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - return JFFS_NO_ERROR; -EXIT5: - JffsScandirFree(namelist, scandirCount); -EXIT4: - umount(pathname6); - remove(pathname6); -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT2: - close(fd); - remove(pathname5); - remove(pathname3); -EXIT1: - close(fd); - remove(pathname4); -EXIT: - close(fd); - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure311(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure311", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_312.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_312.cpp deleted file mode 100644 index de2fa18a..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_312.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 i = 0; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "/"); - - while (i < 280) { // loop times: 280 - (void)strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "t"); - i++; - } - ICUNIT_GOTO_EQUAL(strlen(pathname1), 294, strlen(pathname1), EXIT); // pathname length: 294 - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure312(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure312", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_313.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_313.cpp deleted file mode 100644 index dc280078..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_313.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 i = 0; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "/test"); - while (i < 280) { // loop times: 280 - i++; - (void)strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "t"); - } - - dir = opendir(pathname1); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT2); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - dir = opendir(pathname1); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - closedir(dir); -EXIT1: - rmdir(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure313(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure313", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_314.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_314.cpp deleted file mode 100644 index e5dcfcf4..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_314.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *writebuf = NULL; - CHAR *readbuf = NULL; - off_t off; - INT32 bufLen = 65536; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - writebuf = (CHAR *)malloc(bufLen + 1); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT2); - (void)memset_s(writebuf, bufLen + 1, 0, bufLen + 1); - - for (i = 0; i < bufLen / strlen(filebuf); i++) { - (void)strcat_s(writebuf, bufLen + 1, filebuf); - } - writebuf[bufLen - 1] = '\0'; - - readbuf = (CHAR *)malloc(bufLen + 1); - ICUNIT_GOTO_NOT_EQUAL(readbuf, NULL, readbuf, EXIT3); - (void)memset_s(readbuf, bufLen + 1, 0, bufLen + 1); - - len = write(fd, writebuf, bufLen - 1); - ICUNIT_GOTO_EQUAL(len, bufLen - 1, len, EXIT4); - - (void)memset_s(readbuf, bufLen + 1, 0, bufLen + 1); - len = pread(fd, readbuf, bufLen - 1, 0); - ICUNIT_GOTO_EQUAL(len, bufLen - 1, len, EXIT4); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, bufLen - 1, off, EXIT4); - - free(readbuf); - free(writebuf); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT4: - free(readbuf); -EXIT3: - free(writebuf); -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure314(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure314", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_315.cpp b/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_315.cpp deleted file mode 100644 index 68f4039e..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_fs_jffs_pressure_315.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *writebuf = NULL; - CHAR *readbuf = NULL; - off_t off; - INT32 testLen = 0xffff; - INT32 bufLen = testLen + 1; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - writebuf = (CHAR *)malloc(bufLen + 1); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT2); - (void)memset_s(writebuf, bufLen + 1, 0, bufLen + 1); - - for (i = 0; i < bufLen / strlen(filebuf); i++) { - (void)strcat_s(writebuf, bufLen + 1, filebuf); - } - writebuf[bufLen - 1] = '\0'; - - readbuf = (CHAR *)malloc(bufLen); - ICUNIT_GOTO_NOT_EQUAL(readbuf, NULL, readbuf, EXIT3); - (void)memset_s(readbuf, bufLen, 0, bufLen); - - len = pwrite(fd, writebuf, testLen, 0); - ICUNIT_GOTO_EQUAL(len, testLen, len, EXIT4); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT4); - - (void)memset_s(readbuf, bufLen, 0, bufLen); - len = read(fd, readbuf, testLen); - ICUNIT_GOTO_EQUAL(len, testLen, len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT4); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, testLen, off, EXIT4); - - free(readbuf); - free(writebuf); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT4: - free(readbuf); -EXIT3: - free(writebuf); -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure315(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure315", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_001.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_001.cpp deleted file mode 100644 index 62bc4d76..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_001.cpp +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[70] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - off_t off; - struct stat statfile; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, 0); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - (void)memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - (void)memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - (void)strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - (void)strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - (void)strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/001.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - ret = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (i + 1)), off, EXIT2); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF01 is excecuting\n"); - } - - off = lseek(fd, 64, SEEK_SET); // file position: 64 - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); - - len = read(fd, readbuf, 64); // read length: 64 - ICUNIT_GOTO_EQUAL(len, 64, len, EXIT2); - - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // 3 * 1024 * 1024: filesize - ICUNIT_GOTO_EQUAL(statfile.st_size, 3 * 1024 * 1024, statfile.st_size, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - free(bufW); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - return NULL; -EXIT3: - free(bufW1); -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[70] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - off_t off; - struct stat statfile; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, 0); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - (void)memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - (void)memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - (void)strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - (void)strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - (void)strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/002.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - ret = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (i + 1)), off, EXIT2); - - LosTaskDelay(10); // delay time: 10 - dprintf("PthreadF02 is excecuting\n"); - } - - off = lseek(fd, 64, SEEK_SET); // file position: 64 - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); - - len = read(fd, readbuf, 64); // read length: 64 - ICUNIT_GOTO_EQUAL(len, 64, len, EXIT2); - - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // 3 * 1024 * 1024: filesize - ICUNIT_GOTO_EQUAL(statfile.st_size, 3 * 1024 * 1024, statfile.st_size, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - free(bufW); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - - return NULL; -EXIT3: - free(bufW1); -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[70] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - off_t off; - struct stat statfile; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, 0); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - (void)memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - (void)memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - (void)strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - (void)strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - (void)strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/003.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - ret = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (i + 1)), off, EXIT2); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF03 is excecuting\n"); - } - - off = lseek(fd, 64, SEEK_SET); // seek offset: 64 - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); - - len = read(fd, readbuf, 64); // read length: 64 - ICUNIT_GOTO_EQUAL(len, 64, len, EXIT2); - - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // 3 * 1024 * 1024: filesize - ICUNIT_GOTO_EQUAL(statfile.st_size, 3 * 1024 * 1024, statfile.st_size, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - free(bufW); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - - return NULL; -EXIT3: - free(bufW1); -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } - rmdir(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread001(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread001", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_002.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_002.cpp deleted file mode 100644 index 2515eccc..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_002.cpp +++ /dev/null @@ -1,480 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - INT32 jffsMaxCycles = 1; // 1 means 1 * 1024 * 1024 byte size - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[70] = "liteos"; - CHAR writebuf[70] = "lite"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - off_t off; - struct stat statfile; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, 0); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - (void)memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - (void)memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - (void)strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - (void)strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - (void)strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/004.txt"); // /storage/test/004.txt - fd1 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, JFFS_IS_ERROR, fd1, EXIT2); - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/001.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - for (i = 0; i < jffsMaxCycles; i++) { - ret = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (i + 1)), off, EXIT2); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF01 is excecuting\n"); - } - - off = lseek(fd, 64, SEEK_SET); // seek offset: 64 - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); - - len = read(fd, readbuf, 64); // read length: 64 - ICUNIT_GOTO_EQUAL(len, 64, len, EXIT2); - - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // 1 * 1024 * 1024: filesize - ICUNIT_GOTO_EQUAL(statfile.st_size, 1 * 1024 * 1024, statfile.st_size, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - free(bufW); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - - return NULL; -EXIT3: - free(bufW1); -EXIT2: - close(fd); - close(fd1); -EXIT1: - unlink(pathname1); - unlink(pathname2); -EXIT: - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - INT32 jffsMaxCycles = 1; // 1 means 1 * 1024 * 1024 byte size - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[70] = "liteos"; - CHAR writebuf[70] = "lite"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - off_t off; - struct stat statfile; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, 0); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - (void)memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - (void)memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - (void)strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - (void)strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - (void)strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/005.txt"); - fd1 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, JFFS_IS_ERROR, fd1, EXIT2); - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/002.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - for (i = 0; i < jffsMaxCycles; i++) { - ret = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (i + 1)), off, EXIT2); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF02 is excecuting\n"); - } - - off = lseek(fd, 64, SEEK_SET); // seek offset: 64 - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); - - len = read(fd, readbuf, 64); // read length: 64 - ICUNIT_GOTO_EQUAL(len, 64, len, EXIT2); - - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // 1 * 1024 * 1024: filesize - ICUNIT_GOTO_EQUAL(statfile.st_size, 1 * 1024 * 1024, statfile.st_size, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - free(bufW); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - - return NULL; -EXIT3: - free(bufW1); -EXIT2: - close(fd); - close(fd1); -EXIT1: - unlink(pathname1); - unlink(pathname2); -EXIT: - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - INT32 jffsMaxCycles = 1; // 1 means 1 * 1024 * 1024 byte size - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[70] = "liteos"; - CHAR writebuf[70] = "lite"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - off_t off; - struct stat statfile; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, 0); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - (void)memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - (void)memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - (void)strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - (void)strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - (void)strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/006.txt"); - fd1 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, JFFS_IS_ERROR, fd1, EXIT2); - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/003.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - for (i = 0; i < jffsMaxCycles; i++) { - ret = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (i + 1)), off, EXIT2); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - } - - off = lseek(fd, 64, SEEK_SET); // seek offset: 64 - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); - - len = read(fd, readbuf, 64); // read length: 64 - ICUNIT_GOTO_EQUAL(len, 64, len, EXIT2); - - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // 1 * 1024 * 1024: filesize - ICUNIT_GOTO_EQUAL(statfile.st_size, 1 * 1024 * 1024, statfile.st_size, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - free(bufW); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - - return NULL; -EXIT3: - free(bufW1); -EXIT2: - close(fd); - close(fd1); -EXIT1: - unlink(pathname1); - unlink(pathname2); -EXIT: - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } - rmdir(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread002(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread002", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_003.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_003.cpp deleted file mode 100644 index ec2ba323..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_003.cpp +++ /dev/null @@ -1,541 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index, index1; - INT32 fd[JFFS_MIDDLE_CYCLES] = {}; - INT32 fd1[JFFS_MIDDLE_CYCLES] = {}; - INT32 flag = 0; - INT32 readLen = 10; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd1[index1], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = lseek(fd1[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - len = read(fd1[index1], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(1); // delay time: 1 - dprintf("PthreadF01 is excecuting\n"); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; - -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, index, index1; - INT32 fd[JFFS_MIDDLE_CYCLES] = {}; - INT32 fd1[JFFS_MIDDLE_CYCLES] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd1[index1], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = lseek(fd1[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - len = read(fd1[index1], readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; - -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index, index1; - INT32 fd[JFFS_MIDDLE_CYCLES] = {}; - INT32 fd1[JFFS_MIDDLE_CYCLES] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd1[index1], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = lseek(fd1[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - len = read(fd1[index1], readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(1); // delay time: 1 - dprintf("PthreadF03 is excecuting\n"); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; - -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread003(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread003", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_004.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_004.cpp deleted file mode 100644 index a7ecd9a9..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_004.cpp +++ /dev/null @@ -1,504 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd[JFFS_MIDDLE_CYCLES] = {}; - INT32 fd1[JFFS_MIDDLE_CYCLES] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file_%d.txt", - index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - - len = write(fd1[index1], writebuf, strlen(writebuf)); - - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - - index1++; - } - - if (flag == 0) { - index1--; - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF01 is excecuting\n"); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file_%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file_%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd[JFFS_MIDDLE_CYCLES] = {}; - INT32 fd1[JFFS_MIDDLE_CYCLES] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file_%d.txt", - index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - - len = write(fd1[index1], writebuf, strlen(writebuf)); - - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - - index1++; - } - - if (flag == 0) { - index1--; - } - - LosTaskDelay(10); // delay time: 10 - dprintf("PthreadF02 is excecuting\n"); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file_%d.txt", - i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file_%d.txt", - i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd[JFFS_MIDDLE_CYCLES] = {}; - INT32 fd1[JFFS_MIDDLE_CYCLES] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file_%d.txt", - index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - - len = write(fd1[index1], writebuf, strlen(writebuf)); - - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - - index1++; - } - - if (flag == 0) { - index1--; - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is excecuting\n"); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file_%d.txt", - i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file_%d.txt", - i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread004(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread004", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_005.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_005.cpp deleted file mode 100644 index c84c4194..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_005.cpp +++ /dev/null @@ -1,325 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file0.txt"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - for (j = 0; j < 20; j++) { // loop times: 20 - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - len = read(fd, readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1.txt"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - for (j = 0; j < 20; j++) { // loop times: 20 - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - len = read(fd, readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file2.txt"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - for (j = 0; j < 20; j++) { // loop times: 20 - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - len = read(fd, readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread005(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread005", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_006.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_006.cpp deleted file mode 100644 index 6cc5abb4..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_006.cpp +++ /dev/null @@ -1,615 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - CHAR *bufW3 = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - index = 0; - for (i = 0; i < JFFS_CREATFILE_NUM; i++) { - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 5; j++) { // loop times: 5 - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - bufW3 = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW3, NULL, NULL); - (void)memset_s(bufW3, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW3, bufWLen + 1, filebuf); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index1], bufW3, strlen(bufW3)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF01 is excecuting\n"); - - ret = lseek(fd[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - len = read(fd[index1], readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - free(bufW3); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", i); - unlink(pathname); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname1); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - CHAR *bufW3 = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - index = 0; - for (i = 0; i < JFFS_CREATFILE_NUM; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 5; j++) { // loop times: 5 - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - bufW3 = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW3, NULL, NULL); - (void)memset_s(bufW3, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW3, bufWLen + 1, filebuf); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index1], bufW3, strlen(bufW3)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = lseek(fd[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - len = read(fd[index1], readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - free(bufW3); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - CHAR *bufW3 = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME02 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - index = 0; - for (i = 0; i < JFFS_CREATFILE_NUM; i++) { - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 5; j++) { // loop times: 5 - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - bufW3 = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW3, NULL, NULL); - (void)memset_s(bufW3, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW3, bufWLen + 1, filebuf); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index1], bufW3, strlen(bufW3)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - len = read(fd[index1], readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - free(bufW3); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname); - } - - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread006(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread006", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_007.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_007.cpp deleted file mode 100644 index 396043a4..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_007.cpp +++ /dev/null @@ -1,569 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index, index1; - INT32 fd[20] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = "/storage/test"; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = "/storage/test/test00"; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = JFFS_MIDDLE_CYCLES; - for (i = JFFS_MIDDLE_CYCLES; i < JFFS_MIDDLE_NUM; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index1], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; - -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, index, index1; - INT32 fd[20] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = JFFS_MIDDLE_CYCLES; - for (i = JFFS_MIDDLE_CYCLES; i < JFFS_MIDDLE_NUM; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index1], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; - -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index, index1; - INT32 fd[20] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = "/storage/test2"; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = "/storage/test2/test22"; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = JFFS_MIDDLE_CYCLES; - for (i = JFFS_MIDDLE_CYCLES; i < JFFS_MIDDLE_NUM; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index1], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; - -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread007(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread007", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_008.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_008.cpp deleted file mode 100644 index bb0d37c9..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_008.cpp +++ /dev/null @@ -1,553 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[20] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1111"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - free(bufW); - index1 = JFFS_MIDDLE_CYCLES; - for (i = JFFS_MIDDLE_CYCLES; i < JFFS_MIDDLE_NUM; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - len = write(fd[index1], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - if (len <= 0) { - flag = 1; - break; - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[20] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1111"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - free(bufW); - index1 = JFFS_MIDDLE_CYCLES; - for (i = JFFS_MIDDLE_CYCLES; i < JFFS_MIDDLE_NUM; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - len = write(fd[index1], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[20] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1111"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - free(bufW); - index1 = JFFS_MIDDLE_CYCLES; - for (i = JFFS_MIDDLE_CYCLES; i < JFFS_MIDDLE_NUM; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - len = write(fd[index1], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i = 1; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread008(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread008", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_009.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_009.cpp deleted file mode 100644 index 7502e2a8..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_009.cpp +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT2: - free(bufW); -EXIT1: - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT2: - free(bufW); -EXIT1: - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - CHAR *bufW3 = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME02 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT3: - free(bufW1); -EXIT2: - free(bufW); -EXIT1: - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread009(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread009", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_010.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_010.cpp deleted file mode 100644 index 9e11aa5d..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_010.cpp +++ /dev/null @@ -1,556 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 20; j++) { // loop times: 20 - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = JFFS_MIDDLE_CYCLES; - for (i = index1; i < index1 + JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - len = write(fd[index1], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_MBYTE, len, EXIT1); - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; - -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", i); - unlink(pathname1); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 20; j++) { // loop times: 20 - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = JFFS_MIDDLE_CYCLES; - for (i = index1; i < index1 + JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - len = write(fd[index1], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_MBYTE, len, EXIT1); - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; - -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", i); - unlink(pathname1); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME02 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 20; j++) { // loop times: 20 - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = JFFS_MIDDLE_CYCLES; - for (i = index1; i < index1 + JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - len = write(fd[index1], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_MBYTE, len, EXIT1); - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname); - } - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", i); - unlink(pathname1); - } - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread010(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread010", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_011.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_011.cpp deleted file mode 100644 index ba6398ac..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_011.cpp +++ /dev/null @@ -1,663 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - struct stat statbuf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd1, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile2, &statbuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf2); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/ttest%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/ttest%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/ttest%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ret = rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ret = rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - struct stat statbuf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(statbuf); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd1, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile2, &statbuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf2); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/ttest%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/ttest%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/ttest%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME02 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - struct stat statbuf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(statbuf); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd1, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &statbuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf2); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/ttest%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/ttest%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/ttest%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread011(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread011", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_012.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_012.cpp deleted file mode 100644 index afe885bc..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_012.cpp +++ /dev/null @@ -1,634 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/ttest%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/ttest%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/ttest%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ret = rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ret = rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // 4 - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/ttest%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/ttest%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME02 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/ttest%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/ttest%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread012(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread012", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_013.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_013.cpp deleted file mode 100644 index 0cbb4e8d..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_013.cpp +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME02 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = "/storage/test2/test22"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread013(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread013", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_014.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_014.cpp deleted file mode 100644 index 6a768f28..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_014.cpp +++ /dev/null @@ -1,618 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" -static INT32 g_testNum = 2; - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = 512 * BYTES_PER_KBYTE; // 512 KB - - flag = 0; - bufW = (CHAR *)malloc(BYTES_PER_MBYTE + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < g_testNum; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - len = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < g_testNum; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/ttest%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/ttest%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/ttest%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = 512 * BYTES_PER_KBYTE; // 512 KB - - flag = 0; - bufW = (CHAR *)malloc(BYTES_PER_MBYTE + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < g_testNum; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - len = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT1); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < g_testNum; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/ttest%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/ttest%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/ttest%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME02 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = 512 * BYTES_PER_KBYTE; // 512 KB - - flag = 0; - bufW = (CHAR *)malloc(BYTES_PER_MBYTE + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < g_testNum; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - len = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT1); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < g_testNum; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/ttest%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/ttest%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/ttest%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread014(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread014", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_015.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_015.cpp deleted file mode 100644 index 7bd63abc..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_015.cpp +++ /dev/null @@ -1,668 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 4 * BYTES_PER_KBYTE; // 4 KB - - flag = 0; - bufW = (CHAR *)malloc(BYTES_PER_MBYTE + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01-0 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/test%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - dprintf("mkdir filed f01\n"); - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd1, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - dprintf("PthreadF01-1 is excecuting\n"); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/test_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/test_%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/test%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/test_%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 4 * BYTES_PER_KBYTE; // 4 KB - - flag = 0; - bufW = (CHAR *)malloc(BYTES_PER_MBYTE + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(2); // delay time: 2 - dprintf("PthreadF02-0 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/test%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - for (j = 0; j < 10; j++) { // loop times: 10 - len = write(fd1, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - dprintf("PthreadF02-1 is excecuting\n"); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/test_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/test_%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/test%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/test_%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 4 * BYTES_PER_KBYTE; // 4 KB - - flag = 0; - bufW = (CHAR *)malloc(BYTES_PER_MBYTE + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03-0 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/test%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd1, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - dprintf("PthreadF03-1 is excecuting\n"); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/test_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/test_%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/test%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/test_%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread015(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread015", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_016.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_016.cpp deleted file mode 100644 index 7776e198..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_016.cpp +++ /dev/null @@ -1,649 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 16 * BYTES_PER_KBYTE; // 16 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/tttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/tttest_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/tttest_%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/tttest%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/tttest_%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dirbuf[100] = {NULL}; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = 16 * BYTES_PER_KBYTE; // 16 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/tttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/tttest_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/tttest_%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/tttest%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/tttest_%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ret = rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ret = rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dirbuf[100] = {NULL}; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = 16 * BYTES_PER_KBYTE; // 16 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/tttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/tttest_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/tttest_%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/tttest%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/tttest_%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ret = rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ret = rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread016(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread016", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_017.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_017.cpp deleted file mode 100644 index 7b837d7f..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_017.cpp +++ /dev/null @@ -1,450 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dirbuf[100] = {NULL}; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = 128 * BYTES_PER_KBYTE; // 128 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dirbuf[100] = {NULL}; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = 128 * BYTES_PER_KBYTE; // 128 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/testdir%d", - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/testdir_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/testdir_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/testdir%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/testdir_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dirbuf[100] = {NULL}; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = 128 * BYTES_PER_KBYTE; // 128 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test1%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test01_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test01_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test1%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test01_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread017(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread017", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_018.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_018.cpp deleted file mode 100644 index 117d8fad..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_018.cpp +++ /dev/null @@ -1,650 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/tttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/tttest_%d", index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/tttest_%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/tttest%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/tttest_%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/tttest%d", index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/tttest_%d", index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/tttest_%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/tttest%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/tttest_%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/tttest%d", index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/tttest_%d", index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/tttest_%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/tttest%d", - i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/tttest_%d", i); - (void)strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread018(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread018", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_019.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_019.cpp deleted file mode 100644 index a7bef32c..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_019.cpp +++ /dev/null @@ -1,449 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: // fd[0] - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: // fd[1] - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF01 is excecuting\n"); - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test0/file2%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: // fd[0] - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - break; - case 1: // fd[1] - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test0/file2%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test0/file2%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test0/test1/file3%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: // fd[0] - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: // fd[1] - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is excecuting\n"); - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test0/test1/file3_%d.txt", index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test0/test1/file3_%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test0/test1/file3_%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - (void)strcat_s(bufname2, JFFS_STANDARD_NAME_LENGTH, "/test0"); - (void)strcat_s(bufname3, JFFS_STANDARD_NAME_LENGTH, "/test0/test1"); - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(1); // delay time: 1 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread019(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread019", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_020.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_020.cpp deleted file mode 100644 index d3eb98ea..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_020.cpp +++ /dev/null @@ -1,443 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: // fd[0] - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - break; - case 1: // fd[1] - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file2%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: // fd[0] - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: // fd[1] - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is excecuting\n"); - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file2%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file2%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file3%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: // fd[0] - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: // fd[1] - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is excecuting\n"); - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file3_%d.txt", - index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file3_%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file3_%d.txt", - i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(3); // delay time: 3 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread020(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread020", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_021.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_021.cpp deleted file mode 100644 index e7d4f14a..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_021.cpp +++ /dev/null @@ -1,424 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF01 is excecuting\n"); - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file1%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file1%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file2%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is excecuting\n"); - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file2%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file2%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file3%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file3_%d.txt", - index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file3_%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file3_%d.txt", - i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread021(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread021", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_022.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_022.cpp deleted file mode 100644 index 0f3a19fb..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_022.cpp +++ /dev/null @@ -1,465 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file2%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file2%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file2%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file3%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file3_%d.txt", index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file3_%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file3_%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread022(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread022", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_023.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_023.cpp deleted file mode 100644 index dcc0bc5e..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_023.cpp +++ /dev/null @@ -1,465 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file1%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file1%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file1%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file2%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is excecuting\n"); - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file2%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file2%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file3%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF03 is excecuting\n"); - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file3_%d.txt", index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file3_%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file3_%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread023(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread023", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_024.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_024.cpp deleted file mode 100644 index 2b4d1e01..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_024.cpp +++ /dev/null @@ -1,427 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF01 is excecuting\n"); - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file2%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is excecuting\n"); - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file2%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file2%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file3%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file3_%d.txt", - index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file3_%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file3_%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(1); // delay time: 1 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread024(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread024", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_025.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_025.cpp deleted file mode 100644 index c0fea670..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_025.cpp +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 fd = -1; - INT32 ret, len, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - len = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT1); - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = lseek(fd, -10, SEEK_CUR); // seek offset: -10 - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - len = read(fd, readbuf, strlen(writebuf)); // read length: 10 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - free(bufW); - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 fd = -1; - INT32 ret, len, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - len = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT1); - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = lseek(fd, -10, SEEK_CUR); // seek offset: -10 - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - len = read(fd, readbuf, strlen(writebuf)); // read length: 10 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - free(bufW); - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 fd = -1; - INT32 ret, len, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - len = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT1); - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = lseek(fd, -10, SEEK_CUR); // seek offset: -10 - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - len = read(fd, readbuf, strlen(writebuf)); // read length: 10 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - free(bufW); - g_TestCnt = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - LosTaskDelay(1); // delay time: 1 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - return JFFS_NO_ERROR; - -EXIT: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread025(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread025", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_026.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_026.cpp deleted file mode 100644 index 3cc809e2..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_026.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 fd = -1; - INT32 ret, len; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - struct stat statbuf; - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/p01.txt"); - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - len = read(fd, readbuf, strlen(writebuf)); // read length: 10 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 fd = -1; - INT32 ret, len; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - struct stat statbuf; - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/p02.txt"); - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF02 is executing\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - len = read(fd, readbuf, strlen(writebuf)); // read length: 10 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 fd = -1; - INT32 ret, len; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - struct stat statbuf; - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/p03.txt"); - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF03 is executing\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - len = read(fd, readbuf, strlen(writebuf)); // read length: 10 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_TestCnt = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(1); // delay time: 1 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread026(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread026", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_027.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_027.cpp deleted file mode 100644 index c3c45930..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_027.cpp +++ /dev/null @@ -1,384 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME02, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME02, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME02, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread027(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread027", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_028.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_028.cpp deleted file mode 100644 index bd22a705..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_028.cpp +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, ret, len, index, flag; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - - flag = 0; - - for (index = 0; index < JFFS_MIDDLE_CYCLES; index++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, ret, len, index, flag; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - - flag = 0; - - for (index = 0; index < JFFS_MIDDLE_CYCLES; index++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, ret, len, index, flag; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - - flag = 0; - - for (index = 0; index < JFFS_MIDDLE_CYCLES; index++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread028(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread028", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_029.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_029.cpp deleted file mode 100644 index d453fe33..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_029.cpp +++ /dev/null @@ -1,385 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread029(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread029", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_030.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_030.cpp deleted file mode 100644 index 4fb176bc..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_030.cpp +++ /dev/null @@ -1,373 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME02, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME02, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME02, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread030(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread030", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_031.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_031.cpp deleted file mode 100644 index 72e407d9..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_031.cpp +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, ret, len; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "abcd"; - CHAR *bufW = NULL; - struct stat statbuf; - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - fd[i] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], JFFS_IS_ERROR, fd[i], EXIT); - - len = write(fd[i], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - } - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - close(fd[i]); - } -EXIT: - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, ret, len; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "abcd"; - CHAR *bufW = NULL; - struct stat statbuf; - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - fd[i] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], JFFS_IS_ERROR, fd[i], EXIT); - - len = write(fd[i], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - } - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - close(fd[i]); - } -EXIT: - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, ret, len; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "abcd"; - CHAR *bufW = NULL; - struct stat statbuf; - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, i); - fd[i] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], JFFS_IS_ERROR, fd[i], EXIT); - - len = write(fd[i], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - } - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - close(fd[i]); - } -EXIT: - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread031(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread031", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_032.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_032.cpp deleted file mode 100644 index 582f4018..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_032.cpp +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread032(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread032", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_033.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_033.cpp deleted file mode 100644 index 1e386270..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_033.cpp +++ /dev/null @@ -1,427 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dir = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME0, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME0, i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME0, i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dir = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME01, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME01, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME01, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dir = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME02, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME02, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME02, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread033(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread033", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_034.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_034.cpp deleted file mode 100644 index b4579bc9..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_034.cpp +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, fd, offset; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - DIR *dir = NULL; - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1%d", JFFS_PATH_NAME0, - i); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - } - - for (j = i - 1; j >= 0; j--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1%d", JFFS_PATH_NAME0, - j); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - closedir(dir); -EXIT: - for (j = i - 1; j >= 0; j--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1%d", JFFS_PATH_NAME0, - j); - rmdir(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, fd, offset; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - DIR *dir = NULL; - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2%d", JFFS_PATH_NAME0, - i); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - } - - for (j = i - 1; j >= 0; j--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2%d", JFFS_PATH_NAME0, - j); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - closedir(dir); -EXIT: - for (j = i - 1; j >= 0; j--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2%d", JFFS_PATH_NAME0, - j); - rmdir(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, fd, offset; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - DIR *dir = NULL; - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3%d", JFFS_PATH_NAME0, - i); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - } - - for (j = i - 1; j >= 0; j--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3%d", JFFS_PATH_NAME0, - j); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - closedir(dir); -EXIT: - for (j = i - 1; j >= 0; j--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3%d", JFFS_PATH_NAME0, - j); - rmdir(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread034(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread034", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_035.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_035.cpp deleted file mode 100644 index 036f6b99..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_035.cpp +++ /dev/null @@ -1,430 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dir = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME0, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME0, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME0, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dir = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME_0, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME_0, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME_0, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dir = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME_01, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME_01, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME_01, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread035(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread035", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_036.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_036.cpp deleted file mode 100644 index c28bfb93..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_036.cpp +++ /dev/null @@ -1,429 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME0, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME0, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME0, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME0, i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME0, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME01, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME01, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME01, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME01, i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME01, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME02, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME02, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME02, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME02, i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME02, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread036(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread036", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_037.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_037.cpp deleted file mode 100644 index 7d974a85..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_037.cpp +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, fd; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - DIR *dir = NULL; - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1%d", JFFS_PATH_NAME0, - i); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1_%d", JFFS_PATH_NAME0, - i); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - } - - for (j = i - 1; j >= 0; j--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1_%d", JFFS_PATH_NAME0, - j); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; - -EXIT1: - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1%d", JFFS_PATH_NAME0, i); - rmdir(pathname); -EXIT: - for (j = i - 1; j >= 0; j--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1_%d", JFFS_PATH_NAME0, - j); - rmdir(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, fd; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - DIR *dir = NULL; - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2%d", JFFS_PATH_NAME0, - i); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2_%d", JFFS_PATH_NAME0, - i); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - } - - for (j = i - 1; j >= 0; j--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2_%d", JFFS_PATH_NAME0, - j); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; - -EXIT1: - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2%d", JFFS_PATH_NAME0, i); - rmdir(pathname); -EXIT: - for (j = i - 1; j >= 0; j--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2_%d", JFFS_PATH_NAME0, - j); - rmdir(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, fd; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - DIR *dir = NULL; - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3%d", JFFS_PATH_NAME0, - i); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3_%d", JFFS_PATH_NAME0, - i); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - } - - for (j = i - 1; j >= 0; j--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3_%d", JFFS_PATH_NAME0, - j); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; - -EXIT1: - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3%d", JFFS_PATH_NAME0, i); - rmdir(pathname); -EXIT: - for (j = i - 1; j >= 0; j--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3_%d", JFFS_PATH_NAME0, - j); - rmdir(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread037(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread037", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_038.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_038.cpp deleted file mode 100644 index 2faaac90..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_038.cpp +++ /dev/null @@ -1,432 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1%d", JFFS_PATH_NAME0, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1_%d", JFFS_PATH_NAME0, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1_%d", JFFS_PATH_NAME0, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1%d", JFFS_PATH_NAME0, i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1_%d", JFFS_PATH_NAME0, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2%d", JFFS_PATH_NAME_0, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2_%d", JFFS_PATH_NAME_0, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2_%d", JFFS_PATH_NAME_0, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2%d", JFFS_PATH_NAME_0, i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2_%d", JFFS_PATH_NAME_0, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3%d", JFFS_PATH_NAME_01, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3_%d", - JFFS_PATH_NAME_01, index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3_%d", JFFS_PATH_NAME_01, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3%d", JFFS_PATH_NAME_01, i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3_%d", JFFS_PATH_NAME_01, - i); - (void)strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread038(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread038", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_039.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_039.cpp deleted file mode 100644 index b3559aca..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_039.cpp +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread039(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread039", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_040.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_040.cpp deleted file mode 100644 index 91cb85f1..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_040.cpp +++ /dev/null @@ -1,453 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME02, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread040(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread040", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_041.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_041.cpp deleted file mode 100644 index 9b6f9410..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_041.cpp +++ /dev/null @@ -1,452 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread041(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread041", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_042.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_042.cpp deleted file mode 100644 index 0dab7de6..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_042.cpp +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME02, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(6); // delay time: 6 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread042(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread042", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_043.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_043.cpp deleted file mode 100644 index 533261f5..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_043.cpp +++ /dev/null @@ -1,442 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(6); // delay time: 6 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread043(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread043", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_044.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_044.cpp deleted file mode 100644 index 8fdeda45..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_044.cpp +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(6); // delay time: 6 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread044(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MULTIPTHREAD_044", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_045.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_045.cpp deleted file mode 100644 index 5b46b75b..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_045.cpp +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME02, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(3); // delay time: 3 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread045(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread045", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_046.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_046.cpp deleted file mode 100644 index a5b258d6..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_046.cpp +++ /dev/null @@ -1,442 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(6); // delay time: 6 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread046(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread046", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_047.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_047.cpp deleted file mode 100644 index 1d90ae1a..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_047.cpp +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(3); // delay time: 3 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread047(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread047", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_048.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_048.cpp deleted file mode 100644 index a151ac39..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_048.cpp +++ /dev/null @@ -1,453 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME02, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread048(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread048", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_049.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_049.cpp deleted file mode 100644 index 7f4c5e7c..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_049.cpp +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread049(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread049", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_050.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_050.cpp deleted file mode 100644 index 13aeef36..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_050.cpp +++ /dev/null @@ -1,452 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - INT32 readLen = 10; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - (void)memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - (void)strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread050(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread050", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_051.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_051.cpp deleted file mode 100644 index 820181d9..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_051.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static VOID *MutiJffs05101(void *arg) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_051_01 2 \n"); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = - JffsMultiWrite(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsMultiRead(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - unlink(pathname); - - dprintf(" end muti_jffs_051_01 2 \n"); - - return NULL; -EXIT: - - unlink(pathname); - - g_TestCnt = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - INT32 priority = 20; - INT32 testNum = 3; - - g_TestCnt = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], MutiJffs05101, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], MutiJffs05101, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], MutiJffs05101, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - while (g_TestCnt < testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } - -EXIT: - rmdir(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread051(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread051", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_052.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_052.cpp deleted file mode 100644 index e6b88015..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_052.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs05201(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - dprintf(" start muti_jffs_052_01 1 \n"); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_52"); - - ret = JffsMultiRead(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 52_01 \n"); - } - - dprintf(" end muti_jffs_052_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - - return NULL; -} - -static VOID *MutiJffs05202(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - dprintf(" start muti_jffs_052_02 1 \n"); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_52"); - - // file size: 1024, write size: 1024 - ret = JffsMultiWrite(pathname, 1024, 1024, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - // file size: 1024, read size: 1 - ret = JffsMultiRead(pathname, 1024, 1, O_RDWR, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 52_02 \n"); - } - - dprintf(" end muti_jffs_052_02 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_52"); - ret = - JffsMultiWrite(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs05201, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs05202, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread052(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread052", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_053.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_053.cpp deleted file mode 100644 index e3791e83..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_053.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs05301(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_053_01 1 \n"); - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_53"); - ret = JffsMultiRead(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 53_01 \n"); - } - - dprintf(" end muti_jffs_053_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs05302(void *arg) -{ - INT32 ret, i; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - - dprintf(" start muti_jffs_053_02 1 \n"); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_53"); - - fd = open(pathname, O_RDONLY, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 53_02 \n"); - } - - dprintf(" end muti_jffs_053_02 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_53"); - ret = - JffsMultiWrite(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs05301, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs05302, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread053(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread053", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_054.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_054.cpp deleted file mode 100644 index cf85cb6b..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_054.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs05401(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_054_01 1 \n"); - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_54"); - ret = JffsMultiRead(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDONLY, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 54_01 \n"); - } - - dprintf(" end muti_jffs_054_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs05402(void *arg) -{ - INT32 ret, i, len; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - - dprintf(" start muti_jffs_054_02 1 \n"); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_54"); - - fd = open(pathname, O_WRONLY | O_CREAT, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 54_02 \n"); - } - - dprintf(" end muti_jffs_054_02 2 \n"); - - return NULL; - -EXIT1: - close(fd); - -EXIT: - - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_54"); - ret = - JffsMultiWrite(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs05401, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs05402, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread054(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread054", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_055.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_055.cpp deleted file mode 100644 index 01727cc0..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_055.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs05501(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_055_01 1 \n"); - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_55"); - ret = JffsMultiRead(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDONLY, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 55_01 \n"); - } - - dprintf(" end muti_jffs_055_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs05502(void *arg) -{ - INT32 ret, i; - INT32 fd = -1; - struct stat buf1 = { 0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_055_02 1 \n"); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_55"); - fd = open(pathname, O_WRONLY | O_CREAT, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 55_02 \n"); - } - - dprintf(" end muti_jffs_055_02 2 \n"); - - return NULL; - -EXIT1: - close(fd); - -EXIT: - - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_55"); - ret = - JffsMultiWrite(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs05501, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs05502, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread055(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread055", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_056.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_056.cpp deleted file mode 100644 index bf618f89..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_056.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs05601(void *arg) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_056_01 1 \n"); - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_56"); - - ret = JffsMultiRead(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDONLY, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 56_01 \n"); - } - - dprintf(" end muti_jffs_056_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs05602(void *arg) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - dprintf(" start muti_jffs_056_02 1 \n"); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_56"); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test_56_rename"); - - rename(pathname, pathname1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 56_02 \n"); - } - - dprintf(" end muti_jffs_056_02 2 \n"); - - return NULL; - -EXIT: - - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_56"); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test_56_rename"); - ret = - JffsMultiWrite(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs05601, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs05602, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - unlink(pathname); - unlink(pathname1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); - unlink(pathname1); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread056(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread056", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_057.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_057.cpp deleted file mode 100644 index 19c47c30..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_057.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs05701(void *arg) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_057_01 1 \n"); - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_57"); - - ret = JffsMultiRead(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDONLY, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 57_01 \n"); - } - - dprintf(" end muti_jffs_057_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs05702(void *arg) -{ - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - dprintf(" start muti_jffs_057_02 1 \n"); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_57"); - - umount(pathname); - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 57_02 \n"); - } - - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - - dprintf(" end muti_jffs_057_02 2 \n"); - - return NULL; - -EXIT: - - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_57"); - ret = - JffsMultiWrite(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs05701, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs05702, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread057(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread057", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_058.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_058.cpp deleted file mode 100644 index dc39448e..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_058.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs05801(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_058_01 1 \n"); - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_58"); - - // file size: 1024, write size: 16 - ret = JffsMultiWrite(pathname, 1024, 16, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 58_01 \n"); - } - - dprintf(" end muti_jffs_058_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs05802(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_058_02 1 \n"); - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_58"); - - // file size: 1024, write size: 16 - ret = JffsMultiWrite(pathname, 1024, 16, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - // file size: 1024, read size: 1 - ret = JffsMultiRead(pathname, 1024, 1, O_RDWR, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 58_02 \n"); - } - - dprintf(" end muti_jffs_058_02 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_58"); - // file size: 1024, write size: 10 - ret = JffsMultiWrite(pathname, 1024, 10, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs05801, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs05802, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread058(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread058", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_059.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_059.cpp deleted file mode 100644 index b0b6ad2d..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_059.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs05901(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_059_01 1 \n"); - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_59"); - - // file size: 1024, write size: 16 - ret = JffsMultiWrite(pathname, 1024, 16, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 59_01 \n"); - } - - dprintf(" end muti_jffs_059_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs05902(void *arg) -{ - INT32 ret, i, len; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - - dprintf(" start muti_jffs_059_02 1 \n"); - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_59"); - - fd = open(pathname, O_WRONLY | O_CREAT, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 59_02 \n"); - } - - dprintf(" end muti_jffs_059_02 2 \n"); - - return NULL; - -EXIT1: - close(fd); - -EXIT: - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_59"); - // file size: 1024, write size: 10 - ret = JffsMultiWrite(pathname, 1024, 10, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs05901, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs05902, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread059(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread059", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_060.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_060.cpp deleted file mode 100644 index f3b4b2be..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_060.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs06001(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_060_01 1 \n"); - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_60"); - - // file size: 1024, write size: 16 - ret = JffsMultiWrite(pathname, 1024, 16, O_WRONLY | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 60_01 \n"); - } - - dprintf(" end muti_jffs_060_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs06002(void *arg) -{ - INT32 ret, i, len; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - - dprintf(" start muti_jffs_060_02 1 \n"); - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_60"); - - fd = open(pathname, O_RDONLY | O_CREAT, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 60_02 \n"); - } - - dprintf(" end muti_jffs_060_02 2 \n"); - - return NULL; - -EXIT1: - close(fd); - -EXIT: - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_60"); - // file size: 1024, write size: 10 - ret = JffsMultiWrite(pathname, 1024, 10, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs06001, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs06002, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread060(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread060", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_061.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_061.cpp deleted file mode 100644 index 3efbca8a..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_061.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs06101(void *arg) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_061_01 1 \n"); - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_61"); - - // file size: 1024, write size: 16 - ret = JffsMultiWrite(pathname, 1024, 16, O_WRONLY | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 61_01 \n"); - } - - dprintf(" end muti_jffs_061_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs06102(void *arg) -{ - INT32 ret, i; - INT32 fd = -1; - struct stat buf1 = { 0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - dprintf(" start muti_jffs_061_02 1 \n"); - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_61"); - - fd = open(pathname, O_RDONLY | O_CREAT, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 61_02 \n"); - } - - dprintf(" end muti_jffs_061_02 2 \n"); - - return NULL; - -EXIT1: - close(fd); - -EXIT: - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_61"); - // file size: 1024, write size: 10 - ret = JffsMultiWrite(pathname, 1024, 10, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs06101, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs06102, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread061(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread061", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_062.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_062.cpp deleted file mode 100644 index 437efaaa..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_062.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs06201(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_062_01 1 \n"); - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_62"); - - // file size: 1024, write size: 16 - ret = JffsMultiWrite(pathname, 1024, 16, O_WRONLY | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 62_01 \n"); - } - - dprintf(" end muti_jffs_062_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs06202(void *arg) -{ - INT32 ret, i; - INT32 fd = -1; - struct stat buf1 = { 0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - dprintf(" start muti_jffs_062_02 1 \n"); - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_62"); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test_62_rename"); - - rename(pathname, pathname1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 62_02 \n"); - } - - dprintf(" end muti_jffs_062_02 2 \n"); - - return NULL; - -EXIT: - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_62"); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test_62_rename"); - // file size: 1024, write size: 10 - ret = JffsMultiWrite(pathname, 1024, 10, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs06201, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs06202, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - unlink(pathname); - unlink(pathname1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); - unlink(pathname1); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread062(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread062", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_063.cpp b/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_063.cpp deleted file mode 100644 index 37e51f30..00000000 --- a/testsuites/unittest/fs/jffs/pressure/It_vfs_jffs_multipthread_063.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs06301(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_063_01 1 \n"); - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_63"); - - // file size: 1024, write size: 16 - ret = JffsMultiWrite(pathname, 1024, 16, O_WRONLY | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 63_01 \n"); - } - - dprintf(" end muti_jffs_063_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs06302(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - dprintf(" start muti_jffs_063_02 1 \n"); - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_63"); - - umount(pathname); - - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 63_02 \n"); - } - - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - - dprintf(" end muti_jffs_063_02 2 \n"); - - return NULL; - -EXIT: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_63"); - // file size: 1024, write size: 10 - ret = JffsMultiWrite(pathname, 1024, 10, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs06301, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs06302, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread063(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread063", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_001.cpp b/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_001.cpp deleted file mode 100644 index da785908..00000000 --- a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_001.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - INT32 len = 0; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off = 0; - - fd = open(pathname, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - len = read(fd, readbuf, 50); // read length: 50 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - len = read(fd, readbuf, 50); // read length: 50 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, JFFS_IS_ERROR, off, EXIT1); - - len = read(fd, readbuf, 50); // read length: 50 - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = unlink(pathname); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs001(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_001", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_002.cpp b/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_002.cpp deleted file mode 100644 index 8649f86e..00000000 --- a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_002.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 ret; - INT32 offset; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr; - - g_TestCnt = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname, "/0test"); - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "1test", ptr->d_name, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT4); - - return JFFS_NO_ERROR; -EXIT4: - closedir(dir); - goto EXIT; -EXIT3: - closedir(dir); -EXIT2: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs002(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_002", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_003.cpp b/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_003.cpp deleted file mode 100644 index 6f26ec84..00000000 --- a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_003.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd, ret; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr; - INT32 offset; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname, "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT5); - - offset = telldir(dir); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "2test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - offset = telldir(dir); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - offset = telldir(dir); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "1test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - offset = telldir(dir); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - -EXIT5: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); -EXIT4: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT3: - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs003(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_003", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_005.cpp b/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_005.cpp deleted file mode 100644 index 13fb0665..00000000 --- a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_005.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd, fd1, fd2, ret; - CHAR pathname[30] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr; - INT32 offset, offset1, offset2, offset3, offset4; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname, "/test0"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/file1", sizeof(pathname)); - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/file0", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - JffsStrcat2(pathname, "/test2", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname, "/file2", sizeof(pathname)); - fd2 = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT5); - - JffsStrcat2(pathname, "/test1", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT7); - - offset1 = 0; - ptr = readdir(dir); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "file0", ptr->d_name, EXIT7); - - offset2 = ptr->d_off; - ptr = readdir(dir); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "file1", ptr->d_name, EXIT7); - - offset3 = ptr->d_off; - ptr = readdir(dir); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "file2", ptr->d_name, EXIT7); - - offset4 = ptr->d_off; - ptr = readdir(dir); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "test0", ptr->d_name, EXIT7); - - seekdir(dir, offset2); - rewinddir(dir); - offset = telldir(dir); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT7); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "file0", ptr->d_name, EXIT7); - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT7); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT7); - - seekdir(dir, offset1); - rewinddir(dir); - offset = telldir(dir); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT7); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "file0", ptr->d_name, EXIT7); - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT7); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT7); - - seekdir(dir, offset4); - rewinddir(dir); - offset = telldir(dir); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT7); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "file0", ptr->d_name, EXIT7); - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT7); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT7); - - seekdir(dir, offset3); - rewinddir(dir); - offset = telldir(dir); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT7); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "file0", ptr->d_name, EXIT7); - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT7); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT7); - -EXIT7: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT7); -EXIT6: - JffsStrcat2(pathname, "/test1", sizeof(pathname)); - rmdir(pathname); -EXIT5: - JffsStrcat2(pathname, "/file2", sizeof(pathname)); - close(fd2); - remove(pathname); -EXIT4: - JffsStrcat2(pathname, "/test2", sizeof(pathname)); - rmdir(pathname); -EXIT3: - JffsStrcat2(pathname, "/file0", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT2: - JffsStrcat2(pathname, "/file1", sizeof(pathname)); - close(fd1); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/test0", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs005(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_005", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_021.cpp b/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_021.cpp deleted file mode 100644 index 70bf2183..00000000 --- a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_021.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd1, fd2, ret; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR bufdir1[30] = { JFFS_PATH_NAME0 }; - CHAR bufdir2[30] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname1, "/dir1"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat(pathname2, "/dir2"); - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - strcat(bufdir2, "/dir2/dirfile2"); - ret = mkdir(bufdir2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - strcat(bufdir1, "/dir1/dirfile1"); - ret = mkdir(bufdir1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = rename(bufdir1, bufdir2); // dirfile1卤盲鲁脡dirfile2拢卢dirfile2禄谩卤禄脡戮鲁媒 - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = rmdir(bufdir1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT4); - - ret = rmdir(bufdir2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT4: - JffsStrcat2(bufdir1, "/dir1/dirfile1", strlen(pathname1)); - remove(pathname1); -EXIT3: - JffsStrcat2(bufdir2, "/dir2/dirfile2", strlen(pathname1)); - remove(pathname1); -EXIT2: - JffsStrcat2(pathname1, "/dir2", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir1", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs021(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_021", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_022.cpp b/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_022.cpp deleted file mode 100644 index a7992f38..00000000 --- a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_022.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd1, fd2, ret, len; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR buffile1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile2[50] = { JFFS_PATH_NAME0 }; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[20] = {0}; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname1, "/dir1"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat(pathname2, "/dir2"); - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - strcat(buffile1, "/dir1/file1"); - fd1 = open(buffile1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT6); - - strcat(buffile2, "/dir2/file2"); - fd2 = open(buffile2, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - off = lseek(fd2, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT8); - - len = read(fd2, readbuf, 20); // read length: 20 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT8); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT8); // file position: 20 - - len = read(fd1, readbuf, 20); // read length: 20 - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT8); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT8); - - ret = close(fd1); // 脡戮鲁媒鲁脡鹿娄"/dir2/file2" - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT8); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT8); - - ret = rename(buffile1, buffile2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = rmdir(pathname1); // dir1脡戮鲁媒鲁脡鹿娄 - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); - - fd2 = open(buffile2, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - len = read(fd2, readbuf, 20); // read length: 20 - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT4); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = unlink(buffile2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT8: - close(fd2); -EXIT7: - JffsStrcat2(pathname1, "/dir2/file2", strlen(pathname1)); - remove(pathname1); -EXIT6: - close(fd1); -EXIT5: - JffsStrcat2(pathname1, "/dir1/file1", strlen(pathname1)); - remove(pathname1); - goto EXIT2; -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/dir2/file2", strlen(pathname1)); - remove(pathname1); - goto EXIT6; -EXIT2: - JffsStrcat2(pathname1, "/dir2", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir1", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs022(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_022", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_026.cpp b/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_026.cpp deleted file mode 100644 index 5e2dbde6..00000000 --- a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_026.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 ret, fd, len; - off_t off; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - CHAR readbuf[301] = {0}; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - struct statfs buf3 = { 0 }; - struct statfs buf4 = { 0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname1, "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(buffile, "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = statfs(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.f_bavail, buf2.f_bavail, buf1.f_bavail, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.f_bfree, buf2.f_bfree, buf1.f_bfree, EXIT3); - - len = write(fd, - "12345678901234567890123456789012345678901234567890abcdefghjk12345678901234567890123456789012345678901234567890" - "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" - "12345678901234567890123456789012345678901234567890123456789012345678901234567890", - 300); // write length: 300 - ICUNIT_GOTO_EQUAL(len, 300, len, EXIT3); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT3); - - len = read(fd, readbuf, 300); // read length: 300 - ICUNIT_GOTO_EQUAL(len, 300, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, - "12345678901234567890123456789012345678901234567890abcdefghjk12345678901234567890123456789012345678901234567890" - "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" - "12345678901234567890123456789012345678901234567890123456789012345678901234567890", - readbuf, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = statfs(buffile, &buf4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs026(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_026", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_027.cpp b/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_027.cpp deleted file mode 100644 index 816211ef..00000000 --- a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_027.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 ret, fd, len; - off_t off; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - CHAR writebuf[20] = "ABCDEFGHJK"; - CHAR readbuf[20] = {0}; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname1, "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat(buffile, "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT3); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT3); - - len = read(fd, readbuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT3); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf2); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf3); - - ICUNIT_GOTO_EQUAL(buf1.st_size, 10, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf2.st_size, 10, buf2.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf3.st_size, 0, buf3.st_size, EXIT3); - - ICUNIT_GOTO_EQUAL(buf1.st_mode & S_IFMT, S_IFREG, buf1.st_mode & S_IFMT, EXIT3); - ICUNIT_GOTO_EQUAL(buf2.st_mode & S_IFMT, S_IFREG, buf2.st_mode & S_IFMT, EXIT3); - ICUNIT_GOTO_EQUAL(buf3.st_mode & S_IFMT, S_IFDIR, buf3.st_mode & S_IFMT, EXIT3); - - ICUNIT_GOTO_EQUAL(buf1.st_blocks, buf2.st_blocks, buf1.st_blocks, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mode, buf2.st_mode, buf1.st_mode, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - remove(buffile); -EXIT1: - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs027(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_027", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_034.cpp b/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_034.cpp deleted file mode 100644 index 882cba32..00000000 --- a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_034.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 ret, fd, len; - DIR *dir = NULL; - CHAR pathname1[50] = "/storage"; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR readbuf[20] = {0}; - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = umount(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT2); - - ret = mount(JFFS_DEV_PATH0, "/storage", JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - mount(JFFS_DEV_PATH0, "/storage", JFFS_FILESYS_TYPE, 0, NULL); - closedir(dir); - goto EXIT; -EXIT1: - mount(JFFS_DEV_PATH0, "/storage", JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs034(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_034", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_035.cpp b/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_035.cpp deleted file mode 100644 index 09494447..00000000 --- a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_035.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 ret, fd, len; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR readbuf[50] = {0}; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, "01234567890123456789012345", 16); // write length: 16 - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = umount("/jffs2_test"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, "/jffs2_test", JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, "01234567890123456789012345", 16); // write length: 16 - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 20); // read length: 20 - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); // file length: 16 - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = umount("/jffs2_test/test/test123"); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT2); - - ret = umount(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT2); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = mount(NULL, "/jffs2_test", "storage", 0, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT2); - - ret = access("/jffs2_test", F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - mount(JFFS_DEV_PATH0, "/jffs2_test", JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - close(fd); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs035(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_035", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_094.cpp b/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_094.cpp deleted file mode 100644 index 09c9fa55..00000000 --- a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_094.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = ioctl(fd, 0, 0); - ICUNIT_GOTO_EQUAL(ret, -ENOSYS, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs094(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_094", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_095.cpp b/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_095.cpp deleted file mode 100644 index 9fcafaaa..00000000 --- a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_095.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - ret = fsync(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs095(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_095", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_103.cpp b/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_103.cpp deleted file mode 100644 index bab3d04e..00000000 --- a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_103.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ -/* INT32 ret,fd,len; - off_t off; - CHAR pathname1[50] = JFFS_PATH_NAME0; - CHAR pathname2[50]=JFFS_PATH_NAME0; - struct stat64 buf1={0}; - struct stat64 buf2={0}; - struct stat buf3={0}; - CHAR readbuf[20]={0}; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/dir"); - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - strcat(pathname2, "/dir/files"); - fd = open64(pathname2, O_NONBLOCK | O_CREAT | O_RDWR, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); - - len = write(fd, "ABCDEFGHJK", 10); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT3); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, JFFS_IS_ERROR, off, EXIT3); - - len = read(fd,readbuf,10); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "ABCDEFGHJK", readbuf, EXIT3); - - ret = stat64(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - jffs_stat64_printf(buf1); - - ret = fstat64(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - jffs_stat64_printf(buf2); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - jffs_stat_printf(buf3); - - ICUNIT_GOTO_EQUAL(buf1.st_size, 10, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf2.st_size, 10, buf2.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf3.st_size, 0, buf3.st_size, EXIT3); - - ICUNIT_GOTO_EQUAL(buf1.st_mode& S_IFMT, S_IFREG, buf1.st_mode& S_IFMT, EXIT3); - ICUNIT_GOTO_EQUAL(buf2.st_mode& S_IFMT, S_IFREG, buf2.st_mode& S_IFMT, EXIT3); - ICUNIT_GOTO_EQUAL(buf3.st_mode& S_IFMT, S_IFDIR, buf3.st_mode& S_IFMT, EXIT3); - - ICUNIT_GOTO_EQUAL(buf1.st_blocks, buf2.st_blocks, buf1.st_blocks, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mode& S_IFMT, buf2.st_mode& S_IFMT, buf1.st_mode& S_IFMT, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT3); - - ret = close(fd) ; - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname2) ; - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - jffs_strcat2(pathname1, "/dir/files",strlen(pathname1)); - remove(pathname1); -EXIT1: - jffs_strcat2(pathname1, "/dir",strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR;*/ -} - -/* -********** -testcase brief in English -********** -*/ - -VOID IT_FS_JFFS_103(VOID) -{ - - TEST_ADD_CASE("IT_FS_JFFS_103", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); - -} - diff --git a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_535.cpp b/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_535.cpp deleted file mode 100644 index da5aa830..00000000 --- a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_535.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd, len, ret; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890abcde&"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - long off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); - - len = write(fd, "END", 3); // write length: 3 - ICUNIT_GOTO_EQUAL(len, 3, len, EXIT1); - - off = lseek64(fd, JFFS_SHORT_ARRAY_LENGTH, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_SHORT_ARRAY_LENGTH, off, EXIT1); - - len = read(fd, readbuf, 6); // read length: 6 - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcde&", readbuf, EXIT1); - - off = lseek64(fd, 2, SEEK_CUR); // seek offset: 2 - ICUNIT_GOTO_EQUAL(off, 18, off, EXIT1); // file position: 18 - - memset(readbuf, 0, sizeof(readbuf)); - - len = read(fd, readbuf, 5); // read length: 5 - ICUNIT_GOTO_EQUAL(len, 5, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "34567", readbuf, EXIT1); - - off = lseek64(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 23, off, EXIT1); // file position: 23 - - len = read(fd, readbuf, 5); // read length: 5 - ICUNIT_GOTO_EQUAL(len, 5, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "890ab", readbuf, EXIT1); - - off = lseek64(fd, -2, SEEK_CUR); // seek offset: -2 - ICUNIT_GOTO_EQUAL(off, 26, off, EXIT1); // file position: 26 - - len = read(fd, readbuf, 6); // read length: 6 - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcde&", readbuf, EXIT1); - - off = lseek64(fd, -2, SEEK_END); // seek offset: -2 - ICUNIT_GOTO_EQUAL(off, 49, off, EXIT1); // file size: 49 - - memset(readbuf, 0, sizeof(readbuf)); - len = read(fd, readbuf, 5); // read length: 5 - ICUNIT_GOTO_EQUAL(len, 2, len, EXIT1); // file size: 2 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "ND", readbuf, EXIT1); - - off = lseek64(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 51, off, EXIT1); // file size: 51 - - len = read(fd, readbuf, 6); // read length: 6 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - - off = lseek64(fd, 2, SEEK_END); // seek offset: 2 - ICUNIT_GOTO_EQUAL(off, 53, off, EXIT1); // file size: 53 - len = read(fd, readbuf, 6); // read length: 6 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - - len = write(fd, "mmm", 3); // write length: 3 - ICUNIT_GOTO_EQUAL(len, 3, len, EXIT1); - - off = lseek64(fd, -3, SEEK_END); // seek offset: -3 - ICUNIT_GOTO_EQUAL(off, 53, off, EXIT1); // file size:49 - - len = read(fd, readbuf, 5); // read length: 5 - ICUNIT_GOTO_EQUAL(len, 3, len, EXIT1); // file length: 3 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "mmm", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs535(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_535", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_Dac_001.cpp b/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_Dac_001.cpp deleted file mode 100644 index c77fa65d..00000000 --- a/testsuites/unittest/fs/jffs/smoke/It_vfs_jffs_Dac_001.cpp +++ /dev/null @@ -1,528 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -static uid_t g_testUID1 = 111; -static uid_t g_testUID2 = 222; -static char *g_testDIR = "TEST_D"; - -/* umask */ -static int TestUmask(const char *path) -{ - mode_t mode; - int ret; - struct stat buf = { 0 }; - char filename[128] = {0}; - - printf("%s, %d\n", __FUNCTION__, __LINE__); - - mode = umask(0044); // umask: 0044 - ICUNIT_ASSERT_EQUAL(mode, 0022, mode); // mode: 0022 - mode = umask(0022); // umask: 0022 - ICUNIT_ASSERT_EQUAL(mode, 0044, mode); // mode: 0044 - (void)sprintf_s(filename, sizeof(filename), "%s/%s", path, g_testDIR); - ret = mkdir(filename, HIGHEST_AUTHORITY); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = stat(filename, &buf); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(buf.st_mode, 040755, buf.st_mode); - rmdir(filename); - return 0; -} - -/* open */ -static int TestOpen(const char *path) -{ - int ret; - char filename[64] = {0}; - char filename1[64] = {0}; - char filename2[64] = {0}; - char filename3[64] = {0}; - - ret = setuid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setgid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - // uid 111, gid 111,home dir 0 0 757 - - (void)sprintf_s(filename, sizeof(filename), "%s/%s", path, g_testDIR); - ret = mkdir(filename, 0753); // mode: 0753 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - (void)sprintf_s(filename1, sizeof(filename1), "%s/%s", filename, "f1"); - ret = open(filename1, O_CREAT | O_WRONLY, 0755); // mode: 0755 - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - close(ret); - - ret = setuid(g_testUID2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setgid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - // uid 222, gid 111,home dir 111 111 753 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - (void)sprintf_s(filename2, sizeof(filename2), "%s/%s", filename, "f2"); - ret = open(filename2, O_CREAT | O_WRONLY, 0755); // mode: 0755 - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ret = open(filename1, O_WRONLY); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EACCES, errno, errno); - - ret = setgid(g_testUID2); - // uid 222, gid 222,home dir 111 111 753 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - (void)sprintf_s(filename3, sizeof(filename3), "%s/%s", filename, "f3"); - ret = open(filename3, O_CREAT | O_WRONLY, 0755); // mode: 0755 - printf("%s, %d ret %d\n", __FUNCTION__, __LINE__, ret); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - close(ret); - ret = unlink(filename3); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - // file mode 755 - ret = open(filename1, O_WRONLY); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ret = open(filename1, O_RDONLY); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - close(ret); - - ret = setuid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setgid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = unlink(filename1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setuid(0); - ret = setgid(0); - ret = rmdir(filename); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -/* unlink */ -static int TestUnlink(const char *path) -{ - int ret; - char filename[64] = {0}; - char filename1[64] = {0}; - - printf("%s, %d\n", __FUNCTION__, __LINE__); - // uid 0, gid 0, home dir 0 0 757 - (void)sprintf_s(filename, sizeof(filename), "%s/%s", path, g_testDIR); - ret = mkdir(filename, 0757); // mode 757 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - (void)sprintf_s(filename1, sizeof(filename1), "%s/%s", filename, "f1"); - - ret = open(filename1, O_CREAT | O_WRONLY, 0755); // mode: 0755 - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - close(ret); - - ret = setuid(g_testUID2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - // uid 222, gid 0 - ret = unlink(filename1); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ret = setgid(g_testUID2); - // uid 222, gid 222 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = unlink(filename1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = rmdir(filename); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setuid(0); - ret = setgid(0); - - return 0; -} - -/* mkdir */ -/* rmdir */ -static int TestMkdir(const char *path) -{ - int ret; - char filename[64] = {0}; - - printf("%s, %d\n", __FUNCTION__, __LINE__); - // uid 0, gid 0, home dir 0 0 757 - (void)sprintf_s(filename, sizeof(filename), "%s/%s", path, g_testDIR); - ret = mkdir(filename, 0735); // mode 735 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = setuid(g_testUID2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = rmdir(filename); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = setgid(g_testUID2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = rmdir(filename); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = setuid(0); - ret = setgid(0); - - return 0; -} - -/* chmod */ -static int TestChmod(const char *path) -{ - int ret; - struct stat buf = { 0 }; - char filename[64] = {0}; - char filename1[64] = {0}; - - printf("%s, %d\n", __FUNCTION__, __LINE__); - // uid 0, gid 0, home dir 0 0 757 - (void)sprintf_s(filename, sizeof(filename), "%s/%s", path, g_testDIR); - ret = mkdir(filename, 0757); // mode 757 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - (void)sprintf_s(filename1, sizeof(filename1), "%s/%s", filename, "f1"); - - setuid(g_testUID2); - ret = chmod(filename, 0111); // mode: 0111 - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - setuid(0); - ret = chmod(filename, 0111); // mode: 0111 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = stat(filename, &buf); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(buf.st_mode, 040111, buf.st_mode); // mode: 040111 - - ret = rmdir(filename); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setuid(0); - ret = setgid(0); - - return 0; -} - -/* stat chdir */ -static int TestStatChdir(const char *path) -{ - int ret; - struct stat buf = { 0 }; - char filename[64] = {0}; - char filename1[64] = {0}; - - printf("%s, %d\n", __FUNCTION__, __LINE__); - // uid 0, gid 0, home dir 0 0 757 - (void)sprintf_s(filename, sizeof(filename), "%s/%s", path, g_testDIR); - ret = mkdir(filename, 0700); // mode: 0700 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - (void)sprintf_s(filename1, sizeof(filename1)"%s/%s", filename, "f1"); - - ret = mkdir(filename1, 0755); // mode: 0755 - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - ret = setuid(g_testUID2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - // uid 222, gid 0 - ret = chdir(filename); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EACCES, errno, errno); - ret = stat(filename1, &buf); - printf("%s, %d ret %d errno %d\n", __FUNCTION__, __LINE__, ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = setuid(0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - // uid 222, gid 0 - ret = chdir(filename); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = stat(filename1, &buf); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = rmdir(filename1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = rmdir(filename); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setuid(0); - ret = setgid(0); - - return 0; -} - -/* rename */ -static int TestRename(const char *path) -{ - int ret; - char filename[64] = {0}; - char filename1[64] = {0}; - char filename2[64] = {0}; - - ret = setuid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setgid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - // uid 111, gid 111,home dir 0 0 757 - - (void)sprintf_s(filename, sizeof(filename), "%s/%s", path, g_testDIR); - ret = mkdir(filename, 0711); // mode: 0711 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - (void)sprintf_s(filename1, sizeof(filename1), "%s/%s", filename, "f1"); - ret = mkdir(filename1, 0755); // mode: 0755 - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - close(ret); - - (void)sprintf_s(filename2, sizeof(filename2), "%s/%s", filename, "f2"); - ret = rename(filename1, filename2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = setuid(g_testUID2); - // uid 222, gid 222,home dir 111 111 753 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - (void)sprintf_s(filename2, sizeof(filename2), "%s/%s", filename, "f2"); - ret = rename(filename2, filename1); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = setuid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setgid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = rmdir(filename2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setuid(0); - ret = setgid(0); - ret = rmdir(filename); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - - -/* execve */ -/* access */ -static int TestAccess(const char *path) -{ - int ret; - char filename[64] = {0}; - - printf("%s, %d\n", __FUNCTION__, __LINE__); - // uid 0, gid 0, home dir 0 0 757 - (void)sprintf_s(filename, sizeof(filename), "%s/%s", path, g_testDIR); - ret = mkdir(filename, 0757); // mode 757 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = access(filename, F_OK); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = access(filename, R_OK); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = chmod(filename, 0311); // mode: 0311 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = access(filename, R_OK); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ret = access(filename, W_OK); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = chmod(filename, 0111); // mode: 0111 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = access(filename, W_OK); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ret = access(filename, X_OK); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = chmod(filename, 0011); // mode: 0011 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = access(filename, X_OK); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = rmdir(filename); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setuid(0); - ret = setgid(0); - - return 0; -} - -static int SetReadAndSearch() -{ - int capNum = 2; - struct __user_cap_header_struct capheader; - struct __user_cap_data_struct capdata[capNum]; - int ret; - - memset(&capheader, 0, sizeof(struct __user_cap_header_struct)); - memset(capdata, 0, capNum * sizeof(struct __user_cap_data_struct)); - capdata[0].permitted = 0xffffffff; - capdata[1].permitted = 0xffffffff; - capheader.version = _LINUX_CAPABILITY_VERSION_3; - capdata[CAP_TO_INDEX(CAP_SETPCAP)].effective |= CAP_TO_MASK(CAP_SETPCAP); - capdata[CAP_TO_INDEX(CAP_SETUID)].effective |= CAP_TO_MASK(CAP_SETUID); - capdata[CAP_TO_INDEX(CAP_SETGID)].effective |= CAP_TO_MASK(CAP_SETGID); - capdata[CAP_TO_INDEX(CAP_CHOWN)].effective |= CAP_TO_MASK(CAP_CHOWN); - capdata[CAP_TO_INDEX(CAP_DAC_READ_SEARCH)].effective |= CAP_TO_MASK(CAP_DAC_READ_SEARCH); - ret = capset(&capheader, &capdata[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; -} - -static int TestCapReadSearch() -{ - int ret; - char filenameParent[64] = {0}; - char filenameChild[64] = {0}; - - ret = setuid(0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setgid(0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = mkdir("/storage/test_jffs2", 0757); // mode 0757 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - (void)sprintf_s(filenameParent, sizeof(filenameParent), "%s/%s", "/storage/test_jffs2", "testParent"); - (void)sprintf_s(filenameChild, sizeof(filenameChild), "%s/%s", filenameParent, "testChild"); - ret = mkdir(filenameParent, 0222); // mode 0222 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - SetReadAndSearch(); - ret = mkdir(filenameChild, 0777); // mode 0777 - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - ret = rmdir(filenameParent); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = rmdir("/storage/test_jffs2"); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -/* execve */ -/* access */ - -static int TestJffsDac(const char *path) -{ - int ret = TestUmask(path); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - umask(0); - ret = TestOpen(path); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = TestUnlink(path); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = TestMkdir(path); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = TestChmod(path); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = TestStatChdir(path); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = TestRename(path); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = TestAccess(path); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - umask(0022); // umask: 0022 - return 0; -} - -static int ChildFunc(VOID) -{ - int capNum = 2; - struct __user_cap_header_struct capheader; - struct __user_cap_data_struct capdata[capNum]; - int ret; - - memset(&capheader, 0, sizeof(struct __user_cap_header_struct)); - memset(capdata, 0, capNum * sizeof(struct __user_cap_data_struct)); - capdata[0].permitted = 0xffffffff; - capdata[1].permitted = 0xffffffff; - capheader.version = _LINUX_CAPABILITY_VERSION_3; - capdata[CAP_TO_INDEX(CAP_SETPCAP)].effective |= CAP_TO_MASK(CAP_SETPCAP); - capdata[CAP_TO_INDEX(CAP_SETUID)].effective |= CAP_TO_MASK(CAP_SETUID); - capdata[CAP_TO_INDEX(CAP_SETGID)].effective |= CAP_TO_MASK(CAP_SETGID); - capdata[CAP_TO_INDEX(CAP_CHOWN)].effective |= CAP_TO_MASK(CAP_CHOWN); - ret = capset(&capheader, &capdata[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setuid(0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setgid(0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* jffs2 & rootfs test case */ - ret = mkdir("/storage/test_jffs", 0757); // mode 757 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - chmod("/storage/test_jffs", 0757); // mode 757 - ret = TestJffsDac("/storage/test_jffs"); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - rmdir("/storage/test_jffs"); - - ret = setuid(2); // uid: 2 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setgid(2); // gid: 2 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -static int testcase(VOID) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // pid must in range 0 - 100000 - if (pid == 0) { - ret = ChildFunc(); - printf("err line :%d error code: %d\n", 0, 0); - exit(0); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // pid must in range 0 - 100000 - if (pid == 0) { - ret = TestCapReadSearch(); - printf("err line :%d error code: %d\n", 0, 0); - exit(0); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 0, status, EXIT); - - return 0; - -EXIT: - return 1; -} - -void ItTestDac001(void) -{ - TEST_ADD_CASE("IT_SEC_DAC_001", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_005.cpp b/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_005.cpp deleted file mode 100644 index 8f21d415..00000000 --- a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_005.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_fs_jffs.h" - -static int TestCase(void) -{ - FILE *fp = NULL; - char *buf = "hello tmpfile !"; - char rbuf[20] = {0}; - int i = 0; - int ret = -1; - - fp = tmpfile(); - ICUNIT_GOTO_NOT_EQUAL(fp, NULL, fp, EXIT); - - ret = fwrite(buf, strlen(buf), 1, fp); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - - ret = fseek(fp, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = fread(rbuf, strlen(buf), 1, fp); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - - ret = memcmp(buf, rbuf, strlen(buf)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fclose(fp); - return JFFS_NO_ERROR; - -EXIT: - fclose(fp); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs005(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_005", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_008.cpp b/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_008.cpp deleted file mode 100644 index 8c603fbb..00000000 --- a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_008.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_fs_jffs.h" -#include - -#define FILE_PATH "/storage/testlockf.txt" - -/* F_TLOCK銆丗_ULOCK */ -static int TestCase0(void) -{ - int fd = -1; - int ret; - - fd = open(FILE_PATH, O_WRONLY, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - /* lock 0-3 Regions */ - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = lockf(fd, F_TLOCK, 3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - /* unlock 1 Regions */ - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = lseek(fd, 1, SEEK_CUR); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - - ret = lockf(fd, F_ULOCK, 1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - close(fd); - return 0; - -EXIT: - close(fd); - return -1; -} - -/* F_TEST */ -static int TestCase1(void) -{ - int fd = -1; - int ret; - - fd = open(FILE_PATH, O_WRONLY, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - /* lock 0-3 Regions */ - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = lockf(fd, F_LOCK, 3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - /* try lock 1 Region */ - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = lseek(fd, 1, SEEK_CUR); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - - ret = lockf(fd, F_TEST, 1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - /* try lock 3 Region */ - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = lseek(fd, 3, SEEK_CUR); - ICUNIT_GOTO_EQUAL(ret, 3, ret, EXIT); - - ret = lockf(fd, F_TEST, 1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - close(fd); - return 0; - -EXIT: - close(fd); - return -1; -} - -/* F_LOCK */ -static int TestCase2(void) -{ - int fd = -1; - int ret; - - fd = open(FILE_PATH, O_WRONLY, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - /* lock 0-3 Regions */ - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = lockf(fd, F_LOCK, 3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - /* lock 2-5 Region */ - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = lseek(fd, 2, SEEK_CUR); - ICUNIT_GOTO_EQUAL(ret, 2, ret, EXIT); - - ret = lockf(fd, F_LOCK, 3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - close(fd); - return 0; - -EXIT: - close(fd); - return -1; -} - -static int TestCase(void) -{ - int fd = -1; - int ret; - - fd = open(FILE_PATH, O_WRONLY | O_CREAT, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = TestCase0(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = TestCase1(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = TestCase2(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - -EXIT: - close(fd); - unlink(FILE_PATH); -} - -void ItTestFsJffs008(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_008", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_010.cpp b/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_010.cpp deleted file mode 100644 index baf0d2ae..00000000 --- a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_010.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_fs_jffs.h" -#include - -#define RECV_SIGNUM 5U - -#define RTSIG0 (SIGRTMIN + 7) -#define RTSIG1 (SIGRTMIN + 6) -#define ERRSIG (SIGRTMAX + 10) - -static int m_sig[RECV_SIGNUM] = {0}; -static char *m_recvData = NULL; -char m_msg[] = "hello sigqueue"; -static int m_recvCount = 0; - -void Handler(int sig, siginfo_t *info, void *ctx) -{ - m_sig[m_recvCount] = sig; - m_recvData = (char *)info->si_value.sival_ptr; - m_recvCount++; -} - -void SonProcess0(pid_t pid) -{ - union sigval msg; - - msg.sival_ptr = m_msg; - sigqueue(pid, RTSIG1, msg); - sigqueue(pid, RTSIG0, msg); - sigqueue(pid, RTSIG1, msg); - - sleep(3); - exit(0); -} - -static int TestCase0(void) -{ - pid_t pid0 = -1; - pid_t pid1 = -1; - int ret = -1; - struct sigaction act = {0}; - act.sa_sigaction = Handler; - sigemptyset(&act.sa_mask); - act.sa_flags = SA_SIGINFO; - int i = 0; - int expectSig[RECV_SIGNUM] = {RTSIG1, RTSIG0, RTSIG1}; - - ret = sigaction(RTSIG1, &act, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = sigaction(RTSIG0, &act, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - pid1 = getpid(); - pid0 = fork(); - if (pid0 == 0) { - SonProcess0(pid1); - } else { - sleep(2); - for (i = 0; i 0) { - close(dirfd); - } - if (fd > 0) { - close(fd); - } -EXIT: - remove(pathname2); - remove(pathname1); - remove(pathname0); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs104(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_104", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_105.cpp b/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_105.cpp deleted file mode 100644 index 5a874a5f..00000000 --- a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_105.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_fs_jffs.h" - -#define TEST_STRLEN 30 - -static int TestCase(void) -{ - INT32 dirfd = 0; - INT32 fd = 0; - INT32 ret = JFFS_IS_ERROR; - CHAR pathname0[TEST_STRLEN] = JFFS_PATH_NAME0; - CHAR pathname1[TEST_STRLEN] = JFFS_PATH_NAME0; - CHAR pathname2[TEST_STRLEN] = JFFS_PATH_NAME0; - struct stat info = {0}; - - ret = mkdir(pathname0, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, TEST_STRLEN, "/test1"); - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chown(pathname1, 1, 1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - stat(pathname1, &info); - ICUNIT_GOTO_EQUAL((uid_t)info.st_uid, 1, ret, EXIT); - ICUNIT_GOTO_EQUAL((uid_t)info.st_gid, 1, ret, EXIT); - - dirfd = open(pathname0, O_DIRECTORY); - fd = dirfd; - ICUNIT_GOTO_NOT_EQUAL(dirfd, JFFS_IS_ERROR, dirfd, EXIT); - - ret = fchownat(dirfd, "test1", 10, 10, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - stat(pathname1, &info); - ICUNIT_GOTO_EQUAL((uid_t)info.st_uid, 10, ret, EXIT1); - ICUNIT_GOTO_EQUAL((uid_t)info.st_gid, 10, ret, EXIT1); - - ret = close(dirfd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dirfd = open(pathname0, O_DIRECTORY); - ICUNIT_GOTO_NOT_EQUAL(dirfd, JFFS_IS_ERROR, dirfd, EXIT); - - (void)strcat_s(pathname2, TEST_STRLEN, "/test.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = chown(pathname2, 1, 1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - stat(pathname2, &info); - ICUNIT_GOTO_EQUAL((uid_t)info.st_uid, 1, ret, EXIT1); - ICUNIT_GOTO_EQUAL((uid_t)info.st_gid, 1, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = fchownat(dirfd, "test.txt", 10, 10, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - stat(pathname2, &info); - ICUNIT_GOTO_EQUAL((uid_t)info.st_uid, 10, ret, EXIT1); - ICUNIT_GOTO_EQUAL((uid_t)info.st_gid, 10, ret, EXIT1); - - ret = close(dirfd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT1: - if (dirfd > 0) { - close(dirfd); - } - if (fd > 0) { - close(fd); - } -EXIT: - remove(pathname2); - remove(pathname1); - remove(pathname0); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs105(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_105", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_107.cpp b/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_107.cpp deleted file mode 100644 index 40da416a..00000000 --- a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_107.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_fs_jffs.h" - -#define TEST_STR "abcdefghijk" - -static int TestCase(void) -{ - INT32 ret, dirFd, fd, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - DIR *dir = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dirFd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(dirFd, JFFS_IS_ERROR, dirFd, EXIT1); - - fd = openat(dirFd, "test.txt", O_CREAT | O_RDWR | O_TRUNC); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, "01234567890123456789012345", 16); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlinkat(dirFd, "test.txt", 0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); - unlink(pathname1); - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs107(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_107", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_108.cpp b/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_108.cpp deleted file mode 100644 index b8c9c3ad..00000000 --- a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_108.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_fs_jffs.h" - -static int TestCase(void) -{ - INT32 ret = JFFS_IS_ERROR; - INT32 fd = 0; - INT32 dirfd = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - time_t timep; - time_t timep1; - struct tm p; - struct stat fstate; - struct timespec times[2]; - char dateTime[64]; - struct tm t; - - p.tm_sec = 30; - p.tm_min = 27; - p.tm_hour = 16; - p.tm_mday = 18; - p.tm_mon = 0; - p.tm_year = 2020 - 1900; - p.tm_wday = 1; - p.tm_yday = 17; - p.tm_isdst = 0; - - timep = mktime(&p); - - p.tm_min = 28; - p.tm_hour = 17; - timep1 = mktime(&p); - - times[0].tv_sec = timep; - times[0].tv_nsec = 0; - times[1].tv_sec = timep1; - times[1].tv_nsec = 0; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test.txt"); - fd = open(pathname2, O_CREAT | O_RDWR | O_TRUNC); - dirfd = fd; - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - dirfd = open(pathname1, O_DIRECTORY); - ICUNIT_GOTO_NOT_EQUAL(dirfd, JFFS_IS_ERROR, dirfd, EXIT); - - utimensat(dirfd, "test.txt", times, 0); - ret = stat(pathname2, &fstate); - ICUNIT_GOTO_EQUAL(fstate.st_atim.tv_sec, timep, fstate.st_atim.tv_sec, EXIT1); - ICUNIT_GOTO_EQUAL(fstate.st_mtim.tv_sec, timep1, fstate.st_mtim.tv_sec, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = close(dirfd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - if (fd > 0) { - close(fd); - } - if (dirfd > 0) { - close(dirfd); - } - unlink(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs108(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_108", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_109.cpp b/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_109.cpp deleted file mode 100644 index 78e963cb..00000000 --- a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_109.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_fs_jffs.h" - -static int TestCase(void) -{ - INT32 ret = JFFS_IS_ERROR; - INT32 fd = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - time_t timep; - time_t timep1; - struct tm p; - struct stat fstate; - struct timeval times[2]; - char dateTime[64]; - struct tm t; - - p.tm_sec = 30; - p.tm_min = 27; - p.tm_hour = 16; - p.tm_mday = 18; - p.tm_mon = 0; - p.tm_year = 2020 - 1900; - p.tm_wday = 1; - p.tm_yday = 17; - p.tm_isdst = 0; - - timep = mktime(&p); - - p.tm_min = 28; - p.tm_hour = 17; - timep1 = mktime(&p); - - times[0].tv_sec = timep; - times[0].tv_usec = 0; - times[1].tv_sec = timep1; - times[1].tv_usec = 0; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test.txt"); - fd = open(pathname2, O_CREAT | O_RDWR | O_TRUNC); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - utimes(pathname2, times); - ret = stat(pathname2, &fstate); - ICUNIT_GOTO_EQUAL(fstate.st_atim.tv_sec, timep, fstate.st_atim.tv_sec, EXIT1); - ICUNIT_GOTO_EQUAL(fstate.st_mtim.tv_sec, timep1, fstate.st_mtim.tv_sec, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - if (fd > 0) { - close(fd); - } - unlink(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs109(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_109", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_110.cpp b/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_110.cpp deleted file mode 100644 index c7f5ff47..00000000 --- a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_110.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_fs_jffs.h" - -static int TestCase(void) -{ - INT32 ret = JFFS_IS_ERROR; - INT32 fd = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - time_t timep; - time_t timep1; - struct tm p; - struct stat fstate; - struct utimbuf times; - char dateTime[64]; - struct tm t; - - p.tm_sec = 30; - p.tm_min = 27; - p.tm_hour = 16; - p.tm_mday = 18; - p.tm_mon = 0; - p.tm_year = 2020 - 1900; - p.tm_wday = 1; - p.tm_yday = 17; - p.tm_isdst = 0; - - timep = mktime(&p); - - p.tm_min = 28; - p.tm_hour = 17; - timep1 = mktime(&p); - - times.actime = timep; - times.modtime = timep1; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test.txt"); - fd = open(pathname2, O_CREAT | O_RDWR | O_TRUNC); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - utime(pathname2, ×); - ret = stat(pathname2, &fstate); - ICUNIT_GOTO_EQUAL(fstate.st_atim.tv_sec, timep, fstate.st_atim.tv_sec, EXIT1); - ICUNIT_GOTO_EQUAL(fstate.st_mtim.tv_sec, timep1, fstate.st_mtim.tv_sec, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - if (fd > 0) { - close(fd); - } - unlink(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs110(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_110", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_111.cpp b/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_111.cpp deleted file mode 100644 index 242b503a..00000000 --- a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_111.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_fs_jffs.h" - -static int TestCase(void) -{ - INT32 ret = JFFS_IS_ERROR; - INT32 fd = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - time_t timep; - time_t timep1; - struct tm p; - struct stat fstate; - struct timespec times[2]; - struct tm t; - - p.tm_sec = 30; - p.tm_min = 27; - p.tm_hour = 16; - p.tm_mday = 18; - p.tm_mon = 0; - p.tm_year = 2020 - 1900; - p.tm_wday = 1; - p.tm_yday = 17; - p.tm_isdst = 0; - - timep = mktime(&p); - - p.tm_min = 28; - p.tm_hour = 17; - timep1 = mktime(&p); - - times[0].tv_sec = timep; - times[0].tv_nsec = 0; - times[1].tv_sec = timep1; - times[1].tv_nsec = 0; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test.txt"); - fd = open(pathname2, O_CREAT | O_RDWR | O_TRUNC); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - futimens(fd, times); - ret = stat(pathname2, &fstate); - ICUNIT_GOTO_EQUAL(fstate.st_atim.tv_sec, timep, fstate.st_atim.tv_sec, EXIT1); - ICUNIT_GOTO_EQUAL(fstate.st_mtim.tv_sec, timep1, fstate.st_mtim.tv_sec, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - if (fd > 0) { - close(fd); - } - unlink(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs111(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_111", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_201.cpp b/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_201.cpp deleted file mode 100644 index 8a0eec75..00000000 --- a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_201.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_fs_jffs.h" -#include -#include - -#define FILEPATH "./test.txt" - -static int TestCase(void) -{ - int ret = -1; - int fd = -1; - - fd = open(FILEPATH, O_RDWR | O_CREAT, 0777); - ICUNIT_ASSERT_NOT_EQUAL(fd, JFFS_IS_ERROR, fd); - - ret = isastream(fd); - ICUNIT_ASSERT_NOT_EQUAL(ret, JFFS_IS_ERROR, ret); - - ret = close(fd); - ICUNIT_ASSERT_NOT_EQUAL(ret, JFFS_IS_ERROR, ret); - - ret = remove(FILEPATH); - ICUNIT_ASSERT_NOT_EQUAL(ret, JFFS_IS_ERROR, ret); -} - -void ItTestFsJffs201(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_201", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_202.cpp b/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_202.cpp deleted file mode 100644 index 7c1e3d5c..00000000 --- a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_202.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_fs_jffs.h" - -#define FILEPATH "./test.txt" - -static int TestCase(void) -{ - FILE *stream = nullptr; - wchar_t *buf = nullptr; - size_t len = -1; - off_t eob = -1; - int ret = -1; - - stream = open_wmemstream(&buf, &len); - ICUNIT_ASSERT_NOT_EQUAL(stream, NULL, JFFS_IS_ERROR); - - fprintf(stream, "hello my world"); - - ret = fflush(stream); - ICUNIT_ASSERT_NOT_EQUAL(ret, JFFS_IS_ERROR, ret); - ICUNIT_ASSERT_EQUAL(buf, "hello my world", -1); - eob = ftello(stream); - ICUNIT_ASSERT_NOT_EQUAL(eob, JFFS_IS_ERROR, eob); - - ret = fseeko(stream, 0, SEEK_SET); - ICUNIT_ASSERT_NOT_EQUAL(ret, JFFS_IS_ERROR, ret); - - fprintf(stream, "good-bye"); - ret = fseeko(stream, eob, SEEK_SET); - ICUNIT_ASSERT_NOT_EQUAL(ret, JFFS_IS_ERROR, ret); - - ret = fclose(stream); - ICUNIT_ASSERT_NOT_EQUAL(ret, JFFS_IS_ERROR, ret); - - ICUNIT_ASSERT_EQUAL(buf, "good-bye", -1); - free(buf); -} - -void ItTestFsJffs202(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_202", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_203.cpp b/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_203.cpp deleted file mode 100644 index 85d6498a..00000000 --- a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_203.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_fs_jffs.h" - -#define FILEPATH "./test.txt" - -static int TestCase(void) -{ - INT32 ret = -1; - INT32 dirFd = -1; - INT32 fd = -1; - INT32 len = -1; - - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - DIR *dir = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dirFd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(dirFd, JFFS_IS_ERROR, dirFd, EXIT1); - - ret = strcat_s(pathname2, sizeof(pathname2), "/test.txt"); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - fd = open(pathname2, O_CREAT | O_RDWR | O_TRUNC); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, "01234567890123456789012345", 16); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = renameat(dirFd, "test.txt", dirFd, "TEST.txt"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/TEST.txt"); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT2); - ret = unlink(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); -EXIT2: - unlink(pathname1); - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_NO_ERROR; -} - -void ItTestFsJffs203(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_203", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_204.cpp b/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_204.cpp deleted file mode 100644 index 264dec4e..00000000 --- a/testsuites/unittest/fs/jffs/smoke/it_test_fs_jffs_204.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_fs_jffs.h" - -#define DIRPATH "/storage/test" -#define FILEPATH "/storage/test/1.txt" - -static int TestCase(void) -{ - INT32 dirFd = -1; - INT32 fd = -1; - INT32 flags = -1; - INT32 ret = -1; - DIR *dir = nullptr; - ret = mkdir(DIRPATH, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - dir = opendir(DIRPATH); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - fd = open("FILEPATH", O_CREAT | O_RDWR, 0777); - dirFd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(dirFd, JFFS_IS_ERROR, dirFd, EXIT1); - - ret = unlinkat(dirFd, DIRPATH, 0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlinkat(dirFd, FILEPATH, AT_REMOVEDIR); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - -EXIT1: - close(fd); - unlink(DIRPATH); - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_NO_ERROR; -} - -void ItTestFsJffs204(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_204", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/jffs/vfs_jffs_test.cpp b/testsuites/unittest/fs/jffs/vfs_jffs_test.cpp deleted file mode 100644 index bc40a5ce..00000000 --- a/testsuites/unittest/fs/jffs/vfs_jffs_test.cpp +++ /dev/null @@ -1,8051 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_jffs.h" - -#if 1 -struct iovec g_jffsIov[10]; - -INT32 g_jffsFd = 0; -DIR *g_jffsDir = nullptr; -INT32 g_jffsFilesMax = 10; -INT32 g_jffsFlag = 0; -INT32 g_jffsFlagF01 = 0; -INT32 g_jffsFlagF02 = 0; -INT32 g_TestCnt = 0; - -INT32 g_jffsFd11[JFFS_MAXIMUM_SIZES]; -INT32 g_jffsFd12[JFFS_MAXIMUM_SIZES][JFFS_MAXIMUM_SIZES]; - -CHAR g_jffsPathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME1 }; -CHAR g_jffsPathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME1 }; -CHAR g_jffsPathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME1 }; -CHAR g_jffsPathname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - -CHAR g_jffsPathname6[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME1 }; -CHAR g_jffsPathname7[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME1 }; -CHAR g_jffsPathname8[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME1 }; - -CHAR g_jffsPathname11[JFFS_MAXIMUM_SIZES][JFFS_NAME_LIMITTED_SIZE] = { 0, }; -CHAR g_jffsPathname12[JFFS_MAXIMUM_SIZES][JFFS_NAME_LIMITTED_SIZE] = { 0, }; -CHAR g_jffsPathname13[JFFS_MAXIMUM_SIZES][JFFS_NAME_LIMITTED_SIZE] = { 0, }; -#endif -INT32 g_jffsGrandSize[JFFS_MAX_DEF_BUF_NUM] = { 29, 30290, 3435, 235, 12345, 80, - 9845, 564, 34862, 123, 267890, 36, 6788, 86, 234567, 1232, 514, 50, 678, 9864, 333333 }; - -pthread_mutex_t g_jffs2GlobalLock1; -pthread_mutex_t g_jffs2GlobalLock2; - -#if 1 -INT32 JffsMultiWrite(CHAR *path, INT64 fileSize, INT32 writeSize, int oflags, INT32 interfaceType) -{ - INT32 ret, fd; - INT64 total = 0; - INT64 totalSize = 0; - - CHAR *writeBuf; - FILE *file; - - writeBuf = (CHAR *)malloc(writeSize); - ICUNIT_GOTO_NOT_EQUAL(writeBuf, NULL, writeBuf, EXIT); - - if (interfaceType == 1) { - fd = open(path, oflags, S_IRUSR | S_IWUSR); - if (fd < 0) { - goto EXIT1; - } - } else { - file = fopen(path, "w+b"); - if (file == nullptr) { - goto EXIT2; - } - } - - while (1) { - if (interfaceType == 1) { - ret = write(fd, writeBuf, writeSize); - if (ret <= 0) { - if (errno == ENOSPC) { - dprintf("No space !! %s,\n", strerror(errno)); - goto EXIT1; - } - dprintf("jffs_multi_write fail,path = %s,ret=:%d ,errno=:%d!\n", path, ret, errno); - goto EXIT1; - } - } else { - ret = fwrite(writeBuf, 1, writeSize, file); - if (ret <= 0 || ret != writeSize) { - if (errno == ENOSPC) { - dprintf("No space !! %s,\n", strerror(errno)); - } - dprintf("jffs_multi_write error! %s ,path=:%s, ret = %d,\n", strerror(errno), path, ret); - - goto EXIT2; - } - } - total += ret; - totalSize += ret; - - if (total >= JFFS_WR_CAP_SIZE_TEST) { - if (interfaceType == 1) { - } else { - } - total = 0; - } - - if (fileSize <= totalSize) { - break; - } - } - - if (interfaceType == 1) { - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } else { - ret = fclose(file); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - free(writeBuf); - - return JFFS_NO_ERROR; -EXIT2: - fclose(file); - goto EXIT; -EXIT1: - close(fd); -EXIT: - free(writeBuf); - return JFFS_IS_ERROR; -} - - -INT32 JffsMultiRead(CHAR *path, INT64 fileSize, INT32 readSize, int oflags, INT32 interfaceType) -{ - INT32 fd, ret; - INT64 total = 0; - INT64 totalSize = 0; - FILE *file; - CHAR *readBuf; - - readBuf = (CHAR *)malloc(readSize); - ICUNIT_ASSERT_NOT_EQUAL(readBuf, NULL, readBuf); - - if (interfaceType == 1) { - fd = open(path, oflags, S_IRUSR | S_IWUSR); - if (fd < 0) { - goto EXIT1; - } - } else { - file = fopen(path, "rb"); - if (file == nullptr) { - goto EXIT2; - } - } - - while (1) { - if (interfaceType == 1) { - ret = read(fd, readBuf, readSize); - if (ret < 0) { - dprintf("ret = %d,%s read fail!-->(X),\n", ret, path); - goto EXIT1; - } - if (!ret) { - dprintf("warning: read ret = 0,\n"); - goto EXIT1; - } - } else { - ret = fread(readBuf, 1, readSize, file); - if (ret <= 0) { - if (feof(file) == 1) { - dprintf("yyy feof of %s,\n", path); - } else { - dprintf("fread error!,\n"); - goto EXIT2; - } - } - } - total += ret; - totalSize += ret; - - if (total >= JFFS_WR_CAP_SIZE_TEST) { - total = 0; - } - - if (fileSize <= totalSize) { - break; - } - } - - if (interfaceType == 1) { - ret = close(fd); - if (ret < 0) { - dprintf("fail to close %s!\n", strerror(errno)); - } - } else { - ret = fclose(file); - if (ret < 0) { - dprintf("fail to fclose %s!\n", strerror(errno)); - } - } - - free(readBuf); - return JFFS_NO_ERROR; -EXIT2: - fclose(file); -EXIT1: - close(fd); - free(readBuf); - return JFFS_IS_ERROR; -} -#endif - -INT32 JffsFixWrite(CHAR *path, INT64 fileSize, INT32 writeSize, INT32 interfaceType) -{ - INT32 ret, i, fd; - INT64 total = 0; - CHAR filebuf[256] = "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalal"; - INT64 perTime; - INT64 totalSize = 0; - INT64 totalTime = 0; - INT32 cycleCount = 0; - INT32 taskId; - struct timeval testTime1; - struct timeval testTime2; - DOUBLE testSpeed; - CHAR *pid; - CHAR *writeBuf; - FILE *file; - - taskId = strlen(path); - pid = path + taskId - 1; - taskId = atoi(pid); - - writeBuf = (CHAR *)malloc(writeSize); - ICUNIT_GOTO_NOT_EQUAL(writeBuf, NULL, writeBuf, EXIT); - memset(writeBuf, 0, writeSize); - - for (i = 0; i < writeSize / 256; i++) { // 256 means the maxsize of write len - strcat(writeBuf, filebuf); - } - - gettimeofday(&testTime1, 0); - if (interfaceType == 1) { - fd = open(path, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - if (fd < 0) { - printf("Task_%d fail to open %s,\n", taskId, path); - goto EXIT1; - } - } else { - file = fopen(path, "w+b"); - if (file == nullptr) { - printf("Task_%d fail to fopen %s,\n", taskId, path); - goto EXIT2; - } - } - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - printf("fix_Write TaskID:%3d,open %s ,task %lld ms ,\n", taskId, path, perTime / MSECS_PER_SEC); - - gettimeofday(&testTime1, 0); - - while (1) { - if (interfaceType == 1) { - ret = write(fd, writeBuf, writeSize); - if (ret <= 0) { - if (errno == ENOSPC) { - printf("No space !! %s,\n", strerror(errno)); - goto EXIT1; - } - printf("fix_write fail,path = %s,ret=:%d ,errno=:%d!\n", path, ret, errno); - goto EXIT1; - } - } else { - ret = fwrite(writeBuf, 1, writeSize, file); - if (ret <= 0 || ret != writeSize) { - if (errno == ENOSPC) { - printf("No space !! %s,\n", strerror(errno)); - } - printf("fix_fwrite error! %s ,path=:%s, ret = %d,\n", strerror(errno), path, ret); - - goto EXIT2; - } - } - total += ret; - totalSize += ret; - if (total >= JFFS_WR_CAP_SIZE_TEST) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - if (interfaceType == 1) { - printf("fix_Write TaskID:%3d,%d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", - taskId, cycleCount++, total, perTime, testSpeed); - } else { - printf("fix_fwrite TaskID:%3d,%d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", - taskId, cycleCount++, total, perTime, testSpeed); - } - total = 0; - gettimeofday(&testTime1, 0); - } - - if (fileSize <= totalSize) { - break; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - printf("\nfix_Write TaskID:%3d,total write=%lld , time=%lld,arv speed =%0.3lfMB/s ,\n", taskId, totalSize, - totalTime, testSpeed); - gettimeofday(&testTime1, 0); - if (interfaceType == 1) { - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } else { - ret = fclose(file); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - printf("fix_Write TaskID:%3d,sucess to fclose the %s ,task:%d ms,\n", taskId, path, (perTime / USECS_PER_SEC) * MSECS_PER_SEC); - - free(writeBuf); - - return JFFS_NO_ERROR; -EXIT2: - fclose(file); - goto EXIT; -EXIT1: - close(fd); -EXIT: - free(writeBuf); - return JFFS_NO_ERROR; -} - -INT32 JffsFixRead(CHAR *path, INT64 fileSize, INT32 readSize, INT32 interfaceType) -{ - INT32 fd, taskId, ret; - INT32 cycleCount = 0; - INT64 total = 0; - INT64 totalSize = 0; - INT64 perTime; - INT64 totalTime = 0; - FILE *file; - CHAR *readBuf; - CHAR *pid; - DOUBLE testSpeed; - struct timeval testTime1; - struct timeval testTime2; - - taskId = strlen(path); - pid = path + taskId - 1; - taskId = atoi(pid); - - readBuf = (CHAR *)malloc(readSize); - ICUNIT_ASSERT_NOT_EQUAL(readBuf, NULL, readBuf); - - gettimeofday(&testTime1, 0); - - if (interfaceType == 1) { - fd = open(path, O_RDWR, S_IRUSR | S_IWUSR); - if (fd < 0) { - printf("Task_%d fail to open %s,\n", taskId, path); - goto EXIT1; - } - } else { - file = fopen(path, "rb"); - if (file == nullptr) { - printf("Task_%d fail to fopen %s,\n", taskId, path); - goto EXIT2; - } - } - - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - printf("fix_Read TaskID:%3d,open %s , task:%lld ms,\n", taskId, path, perTime / MSECS_PER_SEC); - - gettimeofday(&testTime1, 0); - - while (1) { - if (interfaceType == 1) { - ret = read(fd, readBuf, readSize); - if (ret < 0) { - printf("ret = %d,%s read fail!-->(X),\n", ret, path); - goto EXIT1; - } - if (!ret) { - printf("warning: read ret = 0,\n"); - goto EXIT1; - } - } else { - ret = fread(readBuf, 1, readSize, file); - if (ret <= 0) { - if (feof(file) == 1) { - printf("feof of %s,\n", path); - } else { - printf("fread error!,\n"); - goto EXIT2; - } - } - } - total += ret; - totalSize += ret; - - if (total >= JFFS_WR_CAP_SIZE_TEST) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - printf("fix_Read TaskID:%3d,times %d, read %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", taskId, - cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - - if (fileSize <= totalSize) { - break; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - printf("\nfix_Read TaskID:%3d,total read=%lld , time=%lld,arv speed =%0.3lfMB/s ,\n", taskId, totalSize, - totalTime, testSpeed); - - gettimeofday(&testTime1, 0); - if (interfaceType == 1) { - ret = close(fd); - if (ret < 0) { - printf("fail to close %s!\n", strerror(errno)); - } - } else { - ret = fclose(file); - if (ret < 0) { - dprintf("fail to fclose %s!\n", strerror(errno)); - } - } - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - dprintf("fix_Read TaskID:%3d, fclose %s!,task:%lld ms,\n", taskId, path, perTime / MSECS_PER_SEC); - - ret = remove(path); - if (ret < 0) { - dprintf("fail to remove %s!\n", strerror(errno)); - } - - dprintf("Read TaskID:%3d,sucess to fread the %s,\n", taskId, path); - free(readBuf); - return 0; -EXIT2: - fclose(file); -EXIT1: - close(fd); - free(readBuf); - return JFFS_NO_ERROR; -} - -INT32 JffsRandWrite(CHAR *path, INT64 fileSize, INT32 interfaceType) -{ - INT32 ret, i, fd; - INT32 cycleCount = 0; - INT32 taskId; - CHAR filebuf[256] = "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalal"; - INT64 total = 0; - INT64 totalSize = 0; - INT64 perTime; - INT64 totalTime = 0; - CHAR *writeBuf; - CHAR *pid; - struct timeval testTime1; - struct timeval testTime2; - DOUBLE testSpeed; - FILE *file; - - taskId = strlen(path); - pid = path + taskId - 1; - taskId = atoi(pid); - - writeBuf = (CHAR *)malloc(JFFS_PRESSURE_W_R_SIZE); - ICUNIT_GOTO_NOT_EQUAL(writeBuf, NULL, writeBuf, EXIT); - memset(writeBuf, 0, JFFS_PRESSURE_W_R_SIZE); - - for (i = 0; i < JFFS_PRESSURE_W_R_SIZE / 256; i++) { // 256 means the maxsize of write len - strcat(writeBuf, filebuf); - } - - gettimeofday(&testTime1, 0); - if (interfaceType == 1) { - fd = open(path, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - if (fd < 0) { - dprintf("Task_%d fail to open %s,\n", taskId, path); - goto EXIT1; - } - } else { - file = fopen(path, "w+b"); - if (file == nullptr) { - dprintf("Task_%d fail to fopen %s,\n", taskId, path); - goto EXIT2; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - dprintf("rand_write TaskID:%3d,open %s , cost:%lld ms,\n", taskId, path, perTime / MSECS_PER_SEC); - - gettimeofday(&testTime1, 0); - - i = 0; - - while (1) { - if (interfaceType == 1) { - ret = write(fd, writeBuf, g_jffsGrandSize[i]); - if (ret <= 0) { - dprintf("ret = %d,%s write fail!-->(X),\n", ret, path); - if (errno == ENOSPC) { - dprintf("No space !! %s,\n", strerror(errno)); - goto EXIT1; - } - goto EXIT1; - } - } else { - ret = fwrite(writeBuf, 1, g_jffsGrandSize[i], file); - if (ret <= 0 || ret != g_jffsGrandSize[i]) { - if (errno == ENOSPC) { - dprintf("No space !! %s,\n", strerror(errno)); - } - dprintf("rand_Write TaskID:%3d,fwrite error! %s , ret = %d,\n", taskId, strerror(errno), ret); - goto EXIT2; - } - } - - total += ret; - totalSize += ret; - if (total >= JFFS_WR_CAP_SIZE_TEST) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - testSpeed = total * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - dprintf("rand_Write TaskID:%3d,%d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", - taskId, cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - - if (fileSize <= totalSize) { - break; - } - if (++i >= JFFS_MAX_DEF_BUF_NUM) - i = 0; - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - dprintf("--------------------------------\n"); - dprintf("rand_Write TaskID:%3d,total write=%lld , time=%lld,arv speed =%0.3lfMB/s ,\n", taskId, totalSize, - totalTime, testSpeed); - - gettimeofday(&testTime1, 0); - if (interfaceType == 1) { - ret = close(fd); - if (ret < 0) { - dprintf("rand_Write TaskID:%3d,fail to close %s!\n", taskId, strerror(errno)); - goto EXIT1; - } - } else { - ret = fclose(file); - if (ret < 0) { - dprintf("rand_Write TaskID:%3d,fail to fclose %s!\n", taskId, strerror(errno)); - goto EXIT2; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - dprintf("rand_Write TaskID:%3d,sucess to fclose the %s ,task %lld,\n", taskId, path, perTime / MSECS_PER_SEC); - - free(writeBuf); - - return JFFS_NO_ERROR; -EXIT2: - fclose(file); - goto EXIT; -EXIT1: - close(fd); -EXIT: - free(writeBuf); - return JFFS_NO_ERROR; -} - - -INT32 JffsRandRead(CHAR *path, INT64 fileSize, INT32 interfaceType) -{ - INT32 ret, fd, i; - INT32 cycleCount = 0; - INT32 taskId; - INT64 total = 0; - INT64 totalSize = 0; - INT64 perTime; - INT64 totalTime = 0; - struct timeval testTime1; - struct timeval testTime2; - DOUBLE testSpeed; - CHAR *pid; - CHAR *readBuf; - FILE *file; - - taskId = strlen(path); - pid = path + taskId - 1; - taskId = atoi(pid); - - readBuf = (CHAR *)malloc(JFFS_PRESSURE_W_R_SIZE); - ICUNIT_GOTO_NOT_EQUAL(readBuf, NULL, readBuf, EXIT); - - gettimeofday(&testTime1, 0); - if (interfaceType == 1) { - fd = open(path, O_RDWR, S_IRUSR | S_IWUSR); - if (-1 == fd) { - printf("fail to open %s\n", path); - goto EXIT1; - } - } else { - file = fopen(path, "rb"); - if (file == nullptr) { - printf("fail to fopen %s\n", path); - goto EXIT2; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - printf("rand_read, open %s , task:%lld ms,\n", path, perTime / MSECS_PER_SEC); - - i = 0; - gettimeofday(&testTime1, 0); - - while (1) { - if (interfaceType == 1) { - ret = read(fd, readBuf, g_jffsGrandSize[i]); - if (ret < 0) { - printf("ret = %d,%s read fail!-->(X)\n", ret, path); - goto EXIT1; - } - if (!ret) { - printf("warning: read ret = 0,\n"); - } - } else { - ret = fread(readBuf, 1, g_jffsGrandSize[i], file); - if (ret <= 0) { - if (feof(file) == 1) { - printf("feof of %s\n", path); - } else { - printf("fread error!\n"); - goto EXIT2; - } - } - } - total += ret; - totalSize += ret; - - if (total >= JFFS_WR_CAP_SIZE_TEST) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - dprintf("rand_Read TaskID:%3d, times %d, read %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", taskId, - cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - - if (fileSize <= totalSize) { - break; - } - if (++i >= JFFS_MAX_DEF_BUF_NUM) - i = 0; - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - printf("--------------------------------\n"); - printf("rand_Read TaskID:%3d ,total read=%lld , time=%lld,arv speed =%0.3lfMB/s ,\n", taskId, totalSize, - totalTime, testSpeed); - - gettimeofday(&testTime1, 0); - if (interfaceType == 1) { - ret = close(fd); - if (ret < 0) { - printf("fail to close %s!\n", strerror(errno)); - } - } else { - ret = fclose(file); - if (ret < 0) { - printf("fail to fclose %s!\n", strerror(errno)); - } - } - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - printf(" rand_Read TaskID:%3d,fclose %s!,task:%lld ms,\n", taskId, path, perTime / MSECS_PER_SEC); - - ret = remove(path); - if (ret < 0) { - printf("fail to fclose %s!\n", strerror(errno)); - } - - printf("rand_Read TaskID:%3d,sucess to fread the %s,\n", taskId, path); - - free(readBuf); - return JFFS_NO_ERROR; - -EXIT2: - fclose(file); - goto EXIT1; -EXIT1: - close(fd); -EXIT: - free(readBuf); - return JFFS_NO_ERROR; -} - -INT32 JffsDeleteDirs(char *str, int n) -{ - struct dirent *ptr; - int ret; - DIR *dir; - int i = 0; - - ret = chdir(str); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - dir = opendir(str); - ICUNIT_ASSERT_NOT_EQUAL(dir, NULL, dir); - - rewinddir(dir); - while ((ptr = readdir(dir)) != nullptr) { - if ((strcmp(ptr->d_name, "..") == 0) || (strcmp(ptr->d_name, ".") == 0)) - continue; - - if (i == n) { - break; - } - i++; - - ret = rmdir(ptr->d_name); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - } - - ret = closedir(dir); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - ret = rmdir(str); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - return JFFS_NO_ERROR; -} -INT32 JffsDeletefile(int fd, char *pathname) -{ - int ret; - - ret = close(fd); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = unlink(pathname); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return JFFS_NO_ERROR; -} - -INT32 JffsStrcat2(char *pathname, char *str, int len) -{ - memset(pathname, 0, len); - strcpy(pathname, JFFS_PATH_NAME0); - strcat(pathname, str); - - return 0; -} -INT32 JffsScandirFree(struct dirent **namelist, int n) -{ - if (n < 0 || namelist == nullptr) { - return -1; - } else if (n == 0) { - free(namelist); - return 0; - } - while (n--) { - free(namelist[n]); - } - free(namelist); - - return 0; -} - -INT32 JffsStatPrintf(struct stat sb) -{ -#if VFS_STAT_PRINTF == 1 - - dprintf("File type: "); - - switch (sb.st_mode & S_IFMT) { - case S_IFBLK: - dprintf("block device\n"); - break; - case S_IFCHR: - dprintf("character device\n"); - break; - case S_IFDIR: - dprintf("directory\n"); - break; - case S_IFIFO: - dprintf("FIFO/pipe\n"); - break; - case S_IFLNK: - dprintf("symlink\n"); - break; - case S_IFREG: - dprintf("regular file\n"); - break; - case S_IFSOCK: - dprintf("socket\n"); - break; - default: - dprintf("unknown?\n"); - break; - } - - switch (sb.st_mode & S_IRWXU) { - case S_IRUSR: - dprintf("Owners have read permission\n"); - break; - case S_IWUSR: - dprintf("Owners have write permission\n"); - break; - case S_IXUSR: - dprintf("Owners have execute permissions\n"); - break; - default: - break; - } - - switch (sb.st_mode & S_IRWXG) { - case S_IRGRP: - dprintf("Group has read permission\n"); - break; - case S_IWGRP: - dprintf("Group has write permission\n"); - break; - case S_IXGRP: - dprintf("Group has execute permission\n"); - break; - default: - break; - } - - switch (sb.st_mode & S_IRWXO) { - case S_IROTH: - dprintf("Other have read permission\n"); - break; - case S_IWOTH: - dprintf("Other has write permission\n"); - break; - case S_IXOTH: - dprintf("Other has execute permission\n"); - break; - default: - break; - } - - dprintf("I-node number: %ld\n", (long)sb.st_ino); - dprintf("Mode: %lo (octal)\n", (unsigned long)sb.st_mode); - dprintf("Link count: %ld\n", (long)sb.st_nlink); - dprintf("Ownership: UID=%ld GID=%ld\n", (long)sb.st_uid, (long)sb.st_gid); - - dprintf("Preferred I/O block size: %ld bytes\n", (long)sb.st_blksize); - dprintf("File size: %lld bytes\n", (long long)sb.st_size); - dprintf("Blocks allocated: %lld\n", (long long)sb.st_blocks); - - dprintf("Last status change: %s", ctime(&sb.st_ctime)); - dprintf("Last file access: %s", ctime(&sb.st_atime)); - dprintf("Last file modification: %s\n", ctime(&sb.st_mtime)); - -#endif - return 0; -} - -INT32 JffsStatfsPrintf(struct statfs buf) -{ -#if VFS_STATFS_PRINTF == 1 - dprintf("type of file system : 0x%x\n", buf.f_type); - dprintf("optimal transfer block size : %ld\n", (long)buf.f_bsize); - dprintf("total data blocks in file system : %ld\n", (long)buf.f_blocks); - dprintf("free blocks in fs : %ld\n", (long)buf.f_bfree); - dprintf("free blocks available to unprivileged user : %ld\n", (long)buf.f_bavail); - dprintf("total file nodes in file system : %ld\n", (long)buf.f_files); - - dprintf("free file nodes in fs : %ld\n", (long)buf.f_ffree); - dprintf("file system id : %d\n", buf.f_fsid.__val[0]); - dprintf("maximum length of filenames : 0x%x\n", buf.f_namelen); - dprintf("fragment size: %d\n\n", buf.f_frsize); -#endif - return 0; -} - - -using namespace testing::ext; -namespace OHOS { -#if defined(LOSCFG_USER_TEST_PRESSURE) -pthread_mutexattr_t mutex; -#endif -class VfsJffsTest : public testing::Test { -public: - static void SetUpTestCase(void) - { -#if defined(LOSCFG_USER_TEST_PRESSURE) - pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&g_jffs2GlobalLock1, &mutex); - pthread_mutex_init(&g_jffs2GlobalLock2, &mutex); -#endif - } - static void TearDownTestCase(void) {} -}; -#if defined(LOSCFG_USER_TEST_FULL) -/* * - * @tc.name: IO_TEST_FACCESSAT_001 - * @tc.desc: normal tests for faccessat - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, IO_TEST_FACCESSAT_001, TestSize.Level0) -{ - IO_TEST_FACCESSAT_001(); -} - -/* * - * @tc.name: IO_TEST_FACCESSAT_002 - * @tc.desc: innormal tests for faccessat - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, IO_TEST_FACCESSAT_002, TestSize.Level0) -{ - IO_TEST_FACCESSAT_002(); -} - -/* * - * @tc.name: IO_TEST_FSTATFS_001 - * @tc.desc: normal tests for fstatfs - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, IO_TEST_FSTATFS_001, TestSize.Level0) -{ - IO_TEST_FSTATFS_001(); -} - -/* * - * @tc.name: IO_TEST_FSTATFS_002 - * @tc.desc: innormal tests for fstatfs - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, IO_TEST_FSTATFS_002, TestSize.Level0) -{ - IO_TEST_FSTATFS_002(); -} - -/* * - * @tc.name: IO_TEST_FSTATAT_001 - * @tc.desc: normal tests for fstatat - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, IO_TEST_FSTATAT_001, TestSize.Level0) -{ - IO_TEST_FSTATAT_001(); -} - -/* * - * @tc.name: IO_TEST_FSTATAT_002 - * @tc.desc: innormal tests for fstatat - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, IO_TEST_FSTATAT_002, TestSize.Level0) -{ - IO_TEST_FSTATAT_002(); -} - -/* * - * @tc.name: ItTestFsJffs001 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs001, TestSize.Level0) -{ - ItTestFsJffs001(); -} - -/* * - * @tc.name: ItTestFsJffs002 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs002, TestSize.Level0) -{ - ItTestFsJffs002(); -} - -/* * - * @tc.name: ItTestFsJffs003 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs003, TestSize.Level0) -{ - ItTestFsJffs003(); -} - -/* * - * @tc.name: ItTestFsJffs004 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs004, TestSize.Level0) -{ - ItTestFsJffs004(); -} - -/* * - * @tc.name: ItTestFsJffs100 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs100, TestSize.Level0) -{ - ItTestFsJffs100(); -} - -/* * - * @tc.name: ItTestFsJffs101 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs101, TestSize.Level0) -{ - ItTestFsJffs101(); -} - -/* * - * @tc.name: ItTestFsJffs102 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs102, TestSize.Level0) -{ - ItTestFsJffs102(); -} - -/* * - * @tc.name: ItTestFsJffs103 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs103, TestSize.Level0) -{ - ItTestFsJffs103(); -} - -/* * - * @tc.name: ItTestFsJffs106 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs106, TestSize.Level0) -{ - ItTestFsJffs106(); -} - -/* * - * @tc.name: ItTestFsJffs112 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs112, TestSize.Level0) -{ - ItTestFsJffs112(); -} - -/* * - * @tc.name: ItTestFsJffs113 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs113, TestSize.Level0) -{ - ItTestFsJffs113(); -} - -/* * - * @tc.name: IT_JFFS_002 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs002, TestSize.Level0) -{ - ItJffs002(); -} - -/* * - * @tc.name: IT_JFFS_004 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs004, TestSize.Level0) -{ - ItJffs004(); -} - -/* * - * @tc.name: IT_JFFS_007 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs007, TestSize.Level0) -{ - ItJffs007(); -} - -/* * - * @tc.name: IT_JFFS_009 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs009, TestSize.Level0) -{ - ItJffs009(); -} - -/* * - * @tc.name: IT_JFFS_010 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs010, TestSize.Level0) -{ - ItJffs010(); -} - -/* * - * @tc.name: IT_JFFS_011 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs011, TestSize.Level0) -{ - ItJffs011(); -} - -/* * - * @tc.name: IT_JFFS_012 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs012, TestSize.Level0) -{ - ItJffs012(); -} - -/* * - * @tc.name: IT_JFFS_013 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs013, TestSize.Level0) -{ - ItJffs013(); -} - -/* * - * @tc.name: IT_JFFS_015 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs015, TestSize.Level0) -{ - ItJffs015(); -} - -/* * - * @tc.name: IT_JFFS_017 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs017, TestSize.Level0) -{ - ItJffs017(); -} - -/* * - * @tc.name: IT_JFFS_018 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs018, TestSize.Level0) -{ - ItJffs018(); -} - -/* * - * @tc.name: IT_JFFS_019 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs019, TestSize.Level0) -{ - ItJffs019(); -} - -/* * - * @tc.name: IT_JFFS_022 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs022, TestSize.Level0) -{ - ItJffs022(); -} - -/* * - * @tc.name: IT_JFFS_025 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs025, TestSize.Level0) -{ - ItJffs025(); -} - -/* * - * @tc.name: IT_JFFS_026 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs026, TestSize.Level0) -{ - ItJffs026(); -} - -/* * - * @tc.name: IT_JFFS_027 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs027, TestSize.Level0) -{ - ItJffs027(); -} - -/* * - * @tc.name: IT_JFFS_030 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs030, TestSize.Level0) -{ - ItJffs030(); -} - -/* * - * @tc.name: IT_JFFS_032 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs032, TestSize.Level0) -{ - ItJffs032(); -} - -/* * - * @tc.name: IT_JFFS_033 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs033, TestSize.Level0) -{ - ItJffs033(); -} - -/* * - * @tc.name: IT_JFFS_034 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs034, TestSize.Level0) -{ - ItJffs034(); -} - -/* * - * @tc.name: IT_JFFS_035 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs035, TestSize.Level0) -{ - ItJffs035(); -} - -/* * - * @tc.name: IT_JFFS_036 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs036, TestSize.Level0) -{ - ItJffs036(); -} - -/* * - * @tc.name: IT_JFFS_037 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs037, TestSize.Level0) -{ - ItJffs037(); -} - -/* * - * @tc.name: IT_JFFS_038 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs038, TestSize.Level0) -{ - ItJffs038(); -} - -/* * - * @tc.name: IT_JFFS_040 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs040, TestSize.Level0) -{ - ItJffs040(); -} - -/* * - * @tc.name: IT_JFFS_041 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs041, TestSize.Level0) -{ - ItJffs041(); -} - -/* * - * @tc.name: IT_JFFS_042 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs042, TestSize.Level0) -{ - ItJffs042(); -} - -/* * - * @tc.name: IT_JFFS_021 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs021, TestSize.Level0) -{ - ItJffs021(); -} - -/* * - * @tc.name: IT_JFFS_043 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs043, TestSize.Level0) -{ - ItJffs043(); -} - -/* * - * @tc.name: IT_JFFS_044 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItJffs044, TestSize.Level0) -{ - ItJffs044(); -} - - -/* * - * @tc.name: ItFsJffs004 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs004, TestSize.Level0) -{ - ItFsJffs004(); -} - -/* * - * @tc.name: ItFsJffs006 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs006, TestSize.Level0) -{ - ItFsJffs006(); -} - -/* * - * @tc.name: ItFsJffs008 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs008, TestSize.Level0) -{ - ItFsJffs008(); -} - -/* * - * @tc.name: ItFsJffs009 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs009, TestSize.Level0) -{ - ItFsJffs009(); -} - -/* * - * @tc.name: ItFsJffs011 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs011, TestSize.Level0) -{ - ItFsJffs011(); -} - -/* * - * @tc.name: ItFsJffs012 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs012, TestSize.Level0) -{ - ItFsJffs012(); -} - -/* * - * @tc.name: ItFsJffs013 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs013, TestSize.Level0) -{ - ItFsJffs013(); -} - -/* * - * @tc.name: ItFsJffs014 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs014, TestSize.Level0) -{ - ItFsJffs014(); -} - -/* * - * @tc.name: ItFsJffs015 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs015, TestSize.Level0) -{ - ItFsJffs015(); -} - -/* * - * @tc.name: ItFsJffs016 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs016, TestSize.Level0) -{ - ItFsJffs016(); -} - -/* * - * @tc.name: ItFsJffs017 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs017, TestSize.Level0) -{ - ItFsJffs017(); -} - -/* * - * @tc.name: ItFsJffs018 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs018, TestSize.Level0) -{ - ItFsJffs018(); -} - -/* * - * @tc.name: ItFsJffs019 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs019, TestSize.Level0) -{ - ItFsJffs019(); -} - -/* * - * @tc.name: ItFsJffs020 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs020, TestSize.Level0) -{ - ItFsJffs020(); -} - -/* * - * @tc.name: ItFsJffs023 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs023, TestSize.Level0) -{ - ItFsJffs023(); -} - -/* * - * @tc.name: ItFsJffs024 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs024, TestSize.Level0) -{ - ItFsJffs024(); -} - -/* * - * @tc.name: ItFsJffs025 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs025, TestSize.Level0) -{ - ItFsJffs025(); -} - -/* * - * @tc.name: ItFsJffs029 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs029, TestSize.Level0) -{ - ItFsJffs029(); -} - -/* * - * @tc.name: ItFsJffs030 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs030, TestSize.Level0) -{ - ItFsJffs030(); -} - -/* * - * @tc.name: ItFsJffs031 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs031, TestSize.Level0) -{ - ItFsJffs031(); -} - -/* * - * @tc.name: ItFsJffs032 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs032, TestSize.Level0) -{ - ItFsJffs032(); -} - -/* * - * @tc.name: ItFsJffs033 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs033, TestSize.Level0) -{ - ItFsJffs033(); -} - -/* * - * @tc.name: ItFsJffs037 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs037, TestSize.Level0) -{ - ItFsJffs037(); -} - -/* * - * @tc.name: ItFsJffs038 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs038, TestSize.Level0) -{ - ItFsJffs038(); -} - -/* * - * @tc.name: ItFsJffs039 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs039, TestSize.Level0) -{ - ItFsJffs039(); -} - -/* * - * @tc.name: ItFsJffs040 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs040, TestSize.Level0) -{ - ItFsJffs040(); -} - -/* * - * @tc.name: ItFsJffs041 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs041, TestSize.Level0) -{ - ItFsJffs041(); -} - -/* * - * @tc.name: ItFsJffs042 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs042, TestSize.Level0) -{ - ItFsJffs042(); -} - -/* * - * @tc.name: ItFsJffs043 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs043, TestSize.Level0) -{ - ItFsJffs043(); -} - -/* * - * @tc.name: ItFsJffs044 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs044, TestSize.Level0) -{ - ItFsJffs044(); -} - -/* * - * @tc.name: ItFsJffs045 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs045, TestSize.Level0) -{ - ItFsJffs045(); -} - -/* * - * @tc.name: ItFsJffs046 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs046, TestSize.Level0) -{ - ItFsJffs046(); -} - -/* * - * @tc.name: ItFsJffs048 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs048, TestSize.Level0) -{ - ItFsJffs048(); -} - -/* * - * @tc.name: ItFsJffs049 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs049, TestSize.Level0) -{ - ItFsJffs049(); -} - -/* * - * @tc.name: ItFsJffs050 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs050, TestSize.Level0) -{ - ItFsJffs050(); -} - -/* * - * @tc.name: ItFsJffs053 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs053, TestSize.Level0) -{ - ItFsJffs053(); -} - -/* * - * @tc.name: ItFsJffs055 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs055, TestSize.Level0) -{ - ItFsJffs055(); -} - -/* * - * @tc.name: ItFsJffs056 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs056, TestSize.Level0) -{ - ItFsJffs056(); -} - -/* * - * @tc.name: ItFsJffs057 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs057, TestSize.Level0) -{ - ItFsJffs057(); -} - -/* * - * @tc.name: ItFsJffs059 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs059, TestSize.Level0) -{ - ItFsJffs059(); -} - -/* * - * @tc.name: ItFsJffs060 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs060, TestSize.Level0) -{ - ItFsJffs060(); -} - -/* * - * @tc.name: ItFsJffs061 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs061, TestSize.Level0) -{ - ItFsJffs061(); -} - -/* * - * @tc.name: ItFsJffs062 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs062, TestSize.Level0) -{ - ItFsJffs062(); -} - -/* * - * @tc.name: ItFsJffs063 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs063, TestSize.Level0) -{ - ItFsJffs063(); -} - -/* * - * @tc.name: ItFsJffs064 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs064, TestSize.Level0) -{ - ItFsJffs064(); -} - -/* * - * @tc.name: ItFsJffs066 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs066, TestSize.Level0) -{ - ItFsJffs066(); -} - -/* * - * @tc.name: ItFsJffs068 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs068, TestSize.Level0) -{ - ItFsJffs068(); -} - -/* * - * @tc.name: ItFsJffs069 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs069, TestSize.Level0) -{ - ItFsJffs069(); -} - -/* * - * @tc.name: ItFsJffs070 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs070, TestSize.Level0) -{ - ItFsJffs070(); -} - -/* * - * @tc.name: ItFsJffs077 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs077, TestSize.Level0) -{ - ItFsJffs077(); -} - -/* * - * @tc.name: ItFsJffs078 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs078, TestSize.Level0) -{ - ItFsJffs078(); -} - -/* * - * @tc.name: ItFsJffs079 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs079, TestSize.Level0) -{ - ItFsJffs079(); -} - -/* * - * @tc.name: ItFsJffs081 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs081, TestSize.Level0) -{ - ItFsJffs081(); -} - -/* * - * @tc.name: ItFsJffs082 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs082, TestSize.Level0) -{ - ItFsJffs082(); -} - -/* * - * @tc.name: ItFsJffs083 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs083, TestSize.Level0) -{ - ItFsJffs083(); -} - -/* * - * @tc.name: ItFsJffs084 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs084, TestSize.Level0) -{ - ItFsJffs084(); -} - -/* * - * @tc.name: ItFsJffs085 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs085, TestSize.Level0) -{ - ItFsJffs085(); -} - -/* * - * @tc.name: ItFsJffs088 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs088, TestSize.Level0) -{ - ItFsJffs088(); -} - -/* * - * @tc.name: ItFsJffs090 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs090, TestSize.Level0) -{ - ItFsJffs090(); -} - -/* * - * @tc.name: ItFsJffs093 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs093, TestSize.Level0) -{ - ItFsJffs093(); -} - -/* * - * @tc.name: ItFsJffs096 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs096, TestSize.Level0) -{ - ItFsJffs096(); -} - -/* * - * @tc.name: ItFsJffs099 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs099, TestSize.Level0) -{ - ItFsJffs099(); -} - -/* * - * @tc.name: ItFsJffs100 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs100, TestSize.Level0) -{ - ItFsJffs100(); -} - -/* * - * @tc.name: ItFsJffs104 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs104, TestSize.Level0) -{ - ItFsJffs104(); -} - -/* * - * @tc.name: ItFsJffs116 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs116, TestSize.Level0) -{ - ItFsJffs116(); -} - -/* * - * @tc.name: ItFsJffs117 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs117, TestSize.Level0) -{ - ItFsJffs117(); -} - -/* * - * @tc.name: ItFsJffs118 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs118, TestSize.Level0) -{ - ItFsJffs118(); -} - -/* * - * @tc.name: ItFsJffs119 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs119, TestSize.Level0) -{ - ItFsJffs119(); -} - -/* * - * @tc.name: ItFsJffs120 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs120, TestSize.Level0) -{ - ItFsJffs120(); -} - -/* * - * @tc.name: ItFsJffs121 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs121, TestSize.Level0) -{ - ItFsJffs121(); -} - -/* * - * @tc.name: ItFsJffs123 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs123, TestSize.Level0) -{ - ItFsJffs123(); -} - -/* * - * @tc.name: ItFsJffs126 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs126, TestSize.Level0) -{ - ItFsJffs126(); -} - -/* * - * @tc.name: ItFsJffs127 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs127, TestSize.Level0) -{ - ItFsJffs127(); -} - -/* * - * @tc.name: ItFsJffs128 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs128, TestSize.Level0) -{ - ItFsJffs128(); -} - -/* * - * @tc.name: ItFsJffs129 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs129, TestSize.Level0) -{ - ItFsJffs129(); -} - -/* * - * @tc.name: ItFsJffs130 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs130, TestSize.Level0) -{ - ItFsJffs130(); -} - -/* * - * @tc.name: ItFsJffs131 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs131, TestSize.Level0) -{ - ItFsJffs131(); -} - -/* * - * @tc.name: ItFsJffs132 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs132, TestSize.Level0) -{ - ItFsJffs132(); -} - -/* * - * @tc.name: ItFsJffs133 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs133, TestSize.Level0) -{ - ItFsJffs133(); -} - -/* * - * @tc.name: ItFsJffs134 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs134, TestSize.Level0) -{ - ItFsJffs134(); -} - -/* * - * @tc.name: ItFsJffs135 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs135, TestSize.Level0) -{ - ItFsJffs135(); -} - -/* * - * @tc.name: ItFsJffs136 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs136, TestSize.Level0) -{ - ItFsJffs136(); -} - -/* * - * @tc.name: ItFsJffs137 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs137, TestSize.Level0) -{ - ItFsJffs137(); -} - -/* * - * @tc.name: ItFsJffs138 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs138, TestSize.Level0) -{ - ItFsJffs138(); -} - -/* * - * @tc.name: ItFsJffs139 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs139, TestSize.Level0) -{ - ItFsJffs139(); -} - -/* * - * @tc.name: ItFsJffs140 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs140, TestSize.Level0) -{ - ItFsJffs140(); -} - -/* * - * @tc.name: ItFsJffs141 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs141, TestSize.Level0) -{ - ItFsJffs141(); -} - -/* * - * @tc.name: ItFsJffs142 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs142, TestSize.Level0) -{ - ItFsJffs142(); -} - -/* * - * @tc.name: ItFsJffs143 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs143, TestSize.Level0) -{ - ItFsJffs143(); -} - -/* * - * @tc.name: ItFsJffs144 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs144, TestSize.Level0) -{ - ItFsJffs144(); -} - -/* * - * @tc.name: ItFsJffs145 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs145, TestSize.Level0) -{ - ItFsJffs145(); -} - -/* * - * @tc.name: ItFsJffs146 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs146, TestSize.Level0) -{ - ItFsJffs146(); -} - -/* * - * @tc.name: ItFsJffs147 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs147, TestSize.Level0) -{ - ItFsJffs147(); -} - -/* * - * @tc.name: ItFsJffs148 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs148, TestSize.Level0) -{ - ItFsJffs148(); -} - -/* * - * @tc.name: ItFsJffs149 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs149, TestSize.Level0) -{ - ItFsJffs149(); -} - -/* * - * @tc.name: ItFsJffs150 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs150, TestSize.Level0) -{ - ItFsJffs150(); -} - -/* * - * @tc.name: ItFsJffs151 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs151, TestSize.Level0) -{ - ItFsJffs151(); -} - -/* * - * @tc.name: ItFsJffs152 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs152, TestSize.Level0) -{ - ItFsJffs152(); -} - -/* * - * @tc.name: ItFsJffs153 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs153, TestSize.Level0) -{ - ItFsJffs153(); -} - -/* * - * @tc.name: ItFsJffs154 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs154, TestSize.Level0) -{ - ItFsJffs154(); -} - -/* * - * @tc.name: ItFsJffs155 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs155, TestSize.Level0) -{ - ItFsJffs155(); -} - -/* * - * @tc.name: ItFsJffs156 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs156, TestSize.Level0) -{ - ItFsJffs156(); -} - -/* * - * @tc.name: ItFsJffs157 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs157, TestSize.Level0) -{ - ItFsJffs157(); -} - -/* * - * @tc.name: ItFsJffs158 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs158, TestSize.Level0) -{ - ItFsJffs158(); -} - -/* * - * @tc.name: ItFsJffs159 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs159, TestSize.Level0) -{ - ItFsJffs159(); -} - -/* * - * @tc.name: ItFsJffs160 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs160, TestSize.Level0) -{ - ItFsJffs160(); -} - -/* * - * @tc.name: ItFsJffs161 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs161, TestSize.Level0) -{ - ItFsJffs161(); -} - -/* * - * @tc.name: ItFsJffs162 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs162, TestSize.Level0) -{ - ItFsJffs162(); -} - -/* * - * @tc.name: ItFsJffs163 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs163, TestSize.Level0) -{ - ItFsJffs163(); -} - -/* * - * @tc.name: ItFsJffs164 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs164, TestSize.Level0) -{ - ItFsJffs164(); -} - -/* * - * @tc.name: ItFsJffs165 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs165, TestSize.Level0) -{ - ItFsJffs165(); -} - -/* * - * @tc.name: ItFsJffs166 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs166, TestSize.Level0) -{ - ItFsJffs166(); -} - -/* * - * @tc.name: ItFsJffs167 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs167, TestSize.Level0) -{ - ItFsJffs167(); -} - -/* * - * @tc.name: ItFsJffs168 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs168, TestSize.Level0) -{ - ItFsJffs168(); -} - -/* * - * @tc.name: ItFsJffs169 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs169, TestSize.Level0) -{ - ItFsJffs169(); -} - -/* * - * @tc.name: ItFsJffs170 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs170, TestSize.Level0) -{ - ItFsJffs170(); -} - -/* * - * @tc.name: ItFsJffs171 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs171, TestSize.Level0) -{ - ItFsJffs171(); -} - -/* * - * @tc.name: ItFsJffs172 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs172, TestSize.Level0) -{ - ItFsJffs172(); -} - -/* * - * @tc.name: ItFsJffs173 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs173, TestSize.Level0) -{ - ItFsJffs173(); -} - -/* * - * @tc.name: ItFsJffs175 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs175, TestSize.Level0) -{ - ItFsJffs175(); -} - -/* * - * @tc.name: ItFsJffs176 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs176, TestSize.Level0) -{ - ItFsJffs176(); -} - -/* * - * @tc.name: ItFsJffs177 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs177, TestSize.Level0) -{ - ItFsJffs177(); -} - -/* * - * @tc.name: ItFsJffs178 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs178, TestSize.Level0) -{ - ItFsJffs178(); -} - -/* * - * @tc.name: ItFsJffs179 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs179, TestSize.Level0) -{ - ItFsJffs179(); -} - -/* * - * @tc.name: ItFsJffs180 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs180, TestSize.Level0) -{ - ItFsJffs180(); -} - -/* * - * @tc.name: ItFsJffs182 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs182, TestSize.Level0) -{ - ItFsJffs182(); -} - -/* * - * @tc.name: ItFsJffs183 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs183, TestSize.Level0) -{ - ItFsJffs183(); -} - -/* * - * @tc.name: ItFsJffs184 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs184, TestSize.Level0) -{ - ItFsJffs184(); -} - -/* * - * @tc.name: ItFsJffs185 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs185, TestSize.Level0) -{ - ItFsJffs185(); -} - -/* * - * @tc.name: ItFsJffs187 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs187, TestSize.Level0) -{ - ItFsJffs187(); -} - -/* * - * @tc.name: ItFsJffs188 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs188, TestSize.Level0) -{ - ItFsJffs188(); -} - -/* * - * @tc.name: ItFsJffs189 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs189, TestSize.Level0) -{ - ItFsJffs189(); -} - -/* * - * @tc.name: ItFsJffs190 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs190, TestSize.Level0) -{ - ItFsJffs190(); -} - -/* * - * @tc.name: ItFsJffs191 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs191, TestSize.Level0) -{ - ItFsJffs191(); -} - -/* * - * @tc.name: ItFsJffs192 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs192, TestSize.Level0) -{ - ItFsJffs192(); -} - -/* * - * @tc.name: ItFsJffs193 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs193, TestSize.Level0) -{ - ItFsJffs193(); -} - -/* * - * @tc.name: ItFsJffs194 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs194, TestSize.Level0) -{ - ItFsJffs194(); -} - -/* * - * @tc.name: ItFsJffs195 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs195, TestSize.Level0) -{ - ItFsJffs195(); -} - -/* * - * @tc.name: ItFsJffs196 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs196, TestSize.Level0) -{ - ItFsJffs196(); -} - -/* * - * @tc.name: ItFsJffs197 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs197, TestSize.Level0) -{ - ItFsJffs197(); -} - -/* * - * @tc.name: ItFsJffs198 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs198, TestSize.Level0) -{ - ItFsJffs198(); -} - -/* * - * @tc.name: ItFsJffs199 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs199, TestSize.Level0) -{ - ItFsJffs199(); -} - -/* * - * @tc.name: ItFsJffs200 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs200, TestSize.Level0) -{ - ItFsJffs200(); -} - -/* * - * @tc.name: ItFsJffs202 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs202, TestSize.Level0) -{ - ItFsJffs202(); -} - -/* * - * @tc.name: ItFsJffs203 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs203, TestSize.Level0) -{ - ItFsJffs203(); -} - -/* * - * @tc.name: ItFsJffs204 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs204, TestSize.Level0) -{ - ItFsJffs204(); -} - -/* * - * @tc.name: ItFsJffs205 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs205, TestSize.Level0) -{ - ItFsJffs205(); -} - -/* * - * @tc.name: ItFsJffs206 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs206, TestSize.Level0) -{ - ItFsJffs206(); -} - -/* * - * @tc.name: ItFsJffs207 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs207, TestSize.Level0) -{ - ItFsJffs207(); -} - -/* * - * @tc.name: ItFsJffs208 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs208, TestSize.Level0) -{ - ItFsJffs208(); -} - -/* * - * @tc.name: ItFsJffs209 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs209, TestSize.Level0) -{ - ItFsJffs209(); -} - -/* * - * @tc.name: ItFsJffs210 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs210, TestSize.Level0) -{ - ItFsJffs210(); -} - -/* * - * @tc.name: ItFsJffs211 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs211, TestSize.Level0) -{ - ItFsJffs211(); -} - -/* * - * @tc.name: ItFsJffs212 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs212, TestSize.Level0) -{ - ItFsJffs212(); -} - -/* * - * @tc.name: ItFsJffs213 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs213, TestSize.Level0) -{ - ItFsJffs213(); -} - -/* * - * @tc.name: ItFsJffs214 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs214, TestSize.Level0) -{ - ItFsJffs214(); -} - -/* * - * @tc.name: ItFsJffs215 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs215, TestSize.Level0) -{ - ItFsJffs215(); -} - -/* * - * @tc.name: ItFsJffs216 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs216, TestSize.Level0) -{ - ItFsJffs216(); -} - -/* * - * @tc.name: ItFsJffs217 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs217, TestSize.Level0) -{ - ItFsJffs217(); -} - -/* * - * @tc.name: ItFsJffs218 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs218, TestSize.Level0) -{ - ItFsJffs218(); -} - -/* * - * @tc.name: ItFsJffs219 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs219, TestSize.Level0) -{ - ItFsJffs219(); -} - -/* * - * @tc.name: ItFsJffs220 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs220, TestSize.Level0) -{ - ItFsJffs220(); -} - -/* * - * @tc.name: ItFsJffs221 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs221, TestSize.Level0) -{ - ItFsJffs221(); -} - -/* * - * @tc.name: ItFsJffs222 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs222, TestSize.Level0) -{ - ItFsJffs222(); -} - -/* * - * @tc.name: ItFsJffs223 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs223, TestSize.Level0) -{ - ItFsJffs223(); -} - -/* * - * @tc.name: ItFsJffs224 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs224, TestSize.Level0) -{ - ItFsJffs224(); -} - -/* * - * @tc.name: ItFsJffs225 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs225, TestSize.Level0) -{ - ItFsJffs225(); -} - -/* * - * @tc.name: ItFsJffs226 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs226, TestSize.Level0) -{ - ItFsJffs226(); -} - -/* * - * @tc.name: ItFsJffs227 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs227, TestSize.Level0) -{ - ItFsJffs227(); -} - -/* * - * @tc.name: ItFsJffs228 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs228, TestSize.Level0) -{ - ItFsJffs228(); -} - -/* * - * @tc.name: ItFsJffs229 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs229, TestSize.Level0) -{ - ItFsJffs229(); -} - -/* * - * @tc.name: ItFsJffs230 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs230, TestSize.Level0) -{ - ItFsJffs230(); -} - -/* * - * @tc.name: ItFsJffs231 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs231, TestSize.Level0) -{ - ItFsJffs231(); -} - -/* * - * @tc.name: ItFsJffs232 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs232, TestSize.Level0) -{ - ItFsJffs232(); -} - -/* * - * @tc.name: ItFsJffs233 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs233, TestSize.Level0) -{ - ItFsJffs233(); -} - -/* * - * @tc.name: ItFsJffs234 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs234, TestSize.Level0) -{ - ItFsJffs234(); -} - -/* * - * @tc.name: ItFsJffs235 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs235, TestSize.Level0) -{ - ItFsJffs235(); -} - -/* * - * @tc.name: ItFsJffs236 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs236, TestSize.Level0) -{ - ItFsJffs236(); -} - -/* * - * @tc.name: ItFsJffs237 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs237, TestSize.Level0) -{ - ItFsJffs237(); -} - -/* * - * @tc.name: ItFsJffs238 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs238, TestSize.Level0) -{ - ItFsJffs238(); -} - -/* * - * @tc.name: ItFsJffs239 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs239, TestSize.Level0) -{ - ItFsJffs239(); -} - -/* * - * @tc.name: ItFsJffs240 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs240, TestSize.Level0) -{ - ItFsJffs240(); -} - -/* * - * @tc.name: ItFsJffs241 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs241, TestSize.Level0) -{ - ItFsJffs241(); -} - -/* * - * @tc.name: ItFsJffs242 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs242, TestSize.Level0) -{ - ItFsJffs242(); -} - -/* * - * @tc.name: ItFsJffs243 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs243, TestSize.Level0) -{ - ItFsJffs243(); -} - -/* * - * @tc.name: ItFsJffs244 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs244, TestSize.Level0) -{ - ItFsJffs244(); -} - -/* * - * @tc.name: ItFsJffs245 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs245, TestSize.Level0) -{ - ItFsJffs245(); -} - -/* * - * @tc.name: ItFsJffs246 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs246, TestSize.Level0) -{ - ItFsJffs246(); -} - -/* * - * @tc.name: ItFsJffs247 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs247, TestSize.Level0) -{ - ItFsJffs247(); -} - -/* * - * @tc.name: ItFsJffs248 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs248, TestSize.Level0) -{ - ItFsJffs248(); -} - -/* * - * @tc.name: ItFsJffs249 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs249, TestSize.Level0) -{ - ItFsJffs249(); -} - -/* * - * @tc.name: ItFsJffs250 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs250, TestSize.Level0) -{ - ItFsJffs250(); -} - -/* * - * @tc.name: ItFsJffs251 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs251, TestSize.Level0) -{ - ItFsJffs251(); -} - -/* * - * @tc.name: ItFsJffs252 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs252, TestSize.Level0) -{ - ItFsJffs252(); -} - -/* * - * @tc.name: ItFsJffs253 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs253, TestSize.Level0) -{ - ItFsJffs253(); -} - -/* * - * @tc.name: ItFsJffs254 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs254, TestSize.Level0) -{ - ItFsJffs254(); -} - -/* * - * @tc.name: ItFsJffs255 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs255, TestSize.Level0) -{ - ItFsJffs255(); -} - -/* * - * @tc.name: ItFsJffs256 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs256, TestSize.Level0) -{ - ItFsJffs256(); -} - -/* * - * @tc.name: ItFsJffs257 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs257, TestSize.Level0) -{ - ItFsJffs257(); -} - -/* * - * @tc.name: ItFsJffs258 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs258, TestSize.Level0) -{ - ItFsJffs258(); -} - -/* * - * @tc.name: ItFsJffs259 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs259, TestSize.Level0) -{ - ItFsJffs259(); -} - -/* * - * @tc.name: ItFsJffs260 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs260, TestSize.Level0) -{ - ItFsJffs260(); -} - -/* * - * @tc.name: ItFsJffs261 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs261, TestSize.Level0) -{ - ItFsJffs261(); -} - -/* * - * @tc.name: ItFsJffs262 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs262, TestSize.Level0) -{ - ItFsJffs262(); -} - -/* * - * @tc.name: ItFsJffs263 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs263, TestSize.Level0) -{ - ItFsJffs263(); -} - -/* * - * @tc.name: ItFsJffs264 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs264, TestSize.Level0) -{ - ItFsJffs264(); -} - -/* * - * @tc.name: ItFsJffs265 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs265, TestSize.Level0) -{ - ItFsJffs265(); -} - -/* * - * @tc.name: ItFsJffs266 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs266, TestSize.Level0) -{ - ItFsJffs266(); -} - -/* * - * @tc.name: ItFsJffs267 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs267, TestSize.Level0) -{ - ItFsJffs267(); -} - -/* * - * @tc.name: ItFsJffs268 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs268, TestSize.Level0) -{ - ItFsJffs268(); -} - -/* * - * @tc.name: ItFsJffs269 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs269, TestSize.Level0) -{ - ItFsJffs269(); -} - -/* * - * @tc.name: ItFsJffs270 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs270, TestSize.Level0) -{ - ItFsJffs270(); -} - -/* * - * @tc.name: ItFsJffs271 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs271, TestSize.Level0) -{ - ItFsJffs271(); -} - -/* * - * @tc.name: ItFsJffs272 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs272, TestSize.Level0) -{ - ItFsJffs272(); -} - -/* * - * @tc.name: ItFsJffs273 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs273, TestSize.Level0) -{ - ItFsJffs273(); -} - -/* * - * @tc.name: ItFsJffs274 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs274, TestSize.Level0) -{ - ItFsJffs274(); -} - -/* * - * @tc.name: ItFsJffs275 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs275, TestSize.Level0) -{ - ItFsJffs275(); -} - -/* * - * @tc.name: ItFsJffs276 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs276, TestSize.Level0) -{ - ItFsJffs276(); -} - -/* * - * @tc.name: ItFsJffs277 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs277, TestSize.Level0) -{ - ItFsJffs277(); -} - -/* * - * @tc.name: ItFsJffs278 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs278, TestSize.Level0) -{ - ItFsJffs278(); -} - -/* * - * @tc.name: ItFsJffs279 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs279, TestSize.Level0) -{ - ItFsJffs279(); -} - -/* * - * @tc.name: ItFsJffs280 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs280, TestSize.Level0) -{ - ItFsJffs280(); -} - -/* * - * @tc.name: ItFsJffs281 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs281, TestSize.Level0) -{ - ItFsJffs281(); -} - -/* * - * @tc.name: ItFsJffs282 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs282, TestSize.Level0) -{ - ItFsJffs282(); -} - -/* * - * @tc.name: ItFsJffs283 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs283, TestSize.Level0) -{ - ItFsJffs283(); -} - -/* * - * @tc.name: ItFsJffs284 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs284, TestSize.Level0) -{ - ItFsJffs284(); -} - -/* * - * @tc.name: ItFsJffs285 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs285, TestSize.Level0) -{ - ItFsJffs285(); -} - -/* * - * @tc.name: ItFsJffs288 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs288, TestSize.Level0) -{ - ItFsJffs288(); -} - -/* * - * @tc.name: ItFsJffs289 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs289, TestSize.Level0) -{ - ItFsJffs289(); -} - -/* * - * @tc.name: ItFsJffs290 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs290, TestSize.Level0) -{ - ItFsJffs290(); -} - -/* * - * @tc.name: ItFsJffs291 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs291, TestSize.Level0) -{ - ItFsJffs291(); -} - -/* * - * @tc.name: ItFsJffs292 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs292, TestSize.Level0) -{ - ItFsJffs292(); -} - -/* * - * @tc.name: ItFsJffs293 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs293, TestSize.Level0) -{ - ItFsJffs293(); -} - -/* * - * @tc.name: ItFsJffs294 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs294, TestSize.Level0) -{ - ItFsJffs294(); -} - -/* * - * @tc.name: ItFsJffs295 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs295, TestSize.Level0) -{ - ItFsJffs295(); -} - -/* * - * @tc.name: ItFsJffs296 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs296, TestSize.Level0) -{ - ItFsJffs296(); -} - -/* * - * @tc.name: ItFsJffs297 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs297, TestSize.Level0) -{ - ItFsJffs297(); -} - -/* * - * @tc.name: ItFsJffs298 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs298, TestSize.Level0) -{ - ItFsJffs298(); -} - -/* * - * @tc.name: ItFsJffs299 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs299, TestSize.Level0) -{ - ItFsJffs299(); -} - -/* * - * @tc.name: ItFsJffs300 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs300, TestSize.Level0) -{ - ItFsJffs300(); -} - -/* * - * @tc.name: ItFsJffs301 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs301, TestSize.Level0) -{ - ItFsJffs301(); -} - -/* * - * @tc.name: ItFsJffs302 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs302, TestSize.Level0) -{ - ItFsJffs302(); -} - -/* * - * @tc.name: ItFsJffs303 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs303, TestSize.Level0) -{ - ItFsJffs303(); -} - -/* * - * @tc.name: ItFsJffs304 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs304, TestSize.Level0) -{ - ItFsJffs304(); -} - -/* * - * @tc.name: ItFsJffs305 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs305, TestSize.Level0) -{ - ItFsJffs305(); -} - -/* * - * @tc.name: ItFsJffs306 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs306, TestSize.Level0) -{ - ItFsJffs306(); -} - -/* * - * @tc.name: ItFsJffs307 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs307, TestSize.Level0) -{ - ItFsJffs307(); -} - -/* * - * @tc.name: ItFsJffs308 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs308, TestSize.Level0) -{ - ItFsJffs308(); -} - -/* * - * @tc.name: ItFsJffs309 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs309, TestSize.Level0) -{ - ItFsJffs309(); -} - -/* * - * @tc.name: ItFsJffs310 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs310, TestSize.Level0) -{ - ItFsJffs310(); -} - -/* * - * @tc.name: ItFsJffs311 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs311, TestSize.Level0) -{ - ItFsJffs311(); -} - -/* * - * @tc.name: ItFsJffs312 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs312, TestSize.Level0) -{ - ItFsJffs312(); -} - -/* * - * @tc.name: ItFsJffs313 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs313, TestSize.Level0) -{ - ItFsJffs313(); -} - -/* * - * @tc.name: ItFsJffs314 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs314, TestSize.Level0) -{ - ItFsJffs314(); -} - -/* * - * @tc.name: ItFsJffs315 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs315, TestSize.Level0) -{ - ItFsJffs315(); -} - -/* * - * @tc.name: ItFsJffs316 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs316, TestSize.Level0) -{ - ItFsJffs316(); -} - -/* * - * @tc.name: ItFsJffs317 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs317, TestSize.Level0) -{ - ItFsJffs317(); -} - -/* * - * @tc.name: ItFsJffs318 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs318, TestSize.Level0) -{ - ItFsJffs318(); -} - -/* * - * @tc.name: ItFsJffs319 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs319, TestSize.Level0) -{ - ItFsJffs319(); -} - -/* * - * @tc.name: ItFsJffs320 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs320, TestSize.Level0) -{ - ItFsJffs320(); -} - -/* * - * @tc.name: ItFsJffs321 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs321, TestSize.Level0) -{ - ItFsJffs321(); -} - -/* * - * @tc.name: ItFsJffs322 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs322, TestSize.Level0) -{ - ItFsJffs322(); -} - -/* * - * @tc.name: ItFsJffs323 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs323, TestSize.Level0) -{ - ItFsJffs323(); -} - -/* * - * @tc.name: ItFsJffs324 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs324, TestSize.Level0) -{ - ItFsJffs324(); -} - -/* * - * @tc.name: ItFsJffs325 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs325, TestSize.Level0) -{ - ItFsJffs325(); -} - -/* * - * @tc.name: ItFsJffs326 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs326, TestSize.Level0) -{ - ItFsJffs326(); -} - -/* * - * @tc.name: ItFsJffs327 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs327, TestSize.Level0) -{ - ItFsJffs327(); -} - -/* * - * @tc.name: ItFsJffs328 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs328, TestSize.Level0) -{ - ItFsJffs328(); -} - -/* * - * @tc.name: ItFsJffs329 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs329, TestSize.Level0) -{ - ItFsJffs329(); -} - -/* * - * @tc.name: ItFsJffs330 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs330, TestSize.Level0) -{ - ItFsJffs330(); -} - -/* * - * @tc.name: ItFsJffs331 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs331, TestSize.Level0) -{ - ItFsJffs331(); -} - -/* * - * @tc.name: ItFsJffs332 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs332, TestSize.Level0) -{ - ItFsJffs332(); -} - -/* * - * @tc.name: ItFsJffs333 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs333, TestSize.Level0) -{ - ItFsJffs333(); -} - -/* * - * @tc.name: ItFsJffs334 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs334, TestSize.Level0) -{ - ItFsJffs334(); -} - -/* * - * @tc.name: ItFsJffs335 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs335, TestSize.Level0) -{ - ItFsJffs335(); -} - -/* * - * @tc.name: ItFsJffs336 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs336, TestSize.Level0) -{ - ItFsJffs336(); -} - -/* * - * @tc.name: ItFsJffs337 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs337, TestSize.Level0) -{ - ItFsJffs337(); -} - -/* * - * @tc.name: ItFsJffs338 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs338, TestSize.Level0) -{ - ItFsJffs338(); -} - -/* * - * @tc.name: ItFsJffs339 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs339, TestSize.Level0) -{ - ItFsJffs339(); -} - -/* * - * @tc.name: ItFsJffs340 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs340, TestSize.Level0) -{ - ItFsJffs340(); -} - -/* * - * @tc.name: ItFsJffs342 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs342, TestSize.Level0) -{ - ItFsJffs342(); -} - -/* * - * @tc.name: ItFsJffs343 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs343, TestSize.Level0) -{ - ItFsJffs343(); -} - -/* * - * @tc.name: ItFsJffs344 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs344, TestSize.Level0) -{ - ItFsJffs344(); -} - -/* * - * @tc.name: ItFsJffs346 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs346, TestSize.Level0) -{ - ItFsJffs346(); -} - -/* * - * @tc.name: ItFsJffs352 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs352, TestSize.Level0) -{ - ItFsJffs352(); -} - -/* * - * @tc.name: ItFsJffs353 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs353, TestSize.Level0) -{ - ItFsJffs353(); -} - -/* * - * @tc.name: ItFsJffs354 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs354, TestSize.Level0) -{ - ItFsJffs354(); -} - -/* * - * @tc.name: ItFsJffs355 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs355, TestSize.Level0) -{ - ItFsJffs355(); -} - -/* * - * @tc.name: ItFsJffs356 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs356, TestSize.Level0) -{ - ItFsJffs356(); -} - -/* * - * @tc.name: ItFsJffs357 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs357, TestSize.Level0) -{ - ItFsJffs357(); -} - -/* * - * @tc.name: ItFsJffs358 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs358, TestSize.Level0) -{ - ItFsJffs358(); -} - -/* * - * @tc.name: ItFsJffs359 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs359, TestSize.Level0) -{ - ItFsJffs359(); -} - -/* * - * @tc.name: ItFsJffs360 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs360, TestSize.Level0) -{ - ItFsJffs360(); -} - -/* * - * @tc.name: ItFsJffs361 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs361, TestSize.Level0) -{ - ItFsJffs361(); -} - -/* * - * @tc.name: ItFsJffs362 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs362, TestSize.Level0) -{ - ItFsJffs362(); -} - -/* * - * @tc.name: ItFsJffs364 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs364, TestSize.Level0) -{ - ItFsJffs364(); -} - -/* * - * @tc.name: ItFsJffs365 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs365, TestSize.Level0) -{ - ItFsJffs365(); -} - -/* * - * @tc.name: ItFsJffs366 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs366, TestSize.Level0) -{ - ItFsJffs366(); -} - -/* * - * @tc.name: ItFsJffs367 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs367, TestSize.Level0) -{ - ItFsJffs367(); -} - -/* * - * @tc.name: ItFsJffs368 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs368, TestSize.Level0) -{ - ItFsJffs368(); -} - -/* * - * @tc.name: ItFsJffs369 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs369, TestSize.Level0) -{ - ItFsJffs369(); -} - -/* * - * @tc.name: ItFsJffs370 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs370, TestSize.Level0) -{ - ItFsJffs370(); -} - -/* * - * @tc.name: ItFsJffs371 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs371, TestSize.Level0) -{ - ItFsJffs371(); -} - -/* * - * @tc.name: ItFsJffs372 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs372, TestSize.Level0) -{ - ItFsJffs372(); -} - -/* * - * @tc.name: ItFsJffs373 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs373, TestSize.Level0) -{ - ItFsJffs373(); -} - -/* * - * @tc.name: ItFsJffs374 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs374, TestSize.Level0) -{ - ItFsJffs374(); -} - -/* * - * @tc.name: ItFsJffs375 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs375, TestSize.Level0) -{ - ItFsJffs375(); -} - -/* * - * @tc.name: ItFsJffs376 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs376, TestSize.Level0) -{ - ItFsJffs376(); -} - -/* * - * @tc.name: ItFsJffs377 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs377, TestSize.Level0) -{ - ItFsJffs377(); -} - -/* * - * @tc.name: ItFsJffs378 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs378, TestSize.Level0) -{ - ItFsJffs378(); -} - -/* * - * @tc.name: ItFsJffs379 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs379, TestSize.Level0) -{ - ItFsJffs379(); -} - -/* * - * @tc.name: ItFsJffs380 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs380, TestSize.Level0) -{ - ItFsJffs380(); -} - -/* * - * @tc.name: ItFsJffs381 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs381, TestSize.Level0) -{ - ItFsJffs381(); -} - -/* * - * @tc.name: ItFsJffs382 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs382, TestSize.Level0) -{ - ItFsJffs382(); -} - -/* * - * @tc.name: ItFsJffs383 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs383, TestSize.Level0) -{ - ItFsJffs383(); -} - -/* * - * @tc.name: ItFsJffs384 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs384, TestSize.Level0) -{ - ItFsJffs384(); -} - -/* * - * @tc.name: ItFsJffs385 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs385, TestSize.Level0) -{ - ItFsJffs385(); -} - -/* * - * @tc.name: ItFsJffs386 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs386, TestSize.Level0) -{ - ItFsJffs386(); -} - -/* * - * @tc.name: ItFsJffs387 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs387, TestSize.Level0) -{ - ItFsJffs387(); -} - -/* * - * @tc.name: ItFsJffs388 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs388, TestSize.Level0) -{ - ItFsJffs388(); -} - -/* * - * @tc.name: ItFsJffs389 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs389, TestSize.Level0) -{ - ItFsJffs389(); -} - -/* * - * @tc.name: ItFsJffs390 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs390, TestSize.Level0) -{ - ItFsJffs390(); -} - -/* * - * @tc.name: ItFsJffs391 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs391, TestSize.Level0) -{ - ItFsJffs391(); -} - -/* * - * @tc.name: ItFsJffs392 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs392, TestSize.Level0) -{ - ItFsJffs392(); -} - -/* * - * @tc.name: ItFsJffs393 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs393, TestSize.Level0) -{ - ItFsJffs393(); -} - -/* * - * @tc.name: ItFsJffs394 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs394, TestSize.Level0) -{ - ItFsJffs394(); -} - -/* * - * @tc.name: ItFsJffs395 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs395, TestSize.Level0) -{ - ItFsJffs395(); -} - -/* * - * @tc.name: ItFsJffs396 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs396, TestSize.Level0) -{ - ItFsJffs396(); -} - -/* * - * @tc.name: ItFsJffs397 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs397, TestSize.Level0) -{ - ItFsJffs397(); -} - -/* * - * @tc.name: ItFsJffs398 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs398, TestSize.Level0) -{ - ItFsJffs398(); -} - -/* * - * @tc.name: ItFsJffs399 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs399, TestSize.Level0) -{ - ItFsJffs399(); -} - -/* * - * @tc.name: ItFsJffs400 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs400, TestSize.Level0) -{ - ItFsJffs400(); -} - -/* * - * @tc.name: ItFsJffs401 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs401, TestSize.Level0) -{ - ItFsJffs401(); -} - -/* * - * @tc.name: ItFsJffs402 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs402, TestSize.Level0) -{ - ItFsJffs402(); -} - -/* * - * @tc.name: ItFsJffs403 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs403, TestSize.Level0) -{ - ItFsJffs403(); -} - -/* * - * @tc.name: ItFsJffs404 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs404, TestSize.Level0) -{ - ItFsJffs404(); -} - -/* * - * @tc.name: ItFsJffs405 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs405, TestSize.Level0) -{ - ItFsJffs405(); -} - -/* * - * @tc.name: ItFsJffs406 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs406, TestSize.Level0) -{ - ItFsJffs406(); -} - -/* * - * @tc.name: ItFsJffs407 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs407, TestSize.Level0) -{ - ItFsJffs407(); -} - -/* * - * @tc.name: ItFsJffs408 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs408, TestSize.Level0) -{ - ItFsJffs408(); -} - -/* * - * @tc.name: ItFsJffs409 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs409, TestSize.Level0) -{ - ItFsJffs409(); -} - -/* * - * @tc.name: ItFsJffs410 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs410, TestSize.Level0) -{ - ItFsJffs410(); -} - -/* * - * @tc.name: ItFsJffs411 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs411, TestSize.Level0) -{ - ItFsJffs411(); -} - -/* * - * @tc.name: ItFsJffs412 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs412, TestSize.Level0) -{ - ItFsJffs412(); -} - -/* * - * @tc.name: ItFsJffs413 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs413, TestSize.Level0) -{ - ItFsJffs413(); -} - -/* * - * @tc.name: ItFsJffs414 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs414, TestSize.Level0) -{ - ItFsJffs414(); -} - -/* * - * @tc.name: ItFsJffs415 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs415, TestSize.Level0) -{ - ItFsJffs415(); -} - -/* * - * @tc.name: ItFsJffs416 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs416, TestSize.Level0) -{ - ItFsJffs416(); -} - -/* * - * @tc.name: ItFsJffs417 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs417, TestSize.Level0) -{ - ItFsJffs417(); -} - -/* * - * @tc.name: ItFsJffs418 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs418, TestSize.Level0) -{ - ItFsJffs418(); -} - -/* * - * @tc.name: ItFsJffs419 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs419, TestSize.Level0) -{ - ItFsJffs419(); -} - -/* * - * @tc.name: ItFsJffs420 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs420, TestSize.Level0) -{ - ItFsJffs420(); -} - -/* * - * @tc.name: ItFsJffs421 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs421, TestSize.Level0) -{ - ItFsJffs421(); -} - -/* * - * @tc.name: ItFsJffs422 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs422, TestSize.Level0) -{ - ItFsJffs422(); -} - -/* * - * @tc.name: ItFsJffs423 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs423, TestSize.Level0) -{ - ItFsJffs423(); -} - -/* * - * @tc.name: ItFsJffs424 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs424, TestSize.Level0) -{ - ItFsJffs424(); -} - -/* * - * @tc.name: ItFsJffs425 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs425, TestSize.Level0) -{ - ItFsJffs425(); -} - -/* * - * @tc.name: ItFsJffs426 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs426, TestSize.Level0) -{ - ItFsJffs426(); -} - -/* * - * @tc.name: ItFsJffs427 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs427, TestSize.Level0) -{ - ItFsJffs427(); -} - -/* * - * @tc.name: ItFsJffs428 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs428, TestSize.Level0) -{ - ItFsJffs428(); -} - -/* * - * @tc.name: ItFsJffs429 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs429, TestSize.Level0) -{ - ItFsJffs429(); -} - -/* * - * @tc.name: ItFsJffs430 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs430, TestSize.Level0) -{ - ItFsJffs430(); -} - -/* * - * @tc.name: ItFsJffs431 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs431, TestSize.Level0) -{ - ItFsJffs431(); -} - -/* * - * @tc.name: ItFsJffs432 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs432, TestSize.Level0) -{ - ItFsJffs432(); -} - -/* * - * @tc.name: ItFsJffs433 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs433, TestSize.Level0) -{ - ItFsJffs433(); -} - -/* * - * @tc.name: ItFsJffs434 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs434, TestSize.Level0) -{ - ItFsJffs434(); -} - -/* * - * @tc.name: ItFsJffs435 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs435, TestSize.Level0) -{ - ItFsJffs435(); -} - -/* * - * @tc.name: ItFsJffs454 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs454, TestSize.Level0) -{ - ItFsJffs454(); -} - -/* * - * @tc.name: ItFsJffs455 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs455, TestSize.Level0) -{ - ItFsJffs455(); -} - -/* * - * @tc.name: ItFsJffs456 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs456, TestSize.Level0) -{ - ItFsJffs456(); -} - -/* * - * @tc.name: ItFsJffs457 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs457, TestSize.Level0) -{ - ItFsJffs457(); -} - -/* * - * @tc.name: ItFsJffs458 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs458, TestSize.Level0) -{ - ItFsJffs458(); -} - -/* * - * @tc.name: ItFsJffs459 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs459, TestSize.Level0) -{ - ItFsJffs459(); -} - -/* * - * @tc.name: ItFsJffs460 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs460, TestSize.Level0) -{ - ItFsJffs460(); -} - -/* * - * @tc.name: ItFsJffs461 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs461, TestSize.Level0) -{ - ItFsJffs461(); -} - -/* * - * @tc.name: ItFsJffs462 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs462, TestSize.Level0) -{ - ItFsJffs462(); -} - -/* * - * @tc.name: ItFsJffs487 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs487, TestSize.Level0) -{ - ItFsJffs487(); -} - -/* * - * @tc.name: ItFsJffs488 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs488, TestSize.Level0) -{ - ItFsJffs488(); -} - -/* * - * @tc.name: ItFsJffs489 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs489, TestSize.Level0) -{ - ItFsJffs489(); -} - -/* * - * @tc.name: ItFsJffs490 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs490, TestSize.Level0) -{ - ItFsJffs490(); -} - -/* * - * @tc.name: ItFsJffs491 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs491, TestSize.Level0) -{ - ItFsJffs491(); -} - -/* * - * @tc.name: ItFsJffs492 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs492, TestSize.Level0) -{ - ItFsJffs492(); -} - -/* * - * @tc.name: ItFsJffs493 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs493, TestSize.Level0) -{ - ItFsJffs493(); -} - -/* * - * @tc.name: ItFsJffs494 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs494, TestSize.Level0) -{ - ItFsJffs494(); -} - -/* * - * @tc.name: ItFsJffs496 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs496, TestSize.Level0) -{ - ItFsJffs496(); -} - -/* * - * @tc.name: ItFsJffs497 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs497, TestSize.Level0) -{ - ItFsJffs497(); -} - -/* * - * @tc.name: ItFsJffs498 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs498, TestSize.Level0) -{ - ItFsJffs498(); -} - -/* * - * @tc.name: ItFsJffs499 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs499, TestSize.Level0) -{ - ItFsJffs499(); -} - -/* * - * @tc.name: ItFsJffs500 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs500, TestSize.Level0) -{ - ItFsJffs500(); -} - -/* * - * @tc.name: ItFsJffs501 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs501, TestSize.Level0) -{ - ItFsJffs501(); -} - -/* * - * @tc.name: ItFsJffs502 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs502, TestSize.Level0) -{ - ItFsJffs502(); -} - -/* * - * @tc.name: ItFsJffs503 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs503, TestSize.Level0) -{ - ItFsJffs503(); -} - -/* * - * @tc.name: ItFsJffs504 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs504, TestSize.Level0) -{ - ItFsJffs504(); -} - -/* * - * @tc.name: ItFsJffs505 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs505, TestSize.Level0) -{ - ItFsJffs505(); -} - -/* * - * @tc.name: ItFsJffs506 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs506, TestSize.Level0) -{ - ItFsJffs506(); -} - -/* * - * @tc.name: ItFsJffs507 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs507, TestSize.Level0) -{ - ItFsJffs507(); -} - -/* * - * @tc.name: ItFsJffs508 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs508, TestSize.Level0) -{ - ItFsJffs508(); -} - -/* * - * @tc.name: ItFsJffs509 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs509, TestSize.Level0) -{ - ItFsJffs509(); -} - -/* * - * @tc.name: ItFsJffs510 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs510, TestSize.Level0) -{ - ItFsJffs510(); -} - -/* * - * @tc.name: ItFsJffs511 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs511, TestSize.Level0) -{ - ItFsJffs511(); -} - -/* * - * @tc.name: ItFsJffs512 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs512, TestSize.Level0) -{ - ItFsJffs512(); -} - -/* * - * @tc.name: ItFsJffs513 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs513, TestSize.Level0) -{ - ItFsJffs513(); -} - -/* * - * @tc.name: ItFsJffs514 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs514, TestSize.Level0) -{ - ItFsJffs514(); -} - -/* * - * @tc.name: ItFsJffs515 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs515, TestSize.Level0) -{ - ItFsJffs515(); -} - -/* * - * @tc.name: ItFsJffs516 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs516, TestSize.Level0) -{ - ItFsJffs516(); -} - -/* * - * @tc.name: ItFsJffs517 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs517, TestSize.Level0) -{ - ItFsJffs517(); -} - -/* * - * @tc.name: ItFsJffs518 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs518, TestSize.Level0) -{ - ItFsJffs518(); -} - -/* * - * @tc.name: ItFsJffs519 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs519, TestSize.Level0) -{ - ItFsJffs519(); -} - -/* * - * @tc.name: ItFsJffs520 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs520, TestSize.Level0) -{ - ItFsJffs520(); -} - -/* * - * @tc.name: ItFsJffs521 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs521, TestSize.Level0) -{ - ItFsJffs521(); -} - -/* * - * @tc.name: ItFsJffs522 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs522, TestSize.Level0) -{ - ItFsJffs522(); -} - -/* * - * @tc.name: ItFsJffs523 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs523, TestSize.Level0) -{ - ItFsJffs523(); -} - -/* * - * @tc.name: ItFsJffs524 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs524, TestSize.Level0) -{ - ItFsJffs524(); -} - -/* * - * @tc.name: ItFsJffs526 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs526, TestSize.Level0) -{ - ItFsJffs526(); -} - -/* * - * @tc.name: ItFsJffs528 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs528, TestSize.Level0) -{ - ItFsJffs528(); -} - -/* * - * @tc.name: ItFsJffs529 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs529, TestSize.Level0) -{ - ItFsJffs529(); -} - -/* * - * @tc.name: ItFsJffs530 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs530, TestSize.Level0) -{ - ItFsJffs530(); -} - -/* * - * @tc.name: ItFsJffs531 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs531, TestSize.Level0) -{ - ItFsJffs531(); -} - -/* * - * @tc.name: ItFsJffs532 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs532, TestSize.Level0) -{ - ItFsJffs532(); -} - -/* * - * @tc.name: ItFsJffs533 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs533, TestSize.Level0) -{ - ItFsJffs533(); -} - -/* * - * @tc.name: ItFsJffs534 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs534, TestSize.Level0) -{ - ItFsJffs534(); -} - -/* * - * @tc.name: ItFsJffs541 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs541, TestSize.Level0) -{ - ItFsJffs541(); -} - -/* * - * @tc.name: ItFsJffs542 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs542, TestSize.Level0) -{ - ItFsJffs542(); -} - -/* * - * @tc.name: ItFsJffs543 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs543, TestSize.Level0) -{ - ItFsJffs543(); -} - -/* * - * @tc.name: ItFsJffs544 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs544, TestSize.Level0) -{ - ItFsJffs544(); -} - -/* * - * @tc.name: ItFsJffs545 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs545, TestSize.Level0) -{ - ItFsJffs545(); -} - -/* * - * @tc.name: ItFsJffs546 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs546, TestSize.Level0) -{ - ItFsJffs546(); -} - -/* * - * @tc.name: ItFsJffs547 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs547, TestSize.Level0) -{ - ItFsJffs547(); -} - -/* * - * @tc.name: ItFsJffs548 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs548, TestSize.Level0) -{ - ItFsJffs548(); -} - -/* * - * @tc.name: ItFsJffs549 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs549, TestSize.Level0) -{ - ItFsJffs549(); -} - -/* * - * @tc.name: ItFsJffs550 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs550, TestSize.Level0) -{ - ItFsJffs550(); -} - -/* * - * @tc.name: ItFsJffs551 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs551, TestSize.Level0) -{ - ItFsJffs551(); -} - -/* * - * @tc.name: ItFsJffs552 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs552, TestSize.Level0) -{ - ItFsJffs552(); -} - -/* * - * @tc.name: ItFsJffs553 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs553, TestSize.Level0) -{ - ItFsJffs553(); -} - -/* * - * @tc.name: ItFsJffs554 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs554, TestSize.Level0) -{ - ItFsJffs554(); -} - -/* * - * @tc.name: ItFsJffs555 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs555, TestSize.Level0) -{ - ItFsJffs555(); -} - -/* * - * @tc.name: ItFsJffs556 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs556, TestSize.Level0) -{ - ItFsJffs556(); -} - -/* * - * @tc.name: ItFsJffs557 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs557, TestSize.Level0) -{ - ItFsJffs557(); -} - -/* * - * @tc.name: ItFsJffs560 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs560, TestSize.Level0) -{ - ItFsJffs560(); -} - -/* * - * @tc.name: ItFsJffs562 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs562, TestSize.Level0) -{ - ItFsJffs562(); -} - -/* * - * @tc.name: ItFsJffs563 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs563, TestSize.Level0) -{ - ItFsJffs563(); -} - -/* * - * @tc.name: ItFsJffs564 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs564, TestSize.Level0) -{ - ItFsJffs564(); -} - -/* * - * @tc.name: ItFsJffs565 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs565, TestSize.Level0) -{ - ItFsJffs565(); -} - -/* * - * @tc.name: ItFsJffs566 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs566, TestSize.Level0) -{ - ItFsJffs566(); -} - -/* * - * @tc.name: ItFsJffs567 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs567, TestSize.Level0) -{ - ItFsJffs567(); -} - -/* * - * @tc.name: ItFsJffs568 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs568, TestSize.Level0) -{ - ItFsJffs568(); -} - -/* * - * @tc.name: ItFsJffs569 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs569, TestSize.Level0) -{ - ItFsJffs569(); // the second param in stat64 is NULL -} - -/* * - * @tc.name: ItFsJffs570 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs570, TestSize.Level0) -{ - ItFsJffs570(); // the second param in stat64 is NULL -} - -/* * - * @tc.name: ItFsJffs571 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs571, TestSize.Level0) -{ - ItFsJffs571(); -} - -/* * - * @tc.name: ItFsJffs572 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs572, TestSize.Level0) -{ - ItFsJffs572(); // the second param in fstat64 is NULL -} - -/* * - * @tc.name: ItFsJffs573 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs573, TestSize.Level0) -{ - ItFsJffs573(); // the second param in fstat64 is NULL -} - -/* * - * @tc.name: ItFsJffs574 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs574, TestSize.Level0) -{ - ItFsJffs574(); -} - -/* * - * @tc.name: ItFsJffs124 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs124, TestSize.Level0) -{ - ItFsJffs124(); -} - -/* * - * @tc.name: ItFsJffs125 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs125, TestSize.Level0) -{ - ItFsJffs125(); -} - -/* * - * @tc.name: ItFsJffs583 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs583, TestSize.Level0) -{ - ItFsJffs583(); -} - -/* * - * @tc.name: ItFsJffs584 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs584, TestSize.Level0) -{ - ItFsJffs584(); -} - -/* * - * @tc.name: ItFsJffs586 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs586, TestSize.Level0) -{ - ItFsJffs586(); -} - -/* * - * @tc.name: ItFsJffs589 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs589, TestSize.Level0) -{ - ItFsJffs589(); -} - -/* * - * @tc.name: ItFsJffs591 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs591, TestSize.Level0) -{ - ItFsJffs591(); -} - -/* * - * @tc.name: ItFsJffs592 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs592, TestSize.Level0) -{ - ItFsJffs592(); -} - -/* * - * @tc.name: ItFsJffs593 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs593, TestSize.Level0) -{ - ItFsJffs593(); -} - -/* * - * @tc.name: ItFsJffs594 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs594, TestSize.Level0) -{ - ItFsJffs594(); -} - -/* * - * @tc.name: ItFsJffs595 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs595, TestSize.Level0) -{ - ItFsJffs595(); -} - -/* * - * @tc.name: ItFsJffs596 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs596, TestSize.Level0) -{ - ItFsJffs596(); -} - -/* * - * @tc.name: ItFsJffs603 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs603, TestSize.Level0) -{ - ItFsJffs603(); -} - -/* * - * @tc.name: ItFsJffs636 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs636, TestSize.Level0) -{ - ItFsJffs636(); -} - -/* * - * @tc.name: ItFsJffs643 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs643, TestSize.Level0) -{ - ItFsJffs643(); -} - -/* * - * @tc.name: ItFsJffs644 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs644, TestSize.Level0) -{ - ItFsJffs644(); -} - -/* * - * @tc.name: ItFsJffs645 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs645, TestSize.Level0) -{ - ItFsJffs645(); -} - -/* * - * @tc.name: ItFsJffs646 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs646, TestSize.Level0) -{ - ItFsJffs646(); -} - -/* * - * @tc.name: ItFsJffs648 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs648, TestSize.Level0) -{ - ItFsJffs648(); -} - -/* * - * @tc.name: ItFsJffs649 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs649, TestSize.Level0) -{ - ItFsJffs649(); -} - -/* * - * @tc.name: ItFsJffs650 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs650, TestSize.Level0) -{ - ItFsJffs650(); -} - -/* * - * @tc.name: ItFsJffs651 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs651, TestSize.Level0) -{ - ItFsJffs651(); -} - -/* * - * @tc.name: ItFsJffs652 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs652, TestSize.Level0) -{ - ItFsJffs652(); -} - -/* * - * @tc.name: ItFsJffs653 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs653, TestSize.Level0) -{ - ItFsJffs653(); -} - -/* * - * @tc.name: ItFsJffs654 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs654, TestSize.Level0) -{ - ItFsJffs654(); -} - -/* * - * @tc.name: ItFsJffs655 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs655, TestSize.Level0) -{ - ItFsJffs655(); -} - -/* * - * @tc.name: ItFsJffs656 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs656, TestSize.Level0) -{ - ItFsJffs656(); -} - -/* * - * @tc.name: ItFsJffs663 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs663, TestSize.Level0) -{ - ItFsJffs663(); -} - -/* * - * @tc.name: ItFsJffs664 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs664, TestSize.Level0) -{ - ItFsJffs664(); -} - -/* * - * @tc.name: ItFsJffs665 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs665, TestSize.Level0) -{ - ItFsJffs665(); -} - -/* * - * @tc.name: ItFsJffs666 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs666, TestSize.Level0) -{ - ItFsJffs666(); -} - -/* * - * @tc.name: ItFsJffs668 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs668, TestSize.Level0) -{ - ItFsJffs668(); -} - -/* * - * @tc.name: ItFsJffs669 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs669, TestSize.Level0) -{ - ItFsJffs669(); -} - -/* * - * @tc.name: ItFsJffs670 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs670, TestSize.Level0) -{ - ItFsJffs670(); -} - -/* * - * @tc.name: ItFsJffs671 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs671, TestSize.Level0) -{ - ItFsJffs671(); -} - -/* * - * @tc.name: ItFsJffs672 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs672, TestSize.Level0) -{ - ItFsJffs672(); -} - -/* * - * @tc.name: ItFsJffs673 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs673, TestSize.Level0) -{ - ItFsJffs673(); -} - -/* * - * @tc.name: ItFsJffs674 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs674, TestSize.Level0) -{ - ItFsJffs674(); -} - -/* * - * @tc.name: ItFsJffs675 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs675, TestSize.Level0) -{ - ItFsJffs675(); -} - -/* * - * @tc.name: ItFsJffs676 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs676, TestSize.Level0) -{ - ItFsJffs676(); -} - -/* * - * @tc.name: ItFsJffs690 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs690, TestSize.Level0) -{ - ItFsJffs690(); -} - -/* * - * @tc.name: ItFsJffs694 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs694, TestSize.Level0) -{ - ItFsJffs694(); -} - -/* * - * @tc.name: ItFsJffs696 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs696, TestSize.Level0) -{ - ItFsJffs696(); -} - -/* * - * @tc.name: ItFsJffs697 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs697, TestSize.Level0) -{ - ItFsJffs697(); -} - -/* * - * @tc.name: ItFsJffs700 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs700, TestSize.Level0) -{ - ItFsJffs700(); -} - -/* * - * @tc.name: ItFsJffs701 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs701, TestSize.Level0) -{ - ItFsJffs701(); -} - -/* * - * @tc.name: ItFsJffs807 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs807, TestSize.Level0) -{ - ItFsJffs807(); // jffs dir1 rename dir2,dir2 have more than two files,rename failed -} - -/* * - * @tc.name: ItFsJffs808 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs808, TestSize.Level0) -{ - ItFsJffs808(); -} - -HWTEST_F(VfsJffsTest, ItFsTestLink001, TestSize.Level0) -{ - ItFsTestLink001(); -} - -HWTEST_F(VfsJffsTest, ItFsTestLink002, TestSize.Level0) -{ - ItFsTestLink002(); -} - -HWTEST_F(VfsJffsTest, ItFsTestLink003, TestSize.Level0) -{ - ItFsTestLink003(); -} - -HWTEST_F(VfsJffsTest, ItFsTestLinkat001, TestSize.Level0) -{ - ItFsTestLinkat001(); -} - -HWTEST_F(VfsJffsTest, ItFsTestLinkat002, TestSize.Level0) -{ - ItFsTestLinkat002(); -} - -HWTEST_F(VfsJffsTest, ItFsTestLinkat003, TestSize.Level0) -{ - ItFsTestLinkat003(); -} - -HWTEST_F(VfsJffsTest, ItFsTestReadlink001, TestSize.Level0) -{ - ItFsTestReadlink001(); -} - -HWTEST_F(VfsJffsTest, ItFsTestSymlink001, TestSize.Level0) -{ - ItFsTestSymlink001(); -} - -HWTEST_F(VfsJffsTest, ItFsTestSymlink002, TestSize.Level0) -{ - ItFsTestSymlink002(); -} - -HWTEST_F(VfsJffsTest, ItFsTestSymlink003, TestSize.Level0) -{ - ItFsTestSymlink003(); -} - -HWTEST_F(VfsJffsTest, ItFsTestSymlinkat001, TestSize.Level0) -{ - ItFsTestSymlinkat001(); -} - -HWTEST_F(VfsJffsTest, ItFsTestMountRdonly001, TestSize.Level0) -{ - ItFsTestMountRdonly001(); -} - -HWTEST_F(VfsJffsTest, ItFsTestMountRdonly002, TestSize.Level0) -{ - ItFsTestMountRdonly002(); -} - -HWTEST_F(VfsJffsTest, ItFsTestMountRdonly003, TestSize.Level0) -{ - ItFsTestMountRdonly003(); -} - -#endif -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: It_Test_Dac_001 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItTestDac001, TestSize.Level0) -{ - ItTestDac001(); -} - -/* * - * @tc.name: ItFsJffs001 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs001, TestSize.Level0) -{ - ItFsJffs001(); -} - -/* * - * @tc.name: ItFsJffs002 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs002, TestSize.Level0) -{ - ItFsJffs002(); -} - -/* * - * @tc.name: ItFsJffs003 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs003, TestSize.Level0) -{ - ItFsJffs003(); -} - -/* * - * @tc.name: ItFsJffs005 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs005, TestSize.Level0) -{ - ItFsJffs005(); -} - -/* * - * @tc.name: ItFsJffs021 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs021, TestSize.Level0) -{ - ItFsJffs021(); -} - -/* * - * @tc.name: ItFsJffs022 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs022, TestSize.Level0) -{ - ItFsJffs022(); -} - -/* * - * @tc.name: ItFsJffs026 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs026, TestSize.Level0) -{ - ItFsJffs026(); -} - -/* * - * @tc.name: ItFsJffs027 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs027, TestSize.Level0) -{ - ItFsJffs027(); -} - -/* * - * @tc.name: ItFsJffs095 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs095, TestSize.Level0) -{ - ItFsJffs095(); -} - -/* * - * @tc.name: ItFsJffs535 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffs535, TestSize.Level0) -{ - ItFsJffs535(); -} - -#endif - -#if defined(LOSCFG_USER_TEST_PRESSURE) -/* * - * @tc.name: ItFsJffsPRESSURE_001 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure001, TestSize.Level0) -{ - ItFsJffsPressure001(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_002 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure002, TestSize.Level0) -{ - ItFsJffsPressure002(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_003 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure003, TestSize.Level0) -{ - ItFsJffsPressure003(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_004 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure004, TestSize.Level0) -{ - ItFsJffsPressure004(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_005 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure005, TestSize.Level0) -{ - ItFsJffsPressure005(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_006 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure006, TestSize.Level0) -{ - ItFsJffsPressure006(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_007 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure007, TestSize.Level0) -{ - ItFsJffsPressure007(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_008 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure008, TestSize.Level0) -{ - ItFsJffsPressure008(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_009 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure009, TestSize.Level0) -{ - ItFsJffsPressure009(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_010 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure010, TestSize.Level0) -{ - ItFsJffsPressure010(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_011 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure011, TestSize.Level0) -{ - ItFsJffsPressure011(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_012 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure012, TestSize.Level0) -{ - ItFsJffsPressure012(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_014 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure014, TestSize.Level0) -{ - ItFsJffsPressure014(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_015 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure015, TestSize.Level0) -{ - ItFsJffsPressure015(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_016 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure016, TestSize.Level0) -{ - ItFsJffsPressure016(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_017 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure017, TestSize.Level0) -{ - ItFsJffsPressure017(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_018 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure018, TestSize.Level0) -{ - ItFsJffsPressure018(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_019 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure019, TestSize.Level0) -{ - ItFsJffsPressure019(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_020 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure020, TestSize.Level0) -{ - ItFsJffsPressure020(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_021 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure021, TestSize.Level0) -{ - ItFsJffsPressure021(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_022 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure022, TestSize.Level0) -{ - ItFsJffsPressure022(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_023 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure023, TestSize.Level0) -{ - ItFsJffsPressure023(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_025 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure025, TestSize.Level0) -{ - ItFsJffsPressure025(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_026 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure026, TestSize.Level0) -{ - ItFsJffsPressure026(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_027 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure027, TestSize.Level0) -{ - ItFsJffsPressure027(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_028 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure028, TestSize.Level0) -{ - ItFsJffsPressure028(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_030 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure030, TestSize.Level0) -{ - ItFsJffsPressure030(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_031 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure031, TestSize.Level0) -{ - ItFsJffsPressure031(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_032 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure032, TestSize.Level0) -{ - ItFsJffsPressure032(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_033 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure033, TestSize.Level0) -{ - ItFsJffsPressure033(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_034 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure034, TestSize.Level0) -{ - ItFsJffsPressure034(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_035 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure035, TestSize.Level0) -{ - ItFsJffsPressure035(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_036 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure036, TestSize.Level0) -{ - ItFsJffsPressure036(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_037 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure037, TestSize.Level0) -{ - ItFsJffsPressure037(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_038 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure038, TestSize.Level0) -{ - ItFsJffsPressure038(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_039 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure039, TestSize.Level0) -{ - ItFsJffsPressure039(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_040 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure040, TestSize.Level0) -{ - ItFsJffsPressure040(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_041 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure041, TestSize.Level0) -{ - ItFsJffsPressure041(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_042 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure042, TestSize.Level0) -{ - ItFsJffsPressure042(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_043 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure043, TestSize.Level0) -{ - ItFsJffsPressure043(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_044 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure044, TestSize.Level0) -{ - ItFsJffsPressure044(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_045 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure045, TestSize.Level0) -{ - ItFsJffsPressure045(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_046 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure046, TestSize.Level0) -{ - ItFsJffsPressure046(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_047 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure047, TestSize.Level0) -{ - ItFsJffsPressure047(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_048 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure048, TestSize.Level0) -{ - ItFsJffsPressure048(); // Time-consuming -} - -/* * - * @tc.name: ItFsJffsPRESSURE_049 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure049, TestSize.Level0) -{ - ItFsJffsPressure049(); // Time-consuming -} - -/* * - * @tc.name: ItFsJffsPRESSURE_051 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure051, TestSize.Level0) -{ - ItFsJffsPressure051(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_052 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure052, TestSize.Level0) -{ - ItFsJffsPressure052(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_053 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure053, TestSize.Level0) -{ - ItFsJffsPressure053(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_301 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure301, TestSize.Level0) -{ - ItFsJffsPressure301(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_302 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure302, TestSize.Level0) -{ - ItFsJffsPressure302(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_303 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure303, TestSize.Level0) -{ - ItFsJffsPressure303(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_304 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure304, TestSize.Level0) -{ - ItFsJffsPressure304(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_305 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure305, TestSize.Level0) -{ - ItFsJffsPressure305(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_306 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure306, TestSize.Level0) -{ - ItFsJffsPressure306(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_307 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure307, TestSize.Level0) -{ - ItFsJffsPressure307(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_308 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure308, TestSize.Level0) -{ - ItFsJffsPressure308(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_309 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure309, TestSize.Level0) -{ - ItFsJffsPressure309(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_310 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure310, TestSize.Level0) -{ - ItFsJffsPressure310(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_311 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure311, TestSize.Level0) -{ - ItFsJffsPressure311(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_312 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure312, TestSize.Level0) -{ - ItFsJffsPressure312(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_313 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure313, TestSize.Level0) -{ - ItFsJffsPressure313(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_314 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure314, TestSize.Level0) -{ - ItFsJffsPressure314(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_315 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure315, TestSize.Level0) -{ - ItFsJffsPressure315(); -} - - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_001 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread001, TestSize.Level0) -{ - ItFsJffsMultipthread001(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_002 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread002, TestSize.Level0) -{ - ItFsJffsMultipthread002(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_003 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread003, TestSize.Level0) -{ - ItFsJffsMultipthread003(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_004 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread004, TestSize.Level0) -{ - ItFsJffsMultipthread004(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_005 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread005, TestSize.Level0) -{ - ItFsJffsMultipthread005(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_006 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread006, TestSize.Level0) -{ - ItFsJffsMultipthread006(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_007 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread007, TestSize.Level0) -{ - ItFsJffsMultipthread007(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_008 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread008, TestSize.Level0) -{ - ItFsJffsMultipthread008(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_009 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread009, TestSize.Level0) -{ - ItFsJffsMultipthread009(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_010 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread010, TestSize.Level0) -{ - ItFsJffsMultipthread010(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_011 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread011, TestSize.Level0) -{ - ItFsJffsMultipthread011(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_012 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread012, TestSize.Level0) -{ - ItFsJffsMultipthread012(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_013 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread013, TestSize.Level0) -{ - ItFsJffsMultipthread013(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_014 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread014, TestSize.Level0) -{ - ItFsJffsMultipthread014(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_015 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread015, TestSize.Level0) -{ - ItFsJffsMultipthread015(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_016 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread016, TestSize.Level0) -{ - ItFsJffsMultipthread016(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_017 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread017, TestSize.Level0) -{ - ItFsJffsMultipthread017(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_018 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread018, TestSize.Level0) -{ - ItFsJffsMultipthread018(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_019 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread019, TestSize.Level0) -{ - ItFsJffsMultipthread019(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_020 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread020, TestSize.Level0) -{ - ItFsJffsMultipthread020(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_021 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread021, TestSize.Level0) -{ - ItFsJffsMultipthread021(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_022 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread022, TestSize.Level0) -{ - ItFsJffsMultipthread022(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_023 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread023, TestSize.Level0) -{ - ItFsJffsMultipthread023(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_024 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread024, TestSize.Level0) -{ - ItFsJffsMultipthread024(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_025 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread025, TestSize.Level0) -{ - ItFsJffsMultipthread025(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_026 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread026, TestSize.Level0) -{ - ItFsJffsMultipthread026(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_027 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread027, TestSize.Level0) -{ - ItFsJffsMultipthread027(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_028 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread028, TestSize.Level0) -{ - ItFsJffsMultipthread028(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_029 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread029, TestSize.Level0) -{ - ItFsJffsMultipthread029(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_030 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread030, TestSize.Level0) -{ - ItFsJffsMultipthread030(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_031 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread031, TestSize.Level0) -{ - ItFsJffsMultipthread031(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_032 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread032, TestSize.Level0) -{ - ItFsJffsMultipthread032(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_033 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread033, TestSize.Level0) -{ - ItFsJffsMultipthread033(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_034 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread034, TestSize.Level0) -{ - ItFsJffsMultipthread034(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_035 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread035, TestSize.Level0) -{ - ItFsJffsMultipthread035(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_036 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread036, TestSize.Level0) -{ - ItFsJffsMultipthread036(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_037 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread037, TestSize.Level0) -{ - ItFsJffsMultipthread037(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_038 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread038, TestSize.Level0) -{ - ItFsJffsMultipthread038(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_039 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread039, TestSize.Level0) -{ - ItFsJffsMultipthread039(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_040 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread040, TestSize.Level0) -{ - ItFsJffsMultipthread040(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_041 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread041, TestSize.Level0) -{ - ItFsJffsMultipthread041(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_042 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread042, TestSize.Level0) -{ - ItFsJffsMultipthread042(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_043 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread043, TestSize.Level0) -{ - ItFsJffsMultipthread043(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_044 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread044, TestSize.Level0) -{ - ItFsJffsMultipthread044(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_045 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread045, TestSize.Level0) -{ - ItFsJffsMultipthread045(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_046 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread046, TestSize.Level0) -{ - ItFsJffsMultipthread046(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_047 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread047, TestSize.Level0) -{ - ItFsJffsMultipthread047(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_048 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread048, TestSize.Level0) -{ - ItFsJffsMultipthread048(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_049 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread049, TestSize.Level0) -{ - ItFsJffsMultipthread049(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_050 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread050, TestSize.Level0) -{ - ItFsJffsMultipthread050(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_051 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread051, TestSize.Level0) -{ - ItFsJffsMultipthread051(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_052 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread052, TestSize.Level0) -{ - ItFsJffsMultipthread052(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_053 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread053, TestSize.Level0) -{ - ItFsJffsMultipthread053(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_054 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread054, TestSize.Level0) -{ - ItFsJffsMultipthread054(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_055 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread055, TestSize.Level0) -{ - ItFsJffsMultipthread055(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_056 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread056, TestSize.Level0) -{ - ItFsJffsMultipthread056(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_057 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread057, TestSize.Level0) -{ - ItFsJffsMultipthread057(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_058 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread058, TestSize.Level0) -{ - ItFsJffsMultipthread058(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_059 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread059, TestSize.Level0) -{ - ItFsJffsMultipthread059(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_060 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread060, TestSize.Level0) -{ - ItFsJffsMultipthread060(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_061 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread061, TestSize.Level0) -{ - ItFsJffsMultipthread061(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_062 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread062, TestSize.Level0) -{ - ItFsJffsMultipthread062(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_063 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread063, TestSize.Level0) -{ - ItFsJffsMultipthread063(); -} - - -/* * - * @tc.name: ItFsJffsPERFORMANCE_013 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance013, TestSize.Level0) -{ - ItFsJffsPerformance013(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_001 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance001, TestSize.Level0) -{ - ItFsJffsPerformance001(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_002 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance002, TestSize.Level0) -{ - ItFsJffsPerformance002(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_003 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance003, TestSize.Level0) -{ - ItFsJffsPerformance003(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_004 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance004, TestSize.Level0) -{ - ItFsJffsPerformance004(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_005 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance005, TestSize.Level0) -{ - ItFsJffsPerformance005(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_006 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance006, TestSize.Level0) -{ - ItFsJffsPerformance006(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_008 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance008, TestSize.Level0) -{ - ItFsJffsPerformance008(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_009 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance009, TestSize.Level0) -{ - ItFsJffsPerformance009(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_010 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance010, TestSize.Level0) -{ - ItFsJffsPerformance010(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_011 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance011, TestSize.Level0) -{ - ItFsJffsPerformance011(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_012 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance012, TestSize.Level0) -{ - ItFsJffsPerformance012(); -} - -#endif -} diff --git a/testsuites/unittest/fs/proc/It_vfs_proc.cpp b/testsuites/unittest/fs/proc/It_vfs_proc.cpp deleted file mode 100644 index a4d42574..00000000 --- a/testsuites/unittest/fs/proc/It_vfs_proc.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_proc.h" - -VOID ItSuiteVfsProc(VOID) -{ -#if defined(LOSCFG_USER_TEST_SMOKE) -#endif - -#if defined(LOSCFG_USER_TEST_FULL) - ItFsProc001(); - ItFsProc002(); - ItFsProc003(); - ItFsProc004(); - ItFsProc005(); - ItFsProc006(); -#endif - -#if defined(LOSCFG_USER_TEST_LLT) -#endif - -#if defined(LOSCFG_USER_TEST_PRESSURE) -#ifndef LOSCFG_KERNEL_SMP -#endif -#endif -} diff --git a/testsuites/unittest/fs/proc/It_vfs_proc.h b/testsuites/unittest/fs/proc/It_vfs_proc.h deleted file mode 100644 index 0b58bdfd..00000000 --- a/testsuites/unittest/fs/proc/It_vfs_proc.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "osTest.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define PROC_PATH_NAME "/proc/test" -#define PROC_MAIN_DIR "/proc" -#define PROC_MOUNT_DIR "/proc" -#define MOUNT_DIR_PATH "/proc/mounts" -#define UPTIME_DIR_PATH "/proc/uptime" -#define VMM_DIR_PATH "/proc/vmm" -#define PROCESS_DIR_PATH "/proc/process" -#define PROC_DEV_PATH NULL -#define PROC_CHINESE_NAME1 "杩欐槸涓涓腑鏂囧悕" -#define PROC_FILESYS_TYPE "procfs" - -#define PROC_NAME_LIMITTED_SIZE 300 -#define PROC_NO_ERROR 0 -#define PROC_IS_ERROR -1 - -#if defined(LOSCFG_USER_TEST_SMOKE) -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -VOID ItFsProc001(VOID); -VOID ItFsProc002(VOID); -VOID ItFsProc003(VOID); -VOID ItFsProc004(VOID); -VOID ItFsProc005(VOID); -VOID ItFsProc006(VOID); -#endif - -#if defined(LOSCFG_USER_TEST_LLT) -#endif - -#if defined(LOSCFG_USER_TEST_PRESSURE) -#endif - - diff --git a/testsuites/unittest/fs/proc/config.gni b/testsuites/unittest/fs/proc/config.gni deleted file mode 100644 index 1232c023..00000000 --- a/testsuites/unittest/fs/proc/config.gni +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. 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. -# -# 3. Neither the name of the copyright holder nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. - -import("//kernel/liteos_a/testsuites/unittest/config.gni") - -proc_include_dirs = [ "$TEST_UNITTEST_DIR/fs/proc" ] - -proc_sources_entry = [ "$TEST_UNITTEST_DIR/fs/proc/It_vfs_proc.cpp" ] - -proc_sources_smoke = [] - -proc_sources_full = [ - "$TEST_UNITTEST_DIR/fs/proc/full/It_vfs_proc_001.cpp", - "$TEST_UNITTEST_DIR/fs/proc/full/It_vfs_proc_002.cpp", - "$TEST_UNITTEST_DIR/fs/proc/full/It_vfs_proc_003.cpp", - "$TEST_UNITTEST_DIR/fs/proc/full/It_vfs_proc_004.cpp", - "$TEST_UNITTEST_DIR/fs/proc/full/It_vfs_proc_005.cpp", - "$TEST_UNITTEST_DIR/fs/proc/full/It_vfs_proc_006.cpp", -] diff --git a/testsuites/unittest/fs/proc/full/It_vfs_proc_001.cpp b/testsuites/unittest/fs/proc/full/It_vfs_proc_001.cpp deleted file mode 100644 index 6139ab41..00000000 --- a/testsuites/unittest/fs/proc/full/It_vfs_proc_001.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_proc.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR readbuf[PROC_NAME_LIMITTED_SIZE] = ""; - - fd = open(MOUNT_DIR_PATH, O_RDONLY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = memset_s(readbuf, PROC_NAME_LIMITTED_SIZE, 0, PROC_NAME_LIMITTED_SIZE); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, ret, EXIT1); - - len = read(fd, readbuf, PROC_NAME_LIMITTED_SIZE - 1); - ICUNIT_GOTO_NOT_EQUAL(len, -1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, fd, EXIT1); - - fd = open(VMM_DIR_PATH, O_RDONLY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = memset_s(readbuf, PROC_NAME_LIMITTED_SIZE, 0, PROC_NAME_LIMITTED_SIZE); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, ret, EXIT1); - len = read(fd, readbuf, PROC_NAME_LIMITTED_SIZE - 1); - ICUNIT_GOTO_NOT_EQUAL(len, -1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, fd, EXIT1); - - fd = open(PROCESS_DIR_PATH, O_RDONLY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = memset_s(readbuf, PROC_NAME_LIMITTED_SIZE, 0, PROC_NAME_LIMITTED_SIZE); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, ret, EXIT1); - len = read(fd, readbuf, PROC_NAME_LIMITTED_SIZE - 1); - ICUNIT_GOTO_NOT_EQUAL(len, -1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, fd, EXIT1); - - return PROC_NO_ERROR; - -EXIT1: - close(fd); - - return PROC_NO_ERROR; -} - -VOID ItFsProc001(VOID) -{ - TEST_ADD_CASE("ItFsProc001", TestCase, TEST_VFS, TEST_PROC, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/proc/full/It_vfs_proc_002.cpp b/testsuites/unittest/fs/proc/full/It_vfs_proc_002.cpp deleted file mode 100644 index c186e792..00000000 --- a/testsuites/unittest/fs/proc/full/It_vfs_proc_002.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_proc.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR readbuf[PROC_NAME_LIMITTED_SIZE] = ""; - - fd = open(UPTIME_DIR_PATH, O_RDONLY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = memset_s(readbuf, PROC_NAME_LIMITTED_SIZE, 0, PROC_NAME_LIMITTED_SIZE); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, ret, EXIT1); - len = read(fd, readbuf, PROC_NAME_LIMITTED_SIZE - 1); - ICUNIT_GOTO_NOT_EQUAL(len, -1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, fd, EXIT1); - - return PROC_NO_ERROR; - -EXIT1: - close(fd); - - return PROC_NO_ERROR; -} - -VOID ItFsProc002(VOID) -{ - TEST_ADD_CASE("ItFsProc002", TestCase, TEST_VFS, TEST_PROC, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/proc/full/It_vfs_proc_003.cpp b/testsuites/unittest/fs/proc/full/It_vfs_proc_003.cpp deleted file mode 100644 index 9852a0c2..00000000 --- a/testsuites/unittest/fs/proc/full/It_vfs_proc_003.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_proc.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - - fd = open(MOUNT_DIR_PATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, "test", strlen("test")); - ICUNIT_GOTO_EQUAL(len, -EPERM, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, fd, EXIT1); - - return PROC_NO_ERROR; - -EXIT1: - close(fd); - - return PROC_NO_ERROR; -} - -VOID ItFsProc003(VOID) -{ - TEST_ADD_CASE("ItFsProc003", TestCase, TEST_VFS, TEST_PROC, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/proc/full/It_vfs_proc_004.cpp b/testsuites/unittest/fs/proc/full/It_vfs_proc_004.cpp deleted file mode 100644 index c7733a32..00000000 --- a/testsuites/unittest/fs/proc/full/It_vfs_proc_004.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_proc.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - - fd = open(UPTIME_DIR_PATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, "test", strlen("test")); - ICUNIT_GOTO_EQUAL(len, -EPERM, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, fd, EXIT1); - - return PROC_NO_ERROR; - -EXIT1: - close(fd); - - return PROC_NO_ERROR; -} - -VOID ItFsProc004(VOID) -{ - TEST_ADD_CASE("ItFsProc004", TestCase, TEST_VFS, TEST_PROC, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/proc/full/It_vfs_proc_005.cpp b/testsuites/unittest/fs/proc/full/It_vfs_proc_005.cpp deleted file mode 100644 index 8a71e138..00000000 --- a/testsuites/unittest/fs/proc/full/It_vfs_proc_005.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_proc.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - - fd = open(UPTIME_DIR_PATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, "test", strlen("test")); - ICUNIT_GOTO_EQUAL(len, -EPERM, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, fd, EXIT1); - - return PROC_NO_ERROR; - -EXIT1: - close(fd); - - return PROC_NO_ERROR; -} - -VOID ItFsProc005(VOID) -{ - TEST_ADD_CASE("ItFsProc005", TestCase, TEST_VFS, TEST_PROC, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/proc/full/It_vfs_proc_006.cpp b/testsuites/unittest/fs/proc/full/It_vfs_proc_006.cpp deleted file mode 100644 index 7c43a903..00000000 --- a/testsuites/unittest/fs/proc/full/It_vfs_proc_006.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_proc.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - - fd = open(PROCESS_DIR_PATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, "test", strlen("test")); - ICUNIT_GOTO_EQUAL(len, -EPERM, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, fd, EXIT1); - - return PROC_NO_ERROR; - -EXIT1: - close(fd); - - return PROC_NO_ERROR; -} - -VOID ItFsProc006(VOID) -{ - TEST_ADD_CASE("ItFsProc006", TestCase, TEST_VFS, TEST_PROC, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/It_vfs_fat.h b/testsuites/unittest/fs/vfat/It_vfs_fat.h deleted file mode 100644 index e863e1fc..00000000 --- a/testsuites/unittest/fs/vfat/It_vfs_fat.h +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. - */ - -#ifndef IT_VFS_FAT_H -#define IT_VFS_FAT_H - -#include "osTest.h" -#include "sys/uio.h" -#include "utime.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef _GNU_SOURCE -struct timeval { - time_t tv_sec; - suseconds_t tv_usec; -}; -#endif -#define F_RDO 0x01 /* Read only */ -#define F_HID 0x02 /* Hidden */ -#define F_SYS 0x04 /* System */ -#define F_ARC 0x20 /* Archive */ -#define NAME_MAX 255 - -extern int Chattr(const char *path, mode_t mode); // -using off_t = off64_t; - -#define SD_MOUNT_DIR "/vs/sd" -#define FAT_MOUNT_DIR SD_MOUNT_DIR -#define FAT_MAIN_DIR SD_MOUNT_DIR -#define FAT_PATH_NAME "/vs/sd/test" -#define FAT_PATH_NAME0 "/vs/sd/test0" -#define FAT_PATH_NAME1 "/vs/sd/test1" -#define FAT_PATH_NAME2 "/vs/sd/test2" -#define FAT_PATH_NAME00 "/vs/sd/test0/test00" -#define FAT_PATH_NAME11 "/vs/sd/test1/test11" -#define FAT_PATH_NAME22 "/vs/sd/test2/test22" -#define FAT_PATH_NAME_0 "/vs/sd/test/test0" -#define FAT_PATH_NAME_01 "/vs/sd/test/test0/test1" -#define FAT_DEV_PATH "/dev/mmcblk0" -#define FAT_DEV_PATH1 "/dev/mmcblk0p0" -#define FAT_FILESYS_TYPE "vfat" -#define FAT_CHINESE_NAME1 "脭莽脡脧潞脙" - -#define FAT_FALLOCATE_KEEP_SIZE 0x1 // FALLOC_FL_KEEP_SIZE -#define FAT_FALLOCATE_NO_KEEP_SIZE 0 - -#define FAT_NAME_LIMITTED_SIZE 300 -#define FAT_FILE_LIMITTED_NUM 200 -#define FAT_STANDARD_NAME_LENGTH 50 -#define FAT_SHORT_ARRAY_LENGTH 10 -#define FAT_LONG_ARRAY_LENGTH 100 -#define MAX_DEF_BUF_NUM 21 -#define FIX_DATA_LEN 524288 -#define MAX_BUFFER_LEN FIX_DATA_LEN // 9000000 //the mem is not enough -#define CAL_THRESHOLD_VALUE 0x1900000 -#define FAT_WR_CAP_SIZE_TEST 0x1900000 // the size is 25MB for each speed calculation -#define MAX_THREAD_NUM 10 -#define FAT_PTHREAD_PRIORITY_TEST1 4 -#define CONFIG_NFILE_DESCRIPTORS 512 - -#define PRINTF_OUT dprintf -#define PRINTF_HELP() \ - do { \ - PRINTF_OUT(" usage: testfile [rand/fix/quit] [file size] [file num] [write/fwrite]\n"); \ - } while (0); - -#define FILE_SIZE (500 * BYTES_PER_MBYTES) -#define FAT_PERFORMANCE_FILE_SIZE (500 * BYTES_PER_MBYTES) -#define INTERFACE_TYPE 0 // 0:use fwrite and fread for test -#define FAT_WR_TYPE_TEST1 0 // 0:use fwrite and fread for test -#define FAT_WR_TYPE_TEST2 1 // 0:use fwrite and fread for test -#define FAT_FILE_FIX_WRITE_SIZE 5 * BYTES_PER_MBYTES - -/* These are same as the value in the fs/vfat/include/ff.h */ -#define FAT_FILE_SYSTEMTYPE_FAT 0x01 // FM_FAT -#define FAT_FILE_SYSTEMTYPE_FAT32 0x02 // FM_FAT32 -#define FAT_FILE_SYSTEMTYPE_EXFAT 0x04 // FM_EXFAT -#define FAT_FILE_SYSTEMTYPE_ANY 0x07 // FM_ANY -#define FAT_FILE_SYSTEMTYPE_SFD 0x08 // FM_SFD - -/* For the different test scenes:FAT32 and EXFAT */ -#define FAT_FILE_SYSTEMTYPE_AUTO g_fatFilesystem - -#define FAT_MAX_NUM_TEST 1000 -#define FAT_MOUNT_CYCLES_TEST 10000 -#define FAT_PRESSURE_CYCLES 10 -#define FAT_MAXIMUM_OPERATIONS 10 -#define FAT_MAXIMUM_SIZES 10 -#define FAT_FILEMUM_NUM 100 -#define FAT_MAX_THREADS 3 -#define FAT_NO_ERROR 0 -#define FAT_IS_ERROR -1 -#define FAT_TO_NULL NULL -#define FAT_LONG_FILESIZE 5 -#define FAT_CREATFILE_NUM 5 -#define FAT_MIDDLE_CYCLES 10 -#define FAT_MAX_CYCLES 100 - -#define BYTES_PER_KBYTES 1024 -#define BYTES_PER_MBYTES (1024 * 1024) -#define US_PER_SEC 1000000 - -#endif - -extern INT32 g_fatFilesMax; -extern INT32 g_fatFlag; -extern INT32 g_fatFlagF01; -extern INT32 g_fatFlagF02; -extern INT32 g_fatFd; -extern FILE *g_fatFfd; - -extern DIR *g_fatDir; - -extern INT32 g_fatFd11[FAT_MAXIMUM_SIZES]; -extern INT32 g_fatFd12[FAT_MAXIMUM_SIZES][FAT_MAXIMUM_SIZES]; - -extern CHAR g_fatPathname1[FAT_STANDARD_NAME_LENGTH]; -extern CHAR g_fatPathname2[FAT_STANDARD_NAME_LENGTH]; -extern CHAR g_fatPathname3[FAT_STANDARD_NAME_LENGTH]; - -extern CHAR g_fatPathname6[FAT_NAME_LIMITTED_SIZE]; -extern CHAR g_fatPathname7[FAT_NAME_LIMITTED_SIZE]; -extern CHAR g_fatPathname8[FAT_NAME_LIMITTED_SIZE]; - -extern CHAR g_fatPathname11[FAT_MAXIMUM_SIZES][FAT_NAME_LIMITTED_SIZE]; -extern CHAR g_fatPathname12[FAT_MAXIMUM_SIZES][FAT_NAME_LIMITTED_SIZE]; -extern CHAR g_fatPathname13[FAT_MAXIMUM_SIZES][FAT_NAME_LIMITTED_SIZE]; - -extern UINT32 g_fatMuxHandle1; -extern UINT32 g_fatMuxHandle2; - -extern pthread_mutex_t g_vfatGlobalLock1; -extern pthread_mutex_t g_vfatGlobalLock2; - -VOID FatStrcat2(char *pathname, char *str, int len); -INT32 FatScandirFree(struct dirent **namelist, int n); -VOID FatStatPrintf(struct stat sb); -VOID FatStatfsPrintf(struct statfs buf); - -INT32 FixWrite(CHAR *path, INT64 file_size, INT32 write_size, INT32 interface_type); -INT32 FixRead(CHAR *path, INT64 file_size, INT32 read_size, INT32 interface_type); -INT32 RandWrite(CHAR *path, INT64 file_size, INT32 interface_type); -INT32 RandRead(CHAR *path, INT64 file_size, INT32 interface_type); - -extern INT32 g_grandSize[MAX_DEF_BUF_NUM]; -extern struct iovec g_fatIov[FAT_SHORT_ARRAY_LENGTH]; - -extern UINT32 g_testTaskId01; -extern UINT32 g_testTaskId02; -extern UINT32 g_fatFilesystem; - -extern const INT32 CAL_THRESHOLD; -extern INT32 FatDeleteFile(int fd, char *pathname); - -#if defined(LOSCFG_USER_TEST_SMOKE) -VOID ItFsFat026(VOID); -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -VOID ItFsFat066(VOID); -VOID ItFsFat068(VOID); -VOID ItFsFat072(VOID); -VOID ItFsFat073(VOID); -VOID ItFsFat074(VOID); -VOID ItFsFat496(VOID); -VOID ItFsFat497(VOID); -VOID ItFsFat498(VOID); -VOID ItFsFat499(VOID); -VOID ItFsFat500(VOID); -VOID ItFsFat501(VOID); -VOID ItFsFat502(VOID); -VOID ItFsFat503(VOID); -VOID ItFsFat504(VOID); -VOID ItFsFat506(VOID); -VOID ItFsFat507(VOID); -VOID ItFsFat508(VOID); -VOID ItFsFat509(VOID); -VOID ItFsFat510(VOID); -VOID ItFsFat511(VOID); -VOID ItFsFat512(VOID); -VOID ItFsFat513(VOID); -VOID ItFsFat514(VOID); -VOID ItFsFat515(VOID); -VOID ItFsFat516(VOID); -VOID ItFsFat517(VOID); -VOID ItFsFat518(VOID); -VOID ItFsFat519(VOID); -VOID ItFsFat662(VOID); -VOID ItFsFat663(VOID); -VOID ItFsFat664(VOID); -VOID ItFsFat665(VOID); -VOID ItFsFat666(VOID); -VOID ItFsFat667(VOID); -VOID ItFsFat668(VOID); -VOID ItFsFat669(VOID); -VOID ItFsFat670(VOID); -VOID ItFsFat671(VOID); -VOID ItFsFat672(VOID); -VOID ItFsFat673(VOID); -VOID ItFsFat674(VOID); -VOID ItFsFat675(VOID); -VOID ItFsFat676(VOID); -VOID ItFsFat677(VOID); -VOID ItFsFat678(VOID); -VOID ItFsFat679(VOID); -VOID ItFsFat680(VOID); -VOID ItFsFat681(VOID); -VOID ItFsFat682(VOID); -VOID ItFsFat683(VOID); -VOID ItFsFat684(VOID); -VOID ItFsFat685(VOID); -VOID ItFsFat686(VOID); -VOID ItFsFat687(VOID); -VOID ItFsFat692(VOID); -VOID ItFsFat693(VOID); -VOID ItFsFat694(VOID); -VOID ItFsFat870(VOID); -VOID ItFsFat872(VOID); -VOID ItFsFat873(VOID); -VOID ItFsFat874(VOID); -VOID ItFsFat875(VOID); -VOID ItFsFat902(VOID); -VOID ItFsFat903(VOID); -VOID ItFsFat904(VOID); -VOID ItFsFat909(VOID); - -#endif - -#if defined(LOSCFG_USER_TEST_PRESSURE) -VOID ItFsFatMutipthread003(VOID); -VOID ItFsFatMutipthread004(VOID); -VOID ItFsFatMutipthread005(VOID); -VOID ItFsFatMutipthread006(VOID); -VOID ItFsFatMutipthread008(VOID); -VOID ItFsFatMutipthread009(VOID); -VOID ItFsFatMutipthread010(VOID); -VOID ItFsFatMutipthread012(VOID); -VOID ItFsFatMutipthread014(VOID); -VOID ItFsFatMutipthread016(VOID); -VOID ItFsFatMutipthread017(VOID); -VOID ItFsFatMutipthread018(VOID); -VOID ItFsFatMutipthread019(VOID); -VOID ItFsFatMutipthread020(VOID); -VOID ItFsFatMutipthread021(VOID); -VOID ItFsFatMutipthread022(VOID); -VOID ItFsFatMutipthread023(VOID); -VOID ItFsFatMutipthread024(VOID); -VOID ItFsFatMutipthread027(VOID); -VOID ItFsFatMutipthread029(VOID); -VOID ItFsFatMutipthread030(VOID); -VOID ItFsFatMutipthread032(VOID); -VOID ItFsFatMutipthread033(VOID); -VOID ItFsFatMutipthread035(VOID); -VOID ItFsFatMutipthread036(VOID); -VOID ItFsFatMutipthread038(VOID); -VOID ItFsFatMutipthread039(VOID); -VOID ItFsFatMutipthread040(VOID); -VOID ItFsFatMutipthread041(VOID); -VOID ItFsFatMutipthread042(VOID); -VOID ItFsFatMutipthread043(VOID); -VOID ItFsFatMutipthread044(VOID); -VOID ItFsFatMutipthread045(VOID); -VOID ItFsFatMutipthread046(VOID); -VOID ItFsFatMutipthread047(VOID); -VOID ItFsFatMutipthread048(VOID); -VOID ItFsFatMutipthread049(VOID); -VOID ItFsFatMutipthread050(VOID); - -VOID ItFsFatPressure029(VOID); -VOID ItFsFatPressure030(VOID); -VOID ItFsFatPressure031(VOID); -VOID ItFsFatPressure038(VOID); -VOID ItFsFatPressure040(VOID); -VOID ItFsFatPressure041(VOID); -VOID ItFsFatPressure042(VOID); - -VOID ItFsFatPressure301(VOID); -VOID ItFsFatPressure302(VOID); -VOID ItFsFatPressure303(VOID); -VOID ItFsFatPressure305(VOID); -VOID ItFsFatPressure306(VOID); -VOID ItFsFatPressure309(VOID); - -VOID ItFsFatPerformance013(VOID); -VOID ItFsFatPerformance014(VOID); -VOID ItFsFatPerformance015(VOID); -VOID ItFsFatPerformance016(VOID); -VOID ItFsFatPerformance001(VOID); -VOID ItFsFatPerformance002(VOID); -VOID ItFsFatPerformance003(VOID); -VOID ItFsFatPerformance004(VOID); -VOID ItFsFatPerformance005(VOID); -VOID ItFsFatPerformance006(VOID); -VOID ItFsFatPerformance007(VOID); -VOID ItFsFatPerformance008(VOID); - -#endif diff --git a/testsuites/unittest/fs/vfat/VfsFatTest.cpp b/testsuites/unittest/fs/vfat/VfsFatTest.cpp deleted file mode 100644 index b87e7f31..00000000 --- a/testsuites/unittest/fs/vfat/VfsFatTest.cpp +++ /dev/null @@ -1,1466 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 -#include - -#include "It_vfs_fat.h" - -#define MS_PER_SEC 1000 - -struct iovec g_fatIov[FAT_SHORT_ARRAY_LENGTH]; - -const INT32 CAL_THRESHOLD = CAL_THRESHOLD_VALUE; -INT32 g_grandSize[MAX_DEF_BUF_NUM] = { - 29, 30290, 3435, 235, 12345, 80, 9845, - 564, 34862, 123, 267890, 36, 6788, 86, - 234567, 1232, 514, 50, 678, 9864, 333333 -}; - -INT32 g_fatFilesMax = 10; -INT32 g_fatFlag = 0; -INT32 g_fatFlagF01 = 0; -INT32 g_fatFlagF02 = 0; -INT32 g_fatFd = 0; -DIR *g_fatDir = nullptr; -UINT32 g_fatMuxHandle1 = 0; -UINT32 g_fatMuxHandle2 = 0; -pthread_mutex_t g_vfatGlobalLock1; -pthread_mutex_t g_vfatGlobalLock2; - -INT32 g_fatFd11[FAT_MAXIMUM_SIZES]; -INT32 g_fatFd12[FAT_MAXIMUM_SIZES][FAT_MAXIMUM_SIZES]; - -CHAR g_fatPathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; -CHAR g_fatPathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; -CHAR g_fatPathname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - -CHAR g_fatPathname6[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME; -CHAR g_fatPathname7[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME; -CHAR g_fatPathname8[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME; - -CHAR g_fatPathname11[FAT_MAXIMUM_SIZES][FAT_NAME_LIMITTED_SIZE] = { 0 }; -CHAR g_fatPathname12[FAT_MAXIMUM_SIZES][FAT_NAME_LIMITTED_SIZE] = { 0 }; -CHAR g_fatPathname13[FAT_MAXIMUM_SIZES][FAT_NAME_LIMITTED_SIZE] = { 0 }; - -FILE *g_fatFfd; - -INT32 FatDeleteFile(int fd, char *pathname) -{ - int ret; - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - return FAT_NO_ERROR; -} - -INT32 FixWrite(CHAR *path, INT64 file_size, INT32 write_size, INT32 interface_type) -{ - INT32 ret; - INT32 fd = -1; - INT64 total = 0; - INT64 perTime; - INT64 totalSize = 0; - INT64 totalTime = 0; - INT32 cycleCount = 0; - INT32 taskId; - struct timeval testTime1; - struct timeval testTime2; - DOUBLE testSpeed; - CHAR *pid = NULL; - CHAR *writeBuf = NULL; - FILE *file = NULL; - - taskId = strlen(path); - pid = path + taskId - 1; - taskId = atoi(pid); - - writeBuf = (CHAR *)malloc(write_size); - ICUNIT_GOTO_NOT_EQUAL(writeBuf, nullptr, writeBuf, EXIT); - - gettimeofday(&testTime1, 0); - if (interface_type == 1) { - fd = open(path, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - if (fd < 0) { - printf("Task_%d fail to open %s,\n", taskId, path); - goto EXIT1; - } - } else { - file = fopen(path, "w+b"); - if (file == nullptr) { - printf("Task_%d fail to fopen %s,\n", taskId, path); - goto EXIT2; - } - } - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - printf("fix_Write TaskID:%3d,open %s ,task %lld ms ,\n", taskId, path, perTime / MS_PER_SEC); - - gettimeofday(&testTime1, 0); - - while (1) { - if (interface_type == 1) { - ret = write(fd, writeBuf, write_size); - if (ret <= 0) { - if (errno == ENOSPC) { - printf("No space !! %s,\n", strerror(errno)); - goto EXIT1; - } - printf("fix_write fail,path = %s,ret=:%d ,errno=:%d!\n", path, ret, errno); - goto EXIT1; - } - } else { - ret = fwrite(writeBuf, 1, write_size, file); - if (ret <= 0 || ret != write_size) { - if (errno == ENOSPC) { - printf("No space !! %s,\n", strerror(errno)); - } - printf("fix_fwrite error! %s ,path=:%s, ret = %d,\n", strerror(errno), path, ret); - - goto EXIT2; - } - } - total += ret; - totalSize += ret; - if (total >= CAL_THRESHOLD) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * US_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_KBYTES / BYTES_PER_KBYTES; - - if (interface_type == 1) { - printf("fix_Write TaskID:%3d,%d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", - taskId, cycleCount++, total, perTime, testSpeed); - } else { - printf("fix_fwrite TaskID:%3d,%d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", - taskId, cycleCount++, total, perTime, testSpeed); - } - total = 0; - gettimeofday(&testTime1, 0); - } - - if (file_size <= totalSize) { - break; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * US_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_KBYTES / BYTES_PER_KBYTES; - - printf("\nfix_Write TaskID:%3d,total write=%lld , time=%lld,arv speed =%0.3lfMB/s ,\n", taskId, totalSize, - totalTime, testSpeed); - gettimeofday(&testTime1, 0); - if (interface_type == 1) { - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } else { - ret = fclose(file); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - printf("fix_Write TaskID:%3d,sucess to fclose the %s ,task:%lld ms,\n", taskId, path, perTime / MS_PER_SEC); - - free(writeBuf); - - return FAT_NO_ERROR; -EXIT2: - fclose(file); - goto EXIT; -EXIT1: - close(fd); -EXIT: - free(writeBuf); - return FAT_NO_ERROR; -} - -INT32 FixRead(CHAR *path, INT64 file_size, INT32 read_size, INT32 interface_type) -{ - INT32 fd, taskId, ret; - INT32 cycleCount = 0; - INT64 total = 0; - INT64 totalSize = 0; - INT64 perTime; - INT64 totalTime = 0; - FILE *file = NULL; - CHAR *readBuf = NULL; - CHAR *pid = NULL; - DOUBLE testSpeed; - struct timeval testTime1; - struct timeval testTime2; - - taskId = strlen(path); - pid = path + taskId - 1; - taskId = atoi(pid); - - readBuf = (CHAR *)malloc(read_size); - ICUNIT_ASSERT_NOT_EQUAL(readBuf, nullptr, readBuf); - - gettimeofday(&testTime1, 0); - - if (interface_type == 1) { - fd = open(path, O_RDWR, S_IRUSR | S_IWUSR); - if (fd < 0) { - printf("Task_%d fail to open %s,\n", taskId, path); - goto EXIT1; - } - } else { - file = fopen(path, "rb"); - if (file == nullptr) { - printf("Task_%d fail to fopen %s,\n", taskId, path); - goto EXIT2; - } - } - - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - printf("fix_Read TaskID:%3d,open %s , task:%lld ms,\n", taskId, path, perTime / MS_PER_SEC); - - gettimeofday(&testTime1, 0); - - while (1) { - if (interface_type == 1) { - ret = read(fd, readBuf, read_size); - if (ret < 0) { - printf("ret = %d,%s read fail!-->(X),\n", ret, path); - goto EXIT1; - } - if (!ret) { - printf("warning: read ret = 0,\n"); - goto EXIT1; - } - } else { - ret = fread(readBuf, 1, read_size, file); - if (ret <= 0) { - if (feof(file) == 1) { - printf("feof of %s,\n", path); - } else { - printf("fread error!,\n"); - goto EXIT2; - } - } - } - total += ret; - totalSize += ret; - - if (total >= CAL_THRESHOLD) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * US_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_KBYTES / BYTES_PER_KBYTES; - - printf("fix_Read TaskID:%3d,times %d, read %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", taskId, - cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - - if (file_size <= totalSize) { - break; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * US_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_KBYTES / BYTES_PER_KBYTES; - - printf("\nfix_Read TaskID:%3d,total read=%lld , time=%lld,arv speed =%0.3lfMB/s ,\n", taskId, totalSize, totalTime, - testSpeed); - - gettimeofday(&testTime1, 0); - if (interface_type == 1) { - ret = close(fd); - if (ret < 0) { - printf("fail to close %s!\n", strerror(errno)); - } - } else { - ret = fclose(file); - if (ret < 0) { - printf("fail to fclose %s!\n", strerror(errno)); - } - } - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - printf("fix_Read TaskID:%3d, fclose %s!,task:%lld ms,\n", taskId, path, perTime / MS_PER_SEC); - - ret = remove(path); - if (ret < 0) { - printf("fail to remove %s!\n", strerror(errno)); - } - - printf("Read TaskID:%3d,sucess to fread the %s,\n", taskId, path); - free(readBuf); - return 0; -EXIT2: - fclose(file); -EXIT1: - close(fd); - - free(readBuf); - return FAT_NO_ERROR; -} - -INT32 RandWrite(CHAR *path, INT64 file_size, INT32 interface_type) -{ - INT32 ret, i, fd; - INT32 cycleCount = 0; - INT32 taskId; - INT64 total = 0; - INT64 totalSize = 0; - INT64 perTime; - INT64 totalTime = 0; - CHAR *writeBuf = NULL; - CHAR *pid = NULL; - struct timeval testTime1; - struct timeval testTime2; - DOUBLE testSpeed; - FILE *file = NULL; - - taskId = strlen(path); - pid = path + taskId - 1; - taskId = atoi(pid); - - writeBuf = (CHAR *)malloc(MAX_BUFFER_LEN); - ICUNIT_GOTO_NOT_EQUAL(writeBuf, nullptr, writeBuf, EXIT); - - gettimeofday(&testTime1, 0); - if (interface_type == 1) { - fd = open(path, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - if (fd < 0) { - printf("Task_%d fail to open %s,\n", taskId, path); - goto EXIT1; - } - } else { - file = fopen(path, "w+b"); - if (file == nullptr) { - printf("Task_%d fail to fopen %s,\n", taskId, path); - goto EXIT2; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - printf("RandWrite TaskID:%3d,open %s , cost:%lld ms,\n", taskId, path, perTime / MS_PER_SEC); - - gettimeofday(&testTime1, 0); - - i = 0; - - while (1) { - if (interface_type == 1) { - ret = write(fd, writeBuf, g_grandSize[i]); - if (ret <= 0) { - printf("ret = %d,%s write fail!-->(X),\n", ret, path); - if (errno == ENOSPC) { - printf("No space !! %s,\n", strerror(errno)); - goto EXIT1; - } - goto EXIT1; - } - } else { - ret = fwrite(writeBuf, 1, g_grandSize[i], file); - if (ret <= 0 || ret != g_grandSize[i]) { - if (errno == ENOSPC) { - printf("No space !! %s,\n", strerror(errno)); - } - printf("rand_Write TaskID:%3d,fwrite error! %s , ret = %d,\n", taskId, strerror(errno), ret); - goto EXIT2; - } - } - - total += ret; - totalSize += ret; - if (total >= CAL_THRESHOLD) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - testSpeed = total * 1.0; - testSpeed = testSpeed * US_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_KBYTES / BYTES_PER_KBYTES; - - printf("rand_Write TaskID:%3d,%d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", - taskId, cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - - if (file_size <= totalSize) { - break; - } - if (++i >= MAX_DEF_BUF_NUM) - i = 0; - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * US_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_KBYTES / BYTES_PER_KBYTES; - printf("--------------------------------\n"); - printf("rand_Write TaskID:%3d,total write=%lld , time=%lld,arv speed =%0.3lfMB/s ,\n", taskId, totalSize, totalTime, - testSpeed); - - gettimeofday(&testTime1, 0); - if (interface_type == 1) { - ret = close(fd); - if (ret < 0) { - printf("rand_Write TaskID:%3d,fail to close %s!\n", taskId, strerror(errno)); - goto EXIT1; - } - } else { - ret = fclose(file); - if (ret < 0) { - printf("rand_Write TaskID:%3d,fail to fclose %s!\n", taskId, strerror(errno)); - goto EXIT2; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - printf("rand_Write TaskID:%3d,sucess to fclose the %s ,task %lld,\n", taskId, path, perTime / MS_PER_SEC); - - free(writeBuf); - - return FAT_NO_ERROR; -EXIT2: - fclose(file); - goto EXIT; -EXIT1: - close(fd); -EXIT: - free(writeBuf); - return FAT_NO_ERROR; -} - -INT32 RandRead(CHAR *path, INT64 file_size, INT32 interface_type) -{ - INT32 ret, fd, i; - INT32 cycleCount = 0; - INT32 taskId; - INT64 total = 0; - INT64 totalSize = 0; - INT64 perTime; - INT64 totalTime = 0; - struct timeval testTime1; - struct timeval testTime2; - DOUBLE testSpeed; - CHAR *pid = NULL; - CHAR *readBuf = NULL; - FILE *file = NULL; - - taskId = strlen(path); - pid = path + taskId - 1; - taskId = atoi(pid); - - readBuf = (CHAR *)malloc(MAX_BUFFER_LEN); - ICUNIT_GOTO_NOT_EQUAL(readBuf, nullptr, readBuf, EXIT); - - gettimeofday(&testTime1, 0); - if (interface_type == 1) { - fd = open(path, O_RDWR, S_IRUSR | S_IWUSR); - if (-1 == fd) { - printf("fail to open %s\n", path); - goto EXIT1; - } - } else { - file = fopen(path, "rb"); - if (file == nullptr) { - printf("fail to fopen %s\n", path); - goto EXIT2; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - printf("RandRead, open %s , task:%lld ms,\n", path, perTime / MS_PER_SEC); - - i = 0; - gettimeofday(&testTime1, 0); - - while (1) { - if (interface_type == 1) { - ret = read(fd, readBuf, g_grandSize[i]); - if (ret < 0) { - printf("ret = %d,%s read fail!-->(X)\n", ret, path); - goto EXIT1; - } - if (!ret) { - printf("warning: read ret = 0,\n"); - } - } else { - ret = fread(readBuf, 1, g_grandSize[i], file); - if (ret <= 0) { - if (feof(file) == 1) { - printf("feof of %s\n", path); - } else { - printf("fread error!\n"); - goto EXIT2; - } - } - } - total += ret; - totalSize += ret; - - if (total >= CAL_THRESHOLD) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * US_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_KBYTES / BYTES_PER_KBYTES; - - printf("rand_Read TaskID:%3d, times %d, read %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", taskId, - cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - - if (file_size <= totalSize) { - break; - } - if (++i >= MAX_DEF_BUF_NUM) - i = 0; - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * US_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_KBYTES / BYTES_PER_KBYTES; - printf("--------------------------------\n"); - printf("rand_Read TaskID:%3d ,total read=%lld , time=%lld,arv speed =%0.3lfMB/s ,\n", taskId, totalSize, totalTime, - testSpeed); - - gettimeofday(&testTime1, 0); - if (interface_type == 1) { - ret = close(fd); - if (ret < 0) { - printf("fail to close %s!\n", strerror(errno)); - } - } else { - ret = fclose(file); - if (ret < 0) { - printf("fail to fclose %s!\n", strerror(errno)); - } - } - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - printf(" rand_Read TaskID:%3d,fclose %s!,task:%lld ms,\n", taskId, path, perTime / MS_PER_SEC); - - ret = remove(path); - if (ret < 0) { - printf("fail to fclose %s!\n", strerror(errno)); - } - - printf("rand_Read TaskID:%3d,sucess to fread the %s,\n", taskId, path); - - free(readBuf); - return FAT_NO_ERROR; - -EXIT2: - fclose(file); - goto EXIT1; -EXIT1: - close(fd); -EXIT: - free(readBuf); - return FAT_NO_ERROR; -} - -VOID FatStrcat2(char *pathname, char *str, int len) -{ - (void)memset_s(pathname, len, 0, len); - (void)strcpy_s(pathname, len, FAT_PATH_NAME); - (void)strcat_s(pathname, len, str); -} - -INT32 FatScandirFree(struct dirent **namelist, int n) -{ - if (n < 0 || namelist == nullptr) { - return -1; - } else if (n == 0) { - free(namelist); - namelist = nullptr; - return 0; - } - while (n--) { - free(namelist[n]); - } - free(namelist); - namelist = nullptr; - - return 0; -} - -VOID FatStatPrintf(struct stat sb) -{ -#if VFS_STAT_PRINTF == 1 - - printf("File type: "); - - switch (sb.st_mode & S_IFMT) { - case S_IFBLK: - printf("block device\n"); - break; - case S_IFCHR: - printf("character device\n"); - break; - case S_IFDIR: - printf("directory\n"); - break; - case S_IFIFO: - printf("FIFO/pipe\n"); - break; - case S_IFLNK: - printf("symlink\n"); - break; - case S_IFREG: - printf("regular file\n"); - break; - case S_IFSOCK: - printf("socket\n"); - break; - default: - printf("unknown?\n"); - break; - } - - switch (sb.st_mode & S_IRWXU) { - case S_IRUSR: - printf("Owners have read permission\n"); - break; - case S_IWUSR: - printf("Owners have write permission\n"); - break; - case S_IXUSR: - printf("Owners have execute permissions\n"); - break; - default: - break; - } - - switch (sb.st_mode & S_IRWXG) { - case S_IRGRP: - printf("Group has read permission\n"); - break; - case S_IWGRP: - printf("Group has write permission\n"); - break; - case S_IXGRP: - printf("Group has execute permission\n"); - break; - default: - break; - } - - switch (sb.st_mode & S_IRWXO) { - case S_IROTH: - printf("Other have read permission\n"); - break; - case S_IWOTH: - printf("Other has write permission\n"); - break; - case S_IXOTH: - printf("Other has execute permission\n"); - break; - default: - break; - } - - printf("I-node number: %ld\n", (long)sb.st_ino); - printf("Mode: %lo (octal)\n", (unsigned long)sb.st_mode); - printf("Link count: %ld\n", (long)sb.st_nlink); - printf("Ownership: UID=%ld GID=%ld\n", (long)sb.st_uid, (long)sb.st_gid); - - printf("Preferred I/O block size: %ld bytes\n", (long)sb.st_blksize); - printf("File size: %lld bytes\n", (long long)sb.st_size); - printf("Blocks allocated: %lld\n", (long long)sb.st_blocks); - - printf("Last status change: %s", ctime(&sb.st_ctime)); - printf("Last file access: %s", ctime(&sb.st_atime)); - printf("Last file modification: %s\n\n", ctime(&sb.st_mtime)); - -#endif - return; -} - -VOID FatStatfsPrintf(struct statfs buf) -{ -#if VFS_STATFS_PRINTF == 1 - printf("type of file system : 0x%x\n", buf.f_type); - printf("optimal transfer block size : %ld\n", (long)buf.f_bsize); - printf("total data blocks in file system : %ld\n", (long)buf.f_blocks); - printf("free blocks in fs : %ld\n", (long)buf.f_bfree); - printf("free blocks available to unprivileged user : %ld\n", (long)buf.f_bavail); - printf("total file nodes in file system : %ld\n", (long)buf.f_files); - - printf("free file nodes in fs : %ld\n", (long)buf.f_ffree); - printf("file system id : %d\n", buf.f_fsid.__val[0]); - printf("maximum length of filenames : 0x%x\n", buf.f_namelen); - printf("fragment size: %d\n\n", buf.f_frsize); - -#endif - - return; -} - -using namespace testing::ext; -namespace OHOS { -class VfsFatTest : public testing::Test { -public: - static void SetUpTestCase(void) - { - INT32 ret = 0; - sleep(3); // 3s - - ret = mkdir("/vs/", S_IRWXU | S_IRWXG | S_IRWXO); - if (ret != 0) { - perror("mkdir mount dir"); - } - - ret = mkdir(FAT_MOUNT_DIR, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret != 0) { - perror("mkdir mount dir"); - } - - g_fatFilesystem = 2; - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, nullptr); - ASSERT_EQ(0, ret); - } - static void TearDownTestCase(void) - { - umount(FAT_MOUNT_DIR); - } -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -HWTEST_F(VfsFatTest, ItFsFat026, TestSize.Level0) -{ - ItFsFat026(); -} -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -HWTEST_F(VfsFatTest, ItFsFat066, TestSize.Level0) -{ - ItFsFat066(); -} - -HWTEST_F(VfsFatTest, ItFsFat068, TestSize.Level0) -{ - ItFsFat068(); -} - -HWTEST_F(VfsFatTest, ItFsFat072, TestSize.Level0) -{ - ItFsFat072(); -} - -HWTEST_F(VfsFatTest, ItFsFat073, TestSize.Level0) -{ - ItFsFat073(); -} - -HWTEST_F(VfsFatTest, ItFsFat074, TestSize.Level0) -{ - ItFsFat074(); -} - -HWTEST_F(VfsFatTest, ItFsFat496, TestSize.Level0) -{ - ItFsFat496(); -} - -HWTEST_F(VfsFatTest, ItFsFat497, TestSize.Level0) -{ - ItFsFat497(); -} - -HWTEST_F(VfsFatTest, ItFsFat498, TestSize.Level0) -{ - ItFsFat498(); -} - -HWTEST_F(VfsFatTest, ItFsFat499, TestSize.Level0) -{ - ItFsFat499(); -} - -HWTEST_F(VfsFatTest, ItFsFat500, TestSize.Level0) -{ - ItFsFat500(); -} - -HWTEST_F(VfsFatTest, ItFsFat501, TestSize.Level0) -{ - ItFsFat501(); -} - -HWTEST_F(VfsFatTest, ItFsFat502, TestSize.Level0) -{ - ItFsFat502(); -} - -HWTEST_F(VfsFatTest, ItFsFat503, TestSize.Level0) -{ - ItFsFat503(); -} - -HWTEST_F(VfsFatTest, ItFsFat504, TestSize.Level0) -{ - ItFsFat504(); -} - -HWTEST_F(VfsFatTest, ItFsFat506, TestSize.Level0) -{ - ItFsFat506(); -} - -HWTEST_F(VfsFatTest, ItFsFat507, TestSize.Level0) -{ - ItFsFat507(); -} - -HWTEST_F(VfsFatTest, ItFsFat508, TestSize.Level0) -{ - ItFsFat508(); -} - -HWTEST_F(VfsFatTest, ItFsFat509, TestSize.Level0) -{ - ItFsFat509(); -} - -HWTEST_F(VfsFatTest, ItFsFat510, TestSize.Level0) -{ - ItFsFat510(); -} - -HWTEST_F(VfsFatTest, ItFsFat511, TestSize.Level0) -{ - ItFsFat511(); -} - -HWTEST_F(VfsFatTest, ItFsFat512, TestSize.Level0) -{ - ItFsFat512(); -} - -HWTEST_F(VfsFatTest, ItFsFat513, TestSize.Level0) -{ - ItFsFat513(); -} - -HWTEST_F(VfsFatTest, ItFsFat514, TestSize.Level0) -{ - ItFsFat514(); -} - -HWTEST_F(VfsFatTest, ItFsFat515, TestSize.Level0) -{ - ItFsFat515(); -} - -HWTEST_F(VfsFatTest, ItFsFat516, TestSize.Level0) -{ - ItFsFat516(); -} - -HWTEST_F(VfsFatTest, ItFsFat517, TestSize.Level0) -{ - ItFsFat517(); -} - -HWTEST_F(VfsFatTest, ItFsFat518, TestSize.Level0) -{ - ItFsFat518(); -} - -HWTEST_F(VfsFatTest, ItFsFat519, TestSize.Level0) -{ - ItFsFat519(); -} - -HWTEST_F(VfsFatTest, ItFsFat662, TestSize.Level0) -{ - ItFsFat662(); -} - -HWTEST_F(VfsFatTest, ItFsFat663, TestSize.Level0) -{ - ItFsFat663(); -} - -HWTEST_F(VfsFatTest, ItFsFat664, TestSize.Level0) -{ - ItFsFat664(); -} - -HWTEST_F(VfsFatTest, ItFsFat665, TestSize.Level0) -{ - ItFsFat665(); -} - -HWTEST_F(VfsFatTest, ItFsFat666, TestSize.Level0) -{ - ItFsFat666(); -} - -HWTEST_F(VfsFatTest, ItFsFat667, TestSize.Level0) -{ - ItFsFat667(); -} - -HWTEST_F(VfsFatTest, ItFsFat668, TestSize.Level0) -{ - ItFsFat668(); -} - -HWTEST_F(VfsFatTest, ItFsFat669, TestSize.Level0) -{ - ItFsFat669(); -} - -HWTEST_F(VfsFatTest, ItFsFat670, TestSize.Level0) -{ - ItFsFat670(); -} - -HWTEST_F(VfsFatTest, ItFsFat671, TestSize.Level0) -{ - ItFsFat671(); -} - -HWTEST_F(VfsFatTest, ItFsFat672, TestSize.Level0) -{ - ItFsFat672(); -} - -HWTEST_F(VfsFatTest, ItFsFat673, TestSize.Level0) -{ - ItFsFat673(); -} - -HWTEST_F(VfsFatTest, ItFsFat674, TestSize.Level0) -{ - ItFsFat674(); -} - -HWTEST_F(VfsFatTest, ItFsFat675, TestSize.Level0) -{ - ItFsFat675(); -} - -HWTEST_F(VfsFatTest, ItFsFat676, TestSize.Level0) -{ - ItFsFat676(); -} - -HWTEST_F(VfsFatTest, ItFsFat677, TestSize.Level0) -{ - ItFsFat677(); -} - -HWTEST_F(VfsFatTest, ItFsFat678, TestSize.Level0) -{ - ItFsFat678(); -} - -HWTEST_F(VfsFatTest, ItFsFat679, TestSize.Level0) -{ - ItFsFat679(); -} - -HWTEST_F(VfsFatTest, ItFsFat680, TestSize.Level0) -{ - ItFsFat680(); -} - -HWTEST_F(VfsFatTest, ItFsFat681, TestSize.Level0) -{ - ItFsFat681(); -} - -HWTEST_F(VfsFatTest, ItFsFat682, TestSize.Level0) -{ - ItFsFat682(); -} - -HWTEST_F(VfsFatTest, ItFsFat683, TestSize.Level0) -{ - ItFsFat683(); -} - -HWTEST_F(VfsFatTest, ItFsFat684, TestSize.Level0) -{ - ItFsFat684(); -} - -HWTEST_F(VfsFatTest, ItFsFat685, TestSize.Level0) -{ - ItFsFat685(); -} - -HWTEST_F(VfsFatTest, ItFsFat686, TestSize.Level0) -{ - ItFsFat686(); -} - -HWTEST_F(VfsFatTest, ItFsFat687, TestSize.Level0) -{ - ItFsFat687(); -} - -HWTEST_F(VfsFatTest, ItFsFat692, TestSize.Level0) -{ - ItFsFat692(); -} - -HWTEST_F(VfsFatTest, ItFsFat693, TestSize.Level0) -{ - ItFsFat693(); -} - -HWTEST_F(VfsFatTest, ItFsFat694, TestSize.Level0) -{ - ItFsFat694(); -} - -HWTEST_F(VfsFatTest, ItFsFat870, TestSize.Level0) -{ - ItFsFat870(); -} - -HWTEST_F(VfsFatTest, ItFsFat872, TestSize.Level0) -{ - ItFsFat872(); -} - -HWTEST_F(VfsFatTest, ItFsFat873, TestSize.Level0) -{ - ItFsFat873(); -} - -HWTEST_F(VfsFatTest, ItFsFat874, TestSize.Level0) -{ - ItFsFat874(); -} - -HWTEST_F(VfsFatTest, ItFsFat875, TestSize.Level0) -{ - ItFsFat875(); -} - -HWTEST_F(VfsFatTest, ItFsFat902, TestSize.Level0) -{ - ItFsFat902(); -} - -HWTEST_F(VfsFatTest, ItFsFat903, TestSize.Level0) -{ - ItFsFat903(); -} - -HWTEST_F(VfsFatTest, ItFsFat904, TestSize.Level0) -{ - ItFsFat904(); -} - -HWTEST_F(VfsFatTest, ItFsFat909, TestSize.Level0) -{ - ItFsFat909(); // plug and unplug during writing or reading -} - -#endif // LOSCFG_USER_TEST_FULL - -#if defined(LOSCFG_USER_TEST_PRESSURE) -HWTEST_F(VfsFatTest, ItFsFatPressure040, TestSize.Level0) -{ - ItFsFatPressure040(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread046, TestSize.Level0) -{ - ItFsFatMutipthread046(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread047, TestSize.Level0) -{ - ItFsFatMutipthread047(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure030, TestSize.Level0) -{ - ItFsFatPressure030(); // time too long -} - -#if (FAT_FILE_SYSTEMTYPE_AUTO == FAT_FILE_SYSTEMTYPE_FAT32) -HWTEST_F(VfsFatTest, ItFsFatPressure031, TestSize.Level0) -{ - ItFsFatPressure031(); -} -#endif - -HWTEST_F(VfsFatTest, ItFsFatPressure038, TestSize.Level0) -{ - ItFsFatPressure038(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure041, TestSize.Level0) -{ - ItFsFatPressure041(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure042, TestSize.Level0) -{ - ItFsFatPressure042(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure301, TestSize.Level0) -{ - ItFsFatPressure301(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure302, TestSize.Level0) -{ - ItFsFatPressure302(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure303, TestSize.Level0) -{ - ItFsFatPressure303(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure305, TestSize.Level0) -{ - ItFsFatPressure305(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure306, TestSize.Level0) -{ - ItFsFatPressure306(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure309, TestSize.Level0) -{ - ItFsFatPressure309(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread003, TestSize.Level0) -{ - ItFsFatMutipthread003(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread004, TestSize.Level0) -{ - ItFsFatMutipthread004(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread005, TestSize.Level0) -{ - ItFsFatMutipthread005(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread006, TestSize.Level0) -{ - ItFsFatMutipthread006(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread008, TestSize.Level0) -{ - ItFsFatMutipthread008(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread009, TestSize.Level0) -{ - ItFsFatMutipthread009(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread010, TestSize.Level0) -{ - ItFsFatMutipthread010(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread012, TestSize.Level0) -{ - ItFsFatMutipthread012(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread014, TestSize.Level0) -{ - ItFsFatMutipthread014(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread016, TestSize.Level0) -{ - ItFsFatMutipthread016(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread017, TestSize.Level0) -{ - ItFsFatMutipthread017(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread018, TestSize.Level0) -{ - ItFsFatMutipthread018(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread019, TestSize.Level0) -{ - ItFsFatMutipthread019(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread020, TestSize.Level0) -{ - ItFsFatMutipthread020(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread021, TestSize.Level0) -{ - ItFsFatMutipthread021(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread022, TestSize.Level0) -{ - ItFsFatMutipthread022(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread023, TestSize.Level0) -{ - ItFsFatMutipthread023(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread024, TestSize.Level0) -{ - ItFsFatMutipthread024(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread027, TestSize.Level0) -{ - ItFsFatMutipthread027(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread029, TestSize.Level0) -{ - ItFsFatMutipthread029(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread030, TestSize.Level0) -{ - ItFsFatMutipthread030(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread032, TestSize.Level0) -{ - ItFsFatMutipthread032(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread033, TestSize.Level0) -{ - ItFsFatMutipthread033(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread035, TestSize.Level0) -{ - ItFsFatMutipthread035(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread036, TestSize.Level0) -{ - ItFsFatMutipthread036(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread038, TestSize.Level0) -{ - ItFsFatMutipthread038(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread039, TestSize.Level0) -{ - ItFsFatMutipthread039(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread040, TestSize.Level0) -{ - ItFsFatMutipthread040(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread041, TestSize.Level0) -{ - ItFsFatMutipthread041(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread042, TestSize.Level0) -{ - ItFsFatMutipthread042(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread043, TestSize.Level0) -{ - ItFsFatMutipthread043(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread044, TestSize.Level0) -{ - ItFsFatMutipthread044(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread045, TestSize.Level0) -{ - ItFsFatMutipthread045(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread048, TestSize.Level0) -{ - ItFsFatMutipthread048(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread049, TestSize.Level0) -{ - ItFsFatMutipthread049(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread050, TestSize.Level0) -{ - ItFsFatMutipthread050(); -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance013, TestSize.Level0) -{ - ItFsFatPerformance013(); -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance014, TestSize.Level0) -{ - ItFsFatPerformance014(); -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance015, TestSize.Level0) -{ - ItFsFatPerformance015(); -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance016, TestSize.Level0) -{ - ItFsFatPerformance016(); // Multi-threaded takes time to delete directory files When the fourth -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance001, TestSize.Level0) -{ - ItFsFatPerformance001(); // rand fwrite and fread for one pthread -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance006, TestSize.Level0) -{ - ItFsFatPerformance006(); // rand fwrite and fread for three pthread -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance002, TestSize.Level0) -{ - ItFsFatPerformance002(); // fix fwrite and fread for one pthread -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance005, TestSize.Level0) -{ - ItFsFatPerformance005(); // fix fwrite and fread for three pthread -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance003, TestSize.Level0) -{ - ItFsFatPerformance003(); // rand write and read for one pthread -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance004, TestSize.Level0) -{ - ItFsFatPerformance004(); // fix write and read for one pthread -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance007, TestSize.Level0) -{ - ItFsFatPerformance007(); // rand write and read for three pthread -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance008, TestSize.Level0) -{ - ItFsFatPerformance008(); // fix write and read for three pthread -} - -#endif // LOSCFG_USER_TEST_PRESSURE -} // namespace OHOS diff --git a/testsuites/unittest/fs/vfat/config.gni b/testsuites/unittest/fs/vfat/config.gni deleted file mode 100644 index a2a86510..00000000 --- a/testsuites/unittest/fs/vfat/config.gni +++ /dev/null @@ -1,172 +0,0 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. 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. -# -# 3. Neither the name of the copyright holder nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. - -import("//kernel/liteos_a/testsuites/unittest/config.gni") - -vfat_include_dirs = [ "$TEST_UNITTEST_DIR/fs/vfat" ] - -vfat_sources_entry = [ "$TEST_UNITTEST_DIR/fs/vfat/VfsFatTest.cpp" ] - -vfat_sources_smoke = [ "$TEST_UNITTEST_DIR/fs/vfat/smoke/It_vfs_fat_026.cpp" ] - -vfat_sources_pressure = [ - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_performance_001.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_performance_002.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_performance_003.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_performance_004.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_performance_005.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_performance_006.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_performance_007.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_performance_008.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_performance_013.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_performance_014.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_performance_015.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_performance_016.cpp", - - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_pressure_029.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_pressure_030.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_pressure_031.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_pressure_038.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_pressure_040.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_pressure_041.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_pressure_042.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_pressure_301.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_pressure_302.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_pressure_303.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_pressure_305.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_pressure_306.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_fs_fat_pressure_309.cpp", - - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_003.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_004.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_005.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_006.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_008.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_009.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_010.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_012.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_014.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_016.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_017.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_018.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_019.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_020.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_021.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_022.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_023.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_024.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_027.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_029.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_030.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_032.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_033.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_035.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_036.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_038.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_039.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_040.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_041.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_042.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_043.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_044.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_045.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_046.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_047.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_048.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_049.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/pressure/It_vfs_fat_mutipthread_050.cpp", -] - -vfat_sources_full = [ - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_066.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_068.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_072.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_073.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_074.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_496.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_497.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_498.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_499.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_500.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_501.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_502.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_503.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_504.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_506.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_507.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_508.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_509.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_510.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_511.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_512.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_513.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_514.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_515.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_516.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_517.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_518.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_519.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_662.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_663.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_664.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_665.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_666.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_667.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_668.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_669.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_670.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_671.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_672.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_673.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_674.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_675.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_676.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_677.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_678.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_679.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_680.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_681.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_682.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_683.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_684.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_685.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_686.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_687.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_692.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_693.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_694.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_870.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_872.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_873.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_874.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_875.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_902.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_903.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_904.cpp", - "$TEST_UNITTEST_DIR/fs/vfat/full/It_vfs_fat_909.cpp", -] diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_066.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_066.cpp deleted file mode 100644 index b3eae711..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_066.cpp +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static const int CLUSTER_SIZE4 = 4; -static const int CLUSTER_SIZE8 = 8; -static const int CLUSTER_SIZE16 = 16; -static const int CLUSTER_SIZE32 = 32; -static const int CLUSTER_SIZE64 = 64; -static const int CLUSTER_SIZE128 = 128; -static const int CLUSTER_SIZE255 = 255; -static const int CLUSTER_SIZE256 = 256; -static const int SECTOR_SIZE = 512; - -static UINT32 TestCase(VOID) -{ - INT32 ret; - struct stat buf = { 0 }; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(NULL, CLUSTER_SIZE8, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE8, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (g_fatFilesystem != FAT_FILE_SYSTEMTYPE_EXFAT) - ICUNIT_GOTO_EQUAL(buf.st_blksize, CLUSTER_SIZE64 * SECTOR_SIZE, buf.st_blksize, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE16, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(buf.st_blksize, CLUSTER_SIZE16 * SECTOR_SIZE, buf.st_blksize, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE32, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(buf.st_blksize, CLUSTER_SIZE32 * SECTOR_SIZE, buf.st_blksize, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE64, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(buf.st_blksize, CLUSTER_SIZE64 * SECTOR_SIZE, buf.st_blksize, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE128, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(buf.st_blksize, CLUSTER_SIZE128 * SECTOR_SIZE, buf.st_blksize, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE4, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(buf.st_blksize, CLUSTER_SIZE4 * SECTOR_SIZE, buf.st_blksize, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, 1, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(buf.st_blksize, SECTOR_SIZE, buf.st_blksize, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE255, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE256, FAT_FILE_SYSTEMTYPE_AUTO); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - else { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - } - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = remove(FAT_PATH_NAME); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE8, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(buf.st_blksize, CLUSTER_SIZE8 * SECTOR_SIZE, buf.st_blksize, EXIT1); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - return FAT_NO_ERROR; -EXIT2: - mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); -EXIT1: - rmdir(FAT_PATH_NAME); - - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_066 -* -@tspec The function test for filesystem -* -@ttitle Format the SD card with some different parameters -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. use access to check the directory whether is existed -3. format the SD card with different parameters; -4. repeat the above process several times. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat066(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_066", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_068.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_068.cpp deleted file mode 100644 index 454ce174..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_068.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static const int CLUSTER_SIZE = 8; - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_MAIN_DIR; - DIR *dir = NULL; - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - for (i = 0; i < FAT_PRESSURE_CYCLES; i++) { - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT2: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - goto EXIT; -EXIT1: - closedir(dir); -EXIT: - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_068 -* -@ttitle Repeat mount, format, umount, format the same SD card 20 times -* -@ttitle Repeat mount, format, umount, format the same SD card 20 times -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. mount, format, umount, format the same SD; -3. repeat the above processre 20 times; -4. format the SD card once more. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat068(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_068", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_072.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_072.cpp deleted file mode 100644 index 304c62b6..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_072.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static const INT32 CLUSTER_SIZE8 = 8; - -static UINT32 TestCase(VOID) -{ - INT32 ret; - DIR *dir = NULL; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE8, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - dir = opendir(FAT_MAIN_DIR); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE8, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - return FAT_NO_ERROR; -EXIT2: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - goto EXIT; -EXIT1: - closedir(dir); -EXIT: - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_072 -* -@tspec The function test for filesystem -* -@ttitle Repeat mount the the file system to the same directory -* -@tprecon The filesystem module is open -* -@tbrief -1. check the filesysterm is existed or not; -2. umount the filesystem; -3. mount the filesystem; -4. repeat mount the the file system to the same directory. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Failed operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat072(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_072", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_073.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_073.cpp deleted file mode 100644 index 936938d2..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_073.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. - */ - - * PURPOSE ARE DISCLAIMED. IN - * NO EVENT SHALL THE COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static const INT32 CLUSTER_SIZE8 = 8; - -static UINT32 TestCase(VOID) -{ - INT32 ret; - DIR *dir = NULL; - - dir = opendir(FAT_MAIN_DIR); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE8, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - return FAT_NO_ERROR; -EXIT2: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - goto EXIT; -EXIT1: - closedir(dir); -EXIT: - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_073 -* -@tspec The function test for filesystem -* -@ttitle Repeat umount the the same file system -* -@tprecon The filesystem module is open -* -@tbrief -1. check the filesysterm is existed or not; -2. umount the filesystem; -3. repeat umount the filesystem; -4. mount the the file system normally. -* -@texpect -1. Return successed -2. Return successed -3. Return failed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat073(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_073", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_074.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_074.cpp deleted file mode 100644 index b4631bbd..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_074.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. - */ - - * PURPOSE ARE DISCLAIMED. IN - * NO EVENT SHALL THE COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd1 = 0; - INT32 i = 0; - INT32 len; - CHAR filebuf[FAT_STANDARD_NAME_LENGTH] = "abcdeabcde"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/test"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, FAT_IS_ERROR, fd1, EXIT1); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - for (i = 0; i < FAT_MOUNT_CYCLES_TEST; i++) { - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, i, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, i, EXIT2); - } - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, FAT_IS_ERROR, fd1, EXIT1); - - len = read(fd1, readbuf, FAT_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT2: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); -EXIT1: - close(fd1); - remove(pathname1); -EXIT: - remove(FAT_PATH_NAME); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_074 -* -@tspec The function test for filesystem -* -@ttitle Mount/umount the file system several times -* -@tprecon The filesystem module is open -* -@tbrief -1. create one file and write some data into it; -2. mount/umount the file system several times; -3. open the file and check the file`s content; -4. close and delete the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat074(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_074", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_496.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_496.cpp deleted file mode 100644 index 7b2ee972..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_496.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/589.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = ioctl(fd, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - chdir(SD_MOUNT_DIR); - remove(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat496(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_496", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_497.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_497.cpp deleted file mode 100644 index f60fa2cb..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_497.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/590.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - ret = ioctl(fd, 0, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - return FAT_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - chdir(SD_MOUNT_DIR); - remove(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat497(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_497", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_498.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_498.cpp deleted file mode 100644 index a819c63b..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_498.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - ret = ioctl(fd, 1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - return FAT_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - chdir(SD_MOUNT_DIR); - remove(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat498(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_498", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_499.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_499.cpp deleted file mode 100644 index 9045f20e..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_499.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - ret = ioctl(fd, 0xffff, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - return FAT_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - chdir(SD_MOUNT_DIR); - remove(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat499(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_499", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_500.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_500.cpp deleted file mode 100644 index 46886876..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_500.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - ret = ioctl(fd, -1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - return FAT_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - chdir(SD_MOUNT_DIR); - remove(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat500(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_500", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_501.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_501.cpp deleted file mode 100644 index 6b91fa70..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_501.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static const int IOCTL_CMD = 10; - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/594.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - ret = ioctl(fd, IOCTL_CMD, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - return FAT_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - chdir(SD_MOUNT_DIR); - remove(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat501(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_501", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_502.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_502.cpp deleted file mode 100644 index 6432a4b1..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_502.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/595.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - ret = ioctl(fd, 0, 1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - return FAT_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - chdir(SD_MOUNT_DIR); - remove(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat502(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_502", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_503.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_503.cpp deleted file mode 100644 index 2b285c87..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_503.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/596.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - ret = ioctl(fd, 0, 0xffff); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - return FAT_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - chdir(SD_MOUNT_DIR); - remove(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat503(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_503", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_504.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_504.cpp deleted file mode 100644 index 3900e35b..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_504.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = "/dev/mmcblk0p0"; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = format(pathname, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - return FAT_NO_ERROR; -EXIT1: - mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFat504(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_504", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_506.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_506.cpp deleted file mode 100644 index 361e8941..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_506.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = "//"; - - ret = umount(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = format(pathname, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = mount(FAT_DEV_PATH1, SD_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - return FAT_NO_ERROR; -EXIT2: - mount(FAT_DEV_PATH1, SD_MOUNT_DIR, "vfat", 0, NULL); -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFat506(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_506", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_507.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_507.cpp deleted file mode 100644 index 7e0315e0..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_507.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = "/"; - - ret = format(pathname, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - return FAT_NO_ERROR; -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFat507(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_507", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_508.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_508.cpp deleted file mode 100644 index 3e907bc8..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_508.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[302] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij" - "9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789" - "abcedfghij9876543210abcdeabcde0123456789abcedfghij987654321011111111112222222222"; - - ret = format(pathname, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT); - - return FAT_NO_ERROR; -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFat508(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_508", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_509.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_509.cpp deleted file mode 100644 index 8f8f1839..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_509.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = "+-/*%^@"; - - ret = format(pathname, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - return FAT_NO_ERROR; -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFat509(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_509", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_510.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_510.cpp deleted file mode 100644 index 766f0cd6..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_510.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - - ret = format(pathname, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - return FAT_NO_ERROR; -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFat510(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_510", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_511.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_511.cpp deleted file mode 100644 index 010bd957..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_511.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. - */ - - * PURPOSE ARE DISCLAIMED. IN - * NO EVENT SHALL THE COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ".."; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = format(pathname1, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - chdir(SD_MOUNT_DIR); - rmdir(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat511(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_511", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_512.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_512.cpp deleted file mode 100644 index 073a0f91..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_512.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. - */ - - * PURPOSE ARE DISCLAIMED. IN - * NO EVENT SHALL THE COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = "."; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = format(pathname1, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - chdir(SD_MOUNT_DIR); - rmdir(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat512(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_512", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_513.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_513.cpp deleted file mode 100644 index 7074ffe2..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_513.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = "" - ""; - - ret = format(pathname, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - return FAT_NO_ERROR; -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFat513(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_513", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_514.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_514.cpp deleted file mode 100644 index fb87cdce..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_514.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = format(pathname1, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - rmdir(pathname1); - return FAT_NO_ERROR; -} - -VOID ItFsFat514(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_514", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_515.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_515.cpp deleted file mode 100644 index b1318048..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_515.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd = 0; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = format(pathname1, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -VOID ItFsFat515(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_515", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_516.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_516.cpp deleted file mode 100644 index 093c1d2b..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_516.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 err; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = "/dev/nandblk0"; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = "/dev/spinor"; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = "/dev/uartdev-0"; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = "/dev/mmcblk"; - - ret = format(pathname1, 0, FAT_FILE_SYSTEMTYPE_AUTO); - printf("errno = %d\n", errno); - err = errno; - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(err, ENODEV, err, EXIT); - - ret = format(pathname2, 0, FAT_FILE_SYSTEMTYPE_AUTO); - err = errno; - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(err, ENODEV, err, EXIT); - - ret = format(pathname3, 0, FAT_FILE_SYSTEMTYPE_AUTO); - err = errno; - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(err, ENODEV, err, EXIT); - - ret = format(pathname4, 0, FAT_FILE_SYSTEMTYPE_AUTO); - err = errno; - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(err, ENODEV, err, EXIT); - - return FAT_NO_ERROR; -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFat516(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_516", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_517.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_517.cpp deleted file mode 100644 index b35ca4d3..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_517.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_DEV_PATH; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = format(pathname1, -1, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = access(pathname2, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - rmdir(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat517(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_517", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_518.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_518.cpp deleted file mode 100644 index f70dec37..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_518.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_DEV_PATH; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = format(pathname1, 0XFFFC, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = access(pathname2, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - rmdir(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat518(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_518", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_519.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_519.cpp deleted file mode 100644 index cedf3d17..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_519.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_DEV_PATH; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = format(pathname1, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = access(pathname2, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); -EXIT: - rmdir(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat519(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_519", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_662.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_662.cpp deleted file mode 100644 index 0088b214..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_662.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static const off_t LEN = 20971520; - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate(fd, 1, 0, LEN); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_662 -* -@tspec The function test for fallocate and fallocate64 -* -@ttitle The function test for fallocate and fallocate64 with the fd has been closed for the first parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the close to close the file; -3. use the fallocate and fallocate64 to apply the space; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Failed operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat662(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_662", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_663.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_663.cpp deleted file mode 100644 index 3dfc5c0f..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_663.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret < 0 && errno != EEXIST) { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_DIRECTORY, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_663 -* -@tspec The function test for fallocate and fallocate64 -* -@ttitle The function test for fallocate and fallocate64 that the fd open wth the directory -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open a directory; -2. use the fallocate and fallocate64 to apply the space; -3. delete the directory; -4. N/A. -* -@texpect -1. Return successed -2. Return failed -3. Successful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat663(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_663", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_664.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_664.cpp deleted file mode 100644 index 718d5ed2..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_664.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - struct statfs buf3 = { 0 }; - struct statfs buf4 = { 0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = fallocate(fd, -1, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, -1, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ret = fallocate(fd, FAT_FALLOCATE_NO_KEEP_SIZE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_NO_KEEP_SIZE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = statfs(pathname1, &buf4); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - FatStatfsPrintf(buf4); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_664 -* -@tspec The API test for fallocate and fallocate64 -* -@ttitle The API test for fallocate and fallocate64 with -1 and 0 for the second parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate and fallocate64 to apply the space with -1 and 0 for the second parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return failed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat664(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_664", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_665.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_665.cpp deleted file mode 100644 index a52b5396..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_665.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static const int WRONG_MODE = 10; - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, WRONG_MODE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, WRONG_MODE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_665 -* -@tspec The API test for fallocate fallocate64 -* -@ttitle The API test for fallocate fallocate64 with 10 for the second parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with 10 for the second parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return failed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat665(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_665", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_666.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_666.cpp deleted file mode 100644 index f1e6dd9b..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_666.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, 0xffff, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, 0xffff, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_666 -* -@tspec The API test for fallocate fallocate64 -* -@ttitle The API test for fallocate fallocate64 with 0xffff for the second parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with 0xffff for the second parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return failed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat666(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_666", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_667.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_667.cpp deleted file mode 100644 index 7d0ac9db..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_667.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, -1, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, -1, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_667 -* -@tspec The API test for fallocate fallocate64 -* -@ttitle The API test for fallocate fallocate64 with -1 for the third parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with -1 for the third parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return failed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat667(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_667", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_668.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_668.cpp deleted file mode 100644 index 3cfe6814..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_668.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static const off_t OFFSET = 10; - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, OFFSET, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, OFFSET, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_668 -* -@tspec The API test for fallocate fallocate64 -* -@ttitle The API test for fallocate fallocate64 with 10 for the third parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with 10 for the third parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return failed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat668(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_668", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_669.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_669.cpp deleted file mode 100644 index 6bbeb5dd..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_669.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. - */ - - * PURPOSE ARE DISCLAIMED. IN - * NO EVENT SHALL THE COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0xffff, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0xffff, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_669 -* -@tspec The API test for fallocate fallocate64 -* -@ttitle The API test for fallocate fallocate64 with 0xffff for the third parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with 0xffff for the third parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return failed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat669(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_669", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_670.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_670.cpp deleted file mode 100644 index a12f5db8..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_670.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. - */ - - * PURPOSE ARE DISCLAIMED. IN - * NO EVENT SHALL THE COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_670 -* -@tspec The API test for fallocate fallocate64 -* -@ttitle The API test for fallocate fallocate64 with 0 for the fourth parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with 0 for the fourth parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return failed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat670(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_670", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_671.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_671.cpp deleted file mode 100644 index 33e2e0a4..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_671.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, -1); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, -1); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_671 -* -@tspec The API test for fallocate fallocate64 -* -@ttitle The API test for fallocate fallocate64 with -1 for the fourth parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with -1 for the fourth parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return failed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat671(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_671", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_672.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_672.cpp deleted file mode 100644 index 060e23c7..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_672.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR const writebuf[FAT_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0xffff); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0xffff); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_672 -* -@tspec The API test for fallocate -* -@ttitle The API test for fallocate with 50 for the fourth parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate to apply the space with 50 for the fourth parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat672(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_672", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_673.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_673.cpp deleted file mode 100644 index 17c0dc37..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_673.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - INT32 len = 0; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR const writebuf[FAT_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0xffffffff); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0xffffffffffffffff); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0xffff); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_673 -* -@tspec The API test for fallocate fallocate64 -* -@ttitle The API test for fallocate fallocate64 with 0xffff for the fourth parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with 0xffff for the fourth parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat673(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_673", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_674.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_674.cpp deleted file mode 100644 index 735e2e9e..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_674.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *writebuf = NULL; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - off_t off; - - writebuf = (CHAR *)malloc(size); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); - (void)memset_s(writebuf, size, 0x61, size); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, (size - 1)); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, (size - 1)); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - free(writebuf); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - free(writebuf); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_674 -* -@tspec The function test for fallocate fallocate64 -* -@ttitle The function test for fallocate fallocate64 with the length smaller than write -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with the length smaller than write; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat674(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_674", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_675.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_675.cpp deleted file mode 100644 index bc4bb271..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_675.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *writebuf = NULL; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - off_t off; - - writebuf = (CHAR *)malloc(size); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); - (void)memset_s(writebuf, size, 0x61, size); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - free(writebuf); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - free(writebuf); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_675 -* -@tspec The function test for fallocate fallocate64 -* -@ttitle The function test for fallocate fallocate64 with the length equals to write -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with the length equals to write; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat675(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_675", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_676.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_676.cpp deleted file mode 100644 index c1cdb56a..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_676.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR const writebuf[FAT_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bavail, buf2.f_bavail, buf1.f_bavail, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bfree, buf2.f_bfree, buf1.f_bfree, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_676 -* -@tspec The function test for fallocate fallocate64 -* -@ttitle The function test for fallocate fallocate64 with the length is 2GB -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with the length is 2GB; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat676(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_676", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_677.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_677.cpp deleted file mode 100644 index d263fda9..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_677.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR const writebuf[FAT_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bavail, buf2.f_bavail, buf1.f_bavail, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bfree, buf2.f_bfree, buf1.f_bfree, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bavail, buf2.f_bavail, buf1.f_bavail, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bfree, buf2.f_bfree, buf1.f_bfree, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bavail, buf2.f_bavail, buf1.f_bavail, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bfree, buf2.f_bfree, buf1.f_bfree, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_677 -* -@tspec The function test for fallocate fallocate64 -* -@ttitle The function test for fallocate fallocate64 with the length is 2GB+1 -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with the length is 2GB+1; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat677(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_677", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_678.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_678.cpp deleted file mode 100644 index d71d004b..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_678.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR const writebuf[FAT_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0x7FFFFFFF); // 2GB-1 - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_678 -* -@tspec The function test for fallocate fallocate64 -* -@ttitle The function test for fallocate fallocate64 with the length is 2GB-1 -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with the length is 2GB-1; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat678(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_678", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_679.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_679.cpp deleted file mode 100644 index cc77fadf..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_679.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *writebuf = NULL; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - off_t off; - - writebuf = (CHAR *)malloc(size); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); - (void)memset_s(writebuf, size, 0x61, size); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, -size, size); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, -size, size); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, size, off, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - free(writebuf); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - free(writebuf); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_679 -* -@tspec The function test for fallocate fallocate64 -* -@ttitle Fallocate allocates space while the offset + length is equal to the size of the file -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one non-empty file; -2. use the function fallocate fallocate64 to allocates space while the offset + length is equal to the size of the file -; -3. compare the file size before and after fallocate fallocate64; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat679(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_679", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_680.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_680.cpp deleted file mode 100644 index eb47e25e..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_680.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *writebuf = NULL; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - struct statfs buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - off_t off; - - writebuf = (CHAR *)malloc(size); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); - (void)memset_s(writebuf, size, 0x61, size); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf3); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size + FAT_STANDARD_NAME_LENGTH); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, -size, FAT_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf3.st_size, size, buf3.st_size, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf3); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size + FAT_STANDARD_NAME_LENGTH); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, -size, FAT_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf3.st_size, size, buf3.st_size, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - free(writebuf); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - free(writebuf); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_680 -* -@tspec The function test for fallocate fallocate64 -* -@ttitle Fallocate allocates space while the offset + length is more than the size of the file -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one non-empty file; -2. use the function fallocate fallocate64 to allocates space while the offset + length is more than the size of the file -; -3. compare the file size before and after fallocate fallocate64; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat680(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_680", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_681.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_681.cpp deleted file mode 100644 index 07d0ffa1..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_681.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = "lala"; - struct statfs buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct statfs buf3 = { 0 }; - struct stat buf4 = { 0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "lala", readbuf, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf4); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf3); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - ICUNIT_GOTO_EQUAL(buf4.st_size, 0, buf4.st_size, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "lala", readbuf, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf4); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf3); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - ICUNIT_GOTO_EQUAL(buf4.st_size, 0, buf4.st_size, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_681 -* -@tspec The function test for fallocate fallocate64 -* -@ttitle Read the file then use the fallocate fallocate64 -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. write something in the file and then read it; -3. compare the file size before and after fallocate fallocate64; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat681(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_681", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_682.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_682.cpp deleted file mode 100644 index 86250d46..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_682.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - struct statfs buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf3); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf3.st_size, 10, buf3.st_size, EXIT1); // file size 10 bytes - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_682 -* -@tspec The function test for fallocate -* -@ttitle Fallocate the read_only file then check whether the file size is changed -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one read_only file; -2. use the function fallocate to apply the space ; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat682(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_682", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_683.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_683.cpp deleted file mode 100644 index e5996fea..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_683.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR const writebuf[FAT_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - struct statfs buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_WRONLY, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf3); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - ICUNIT_GOTO_EQUAL(buf3.st_size, 10, buf3.st_size, EXIT1); // file size 10 bytes - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_WRONLY, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf3); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - ICUNIT_GOTO_EQUAL(buf3.st_size, 10, buf3.st_size, EXIT1); // file size 10 bytes - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_683 -* -@tspec The function test for fallocate -* -@ttitle Fallocate the write_only file then check whether the file size is changed -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one write_only file; -2. use the function fallocate to apply the space ; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat683(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_683", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_684.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_684.cpp deleted file mode 100644 index c5860b06..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_684.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static const off_t LEN = 10; - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 i = 0; - INT32 size = 0x4000000; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct statfs buf1 = { 0 }; - struct statfs buf3 = { 0 }; - struct stat buf5 = { 0 }; - struct stat buf6 = { 0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf5); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, LEN); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf3); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - for (i = 0; i < FAT_SHORT_ARRAY_LENGTH; i++) { - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = ftruncate(fd, 0x400); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = ftruncate64(fd, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = ftruncate64(fd, 0x400); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname1, &buf6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf6); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) - ICUNIT_GOTO_EQUAL(buf6.st_size, 0, buf6.st_size, EXIT1); - else - ICUNIT_GOTO_EQUAL(buf6.st_size, 0x400, buf6.st_size, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, LEN, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_VFAT_684 -* -@tspec The function test for fallocate -* -@ttitle Fallocate apply space for the same file fd multiple times -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one file; -2. use the function fallocate to apply the space for the same file fd multiple times; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat684(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_684", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_685.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_685.cpp deleted file mode 100644 index 7dc484b6..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_685.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. - */ - - * PURPOSE ARE DISCLAIMED. IN - * NO EVENT SHALL THE COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *writebuf = NULL; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - struct statfs buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - off_t off; - - writebuf = (CHAR *)malloc(size); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); - (void)memset_s(writebuf, size, 0x61, size); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf3); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size - 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size - 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - ICUNIT_GOTO_EQUAL(buf3.st_size, size, buf3.st_size, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - free(writebuf); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - free(writebuf); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_685 -* -@tspec The function test for fallocate -* -@ttitle Fallocate allocates space while the offset + length is smaller than the size of the file -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one non-empty file; -2. use the function fallocate to allocates space while the offset + length is smaller than the size of the file ; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat685(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_685", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_686.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_686.cpp deleted file mode 100644 index 2fb3e242..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_686.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. - */ - - * PURPOSE ARE DISCLAIMED. IN - * NO EVENT SHALL THE COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static const int SIZE_DIVIDER = 2; - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *writebuf = NULL; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - off_t off; - - writebuf = (CHAR *)malloc(size + 1); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); - (void)memset_s(writebuf, size + 1, 0, size + 1); - ret = memset_s(writebuf, size + 1, 0x61, size); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, (strlen(writebuf) / SIZE_DIVIDER), - (strlen(writebuf) - (strlen(writebuf) / SIZE_DIVIDER))); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, (strlen(writebuf) / SIZE_DIVIDER), strlen(writebuf)); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, (strlen(writebuf) / SIZE_DIVIDER), 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, (strlen(writebuf) / SIZE_DIVIDER), - (strlen(writebuf) - (strlen(writebuf) / 2))); // divid the size by 2, get half size - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, (strlen(writebuf) / SIZE_DIVIDER), strlen(writebuf)); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, (strlen(writebuf) / SIZE_DIVIDER), 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - free(writebuf); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - free(writebuf); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_686 -* -@tspec The function test for fallocate -* -@ttitle Fallocate allocates space while the position is in the file -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one non-empty file; -2. use the function fallocate to allocates space while the position is in the file ; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat686(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_686", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_687.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_687.cpp deleted file mode 100644 index 2ec2b1a0..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_687.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *writebuf = NULL; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - off_t off; - - writebuf = (CHAR *)malloc(size); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); - (void)memset_s(writebuf, size, 0x61, size); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, strlen(writebuf), -FAT_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, off, strlen(writebuf)); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, strlen(writebuf), -FAT_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, off, strlen(writebuf)); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - free(writebuf); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - free(writebuf); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_687 -* -@tspec The function test for fallocate -* -@ttitle Fallocate allocates space while the position is end of the file -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one non-empty file; -2. use the function fallocate to allocates space while the position is end of the file ; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat687(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_687", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_692.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_692.cpp deleted file mode 100644 index 1ed3c642..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_692.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 size = 0x4000000; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct statfs buf1 = { 0 }; - struct stat buf2 = { 0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_692 -* -@tspec The function test for fallocate -* -@ttitle Fallocate apply space while the file is O_RDONLY -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one file; -2. use the function fallocate to apply the space while the file is O_RDONLY; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat692(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_692", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_693.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_693.cpp deleted file mode 100644 index 25546c2f..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_693.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 size = 0x4000000; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct statfs buf1 = { 0 }; - struct stat buf2 = { 0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_WRONLY, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (FAT_FILE_SYSTEMTYPE_AUTO == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EPERM, errno, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_693 -* -@tspec The function test for fallocate -* -@ttitle Fallocate apply space while the file is O_WRONLY -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one file; -2. use the function fallocate to apply the space while the file is O_WRONLY; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat693(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_693", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_694.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_694.cpp deleted file mode 100644 index e9c03aa2..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_694.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = ftruncate(fd, 0x400); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = ftruncate64(fd, 0x400); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_VFAT_694 -* -@tspec The API test for truncate -* -@ttitle The API test for truncate with the fd has been closed for the first parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the close to close the file; -3. use the truncate to recover the space; -4. remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return failed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat694(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_694", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_870.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_870.cpp deleted file mode 100644 index ca8fe880..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_870.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite = NULL; - CHAR *bufWrite1 = NULL; - CHAR *bufWrite2 = NULL; - struct stat64 buf1 = { 0 }; - struct stat64 buf2 = { 0 }; - - g_testCount = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - bufWrite = (CHAR *)malloc(8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, 0, 8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite, BYTES_PER_MBYTES, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - ret = memset_s(bufWrite2, 16 * BYTES_PER_KBYTES, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES, filebuf); // 16 * BYTES_PER_KBYTES = 16kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES, filebuf); // 16 * BYTES_PER_KBYTES = 16kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES, filebuf); // 16 * BYTES_PER_KBYTES = 16kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES, filebuf); // 16 * BYTES_PER_KBYTES = 16kb - } - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES, bufWrite2); // BYTES_PER_MBYTES = 1MB - } - - for (i = 0; i < 4; i++) { // loop 4 times - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES, bufWrite1); // 8 * BYTES_PER_MBYTES = 8MB - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES, bufWrite1); // 8 * BYTES_PER_MBYTES = 8MB - } - - free(bufWrite1); - free(bufWrite2); - - g_testCount++; - - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, "/031.txt"); - - g_fatFd = open64(g_fatPathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd, FAT_IS_ERROR, g_fatFd, EXIT2); - - while (1) { - ret = write(g_fatFd, bufWrite, strlen(bufWrite)); - if (ret <= 0) { - if (g_testCount < (4 * BYTES_PER_KBYTES / 8)) { // 4 * BYTES_PER_KBYTES MB/GB, 8MB per write - printf("The biggest file size is smaller than the 4GB\n"); - goto EXIT2; - } - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - if (g_testCount >= 256 + 1) { // write more than 256 times for 4GB // write more than 256 times for 4GB - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - g_testCount++; - } - - ret = stat64(g_fatPathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = fstat64(g_fatFd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT2); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT2); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT2); - ICUNIT_GOTO_EQUAL(buf1.st_mode, buf2.st_mode, buf1.st_mode, EXIT2); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT2); - - ICUNIT_GOTO_EQUAL(buf1.st_size, (off64_t)g_testCount * 8 * BYTES_PER_MBYTES, // 8 mb per write - buf1.st_size, EXIT2); - - free(bufWrite); - - ret = close(g_fatFd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(g_fatPathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = remove(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - close(g_fatFd); -EXIT0: - remove(g_fatPathname1); -EXIT: - remove(pathname); - return FAT_NO_ERROR; -} - -/* * - * @defgroup los_fsoperationbigfile 鎿嶄綔瓒呰繃2G澶у皬鐨勬枃浠 - */ - -/* * - * @ingroup los_fsoperationbigfile - * @par type: void - * API test - * @brief function 鎿嶄綔瓒呰繃2G澶у皬鐨勬枃浠 - * @par description锛歸rite the file size to 2GB and function it - * @par precon: task moudle open - * @par step: see description - * create 2GB file \n - * function this file - * @par expect: nothing - * create file successful \n - * operator it successful,return successed - * @par prior: void - */ - -VOID ItFsFat870(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_870", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_872.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_872.cpp deleted file mode 100644 index 2d3eb15a..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_872.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - off64_t ret1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - - g_testCount = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - bufWrite = (CHAR *)malloc(8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 8 * BYTES_PER_MBYTES, 0, 8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // 16 * 4 * 256 = 16K - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - } - - for (j = 0; j < 16; j++) { // 16 * 4 * 16K = 1M - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - } - - for (i = 0; i < 4; i++) { // 4 * 2 * 1M = 8M - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, bufWrite1); // 8 * BYTES_PER_KBYTES = 8KB - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, bufWrite1); // 8 * BYTES_PER_KBYTES = 8KB - } - - free(bufWrite1); - free(bufWrite2); - - g_testCount++; - - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, "/031.txt"); - - g_fatFfd = fopen64(g_fatPathname1, "w+"); - ICUNIT_GOTO_NOT_EQUAL(g_fatFfd, nullptr, g_fatFfd, EXIT2); - - while (1) { - ret = fwrite(bufWrite, strlen(bufWrite), 1, g_fatFfd); - if (ret <= 0) { - if (g_testCount < (4 * BYTES_PER_KBYTES / 8)) { // 4 * BYTES_PER_KBYTES MB/GB, 8MB per write - printf("The biggest file size is smaller than the 4GB"); - goto EXIT2; - } - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - if (g_testCount >= 256 + 1) { // write more than 256 times for 4GB - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - g_testCount++; - } - - ret = fseeko64(g_fatFfd, -1, SEEK_END); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret1 = ftello64(g_fatFfd); - ICUNIT_GOTO_EQUAL(ret1, (off64_t)(g_testCount * 8 * BYTES_PER_MBYTES - 1), ret1, // 8 mb - EXIT2); // 8 * BYTES_PER_MBYTES = 8MB - - ret = fseeko64(g_fatFfd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret1 = ftello64(g_fatFfd); - ICUNIT_GOTO_EQUAL(ret1, (off64_t)(g_testCount * 8 * BYTES_PER_MBYTES - 1), ret1, // 8 mb - EXIT2); // 8 * BYTES_PER_MBYTES = 8MB - - ret = fseeko64(g_fatFfd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret1 = ftello64(g_fatFfd); - ICUNIT_GOTO_EQUAL(ret1, 0, ret1, EXIT2); - - free(bufWrite); - - ret = fclose(g_fatFfd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(g_fatPathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = remove(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - fclose(g_fatFfd); -EXIT0: - remove(g_fatPathname1); -EXIT: - remove(pathname); - return FAT_NO_ERROR; -} - -/* * - * @ingroup los_fsoperationbigfile - * @par type: void - * API test - * @brief ftello64 鎿嶄綔瓒呰繃2G澶у皬鐨勬枃浠 - * @par description锛 write the file size to 2GB and ftello64 it - * @par precon: task moudle open - * @par step: see below - * create 2GB file \n - * ftello64 this file - * @par expect: see below - * create file successful \n - * operator it successful,return successed - * @par prior: nothing - */ - -VOID ItFsFat872(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_872", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_873.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_873.cpp deleted file mode 100644 index 9c4344e2..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_873.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - - g_testCount = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - bufWrite = (CHAR *)malloc(8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 8 * BYTES_PER_MBYTES, 0, 8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // 16 * 4 * 256 = 16K - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - } - - for (j = 0; j < 16; j++) { // 16 * 4 * 16K = 1M - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - } - - for (i = 0; i < 4; i++) { // 4 * 2 * 1M = 8M - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, bufWrite1); // 8 * BYTES_PER_KBYTES = 8KB - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, bufWrite1); // 8 * BYTES_PER_KBYTES = 8KB - } - - free(bufWrite1); - free(bufWrite2); - - g_testCount++; - - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, "/031.txt"); - - g_fatFfd = fopen64(g_fatPathname1, "w+"); - ICUNIT_GOTO_NOT_EQUAL(g_fatFfd, nullptr, g_fatFfd, EXIT2); - - while (1) { - ret = fwrite(bufWrite, strlen(bufWrite), 1, g_fatFfd); - if (ret <= 0) { - if (g_testCount < (4 * BYTES_PER_KBYTES / 8)) { // 4 * BYTES_PER_KBYTES MB/GB, 8MB per write - printf("The biggest file size is smaller than the 4GB,count = :%d,%d", g_testCount, errno); - goto EXIT2; - } - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - if (g_testCount >= 256 + 1) { // write more than 256 times for 4GB - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - g_testCount++; - } - - free(bufWrite); - - ret = fclose(g_fatFfd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - g_fatFfd = fopen64(g_fatPathname1, "w+"); - ICUNIT_GOTO_NOT_EQUAL(g_fatFfd, nullptr, g_fatFfd, EXIT2); - - ret = fclose(g_fatFfd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(g_fatPathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = remove(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - fclose(g_fatFfd); -EXIT0: - remove(g_fatPathname1); -EXIT: - remove(pathname); - return FAT_NO_ERROR; -} - -/* * - * @ingroup los_fsoperationbigfile - * @par type: void - * API test - * @brief fopen64 鎿嶄綔瓒呰繃2G澶у皬鐨勬枃浠 - * @par description锛 write the file size to 2GB and fopen64 it - * @par precon: task moudle open - * @par step: see below - * create 2GB file \n - * fopen64 this file - * @par expect: see below - * create file successful \n - * operator it successful,return successed - * @par prior: nothing - */ - -VOID ItFsFat873(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_873", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_874.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_874.cpp deleted file mode 100644 index 59a59dd0..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_874.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - INT32 len; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite = NULL; - CHAR *bufWrite1 = NULL; - CHAR *bufWrite2 = NULL; - CHAR *readbuf = NULL; - - g_testCount = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - bufWrite = (CHAR *)malloc(8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 8 * BYTES_PER_MBYTES, 0, 8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // 16 * 4 * 256 = 16K - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - } - - for (j = 0; j < 16; j++) { // 16 * 4 * 16K = 1M - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - } - - for (i = 0; i < 4; i++) { // 4 * 2 * 1M = 8M - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, bufWrite1); // 8 * BYTES_PER_KBYTES = 8KB - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, bufWrite1); // 8 * BYTES_PER_KBYTES = 8KB - } - - free(bufWrite1); - free(bufWrite2); - - g_testCount++; - - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, "/031.txt"); - - g_fatFd = open64(g_fatPathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd, FAT_IS_ERROR, g_fatFd, EXIT2); - - while (1) { - ret = write(g_fatFd, bufWrite, strlen(bufWrite)); - if (ret <= 0) { - if (g_testCount < (4 * BYTES_PER_KBYTES / 8)) { // 4 * BYTES_PER_KBYTES MB/GB, 8MB per write - printf("The biggest file size is smaller than the 4GB"); - goto EXIT2; - } - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - if (g_testCount >= 256 + 1) { // write more than 256 times for 4GB - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - g_testCount++; - } - - readbuf = (CHAR *)malloc(0xffff + 1); - ICUNIT_GOTO_NOT_EQUAL(readbuf, NULL, readbuf, EXIT2); - (void)memset_s(readbuf, 0xffff + 1, 0, 0xffff + 1); - - len = pread64(g_fatFd, readbuf, 0xffff, 0); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT2); - - (void)memset_s(readbuf, 0xffff + 1, 0, 0xffff + 1); - - len = pread64(g_fatFd, readbuf, 0xffff, 1000); // offset is 1000 - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT2); - - (void)memset_s(readbuf, 0xffff + 1, 0, 0xffff + 1); - - len = pread64(g_fatFd, readbuf, 0xffff, - (off64_t)(g_testCount * 8 * // 8mb per write - BYTES_PER_MBYTES)); // 8M * 8 * BYTES_PER_MBYTES * times = file size, get to file end - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - free(readbuf); - free(bufWrite); - - ret = close(g_fatFd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(g_fatPathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = remove(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - free(bufWrite1); -EXIT2: - free(readbuf); - free(bufWrite); -EXIT1: - close(g_fatFd); -EXIT0: - remove(g_fatPathname1); -EXIT: - remove(pathname); - return FAT_NO_ERROR; -} - -/* * - * @ingroup los_fsoperationbigfile - * @par type: void - * API test - * @brief pread64 鎿嶄綔瓒呰繃2G澶у皬鐨勬枃浠 - * @par description锛 write the file size to 2GB and pread64 it - * @par precon: task moudle open - * @par step: see below - * create 2GB file \n - * pread64 this file - * @par expect: see below - * create file successful \n - * operator it successful,return successed - * @par prior: nothing - */ - -VOID ItFsFat874(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_874", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_875.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_875.cpp deleted file mode 100644 index 78ffdccb..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_875.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - INT32 len; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite = NULL; - CHAR *bufWrite1 = NULL; - CHAR *bufWrite2 = NULL; - CHAR *writebuf = NULL; - - g_testCount = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - bufWrite = (CHAR *)malloc(8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 8 * BYTES_PER_MBYTES, 0, 8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // 16 * 4 * 256 = 16K - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - } - - for (j = 0; j < 16; j++) { // 16 * 4 * 16K = 1M - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - } - - for (i = 0; i < 4; i++) { // 4 * 2 * 1M = 8M - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, bufWrite1); // 8 * BYTES_PER_KBYTES = 8KB - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, bufWrite1); // 8 * BYTES_PER_KBYTES = 8KB - } - - free(bufWrite1); - free(bufWrite2); - - g_testCount++; - - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, "/031.txt"); - - g_fatFd = open64(g_fatPathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd, FAT_IS_ERROR, g_fatFd, EXIT2); - - while (1) { - ret = write(g_fatFd, bufWrite, strlen(bufWrite)); - if (ret <= 0) { - if (g_testCount < (4 * BYTES_PER_KBYTES / 8)) { // 4 * BYTES_PER_KBYTES MB/GB, 8MB per write - printf("The biggest file size is smaller than the 4GB"); - goto EXIT2; - } - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - if (g_testCount >= 256 + 1) { // write more than 256 times for 4GB - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - g_testCount++; - } - - writebuf = (CHAR *)malloc(0xffff + 1); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT2); - (void)memset_s(writebuf, 0xffff + 1, 0, 0xffff + 1); - - for (i = 0; i < 256; i++) { // loop 256 times - (void)strcat_s(writebuf, 0xffff + 1, filebuf); - } - writebuf[0xffff] = '\0'; - - len = pwrite64(g_fatFd, writebuf, 0xffff, 0); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT2); - - len = pwrite64(g_fatFd, writebuf, 0xffff, 10000); // offset = 10000 - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT2); - - len = pwrite64(g_fatFd, writebuf, 0xffff, - (off64_t)(g_testCount * 8 * BYTES_PER_MBYTES - 1)); // 8M * 8 * BYTES_PER_MBYTES * times to get to file end - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT2); - - free(writebuf); - free(bufWrite); - - ret = close(g_fatFd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(g_fatPathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = remove(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - free(bufWrite1); -EXIT2: - free(writebuf); - free(bufWrite); -EXIT1: - close(g_fatFd); -EXIT0: - remove(g_fatPathname1); -EXIT: - remove(pathname); - return FAT_NO_ERROR; -} - -/* * - * @ingroup los_fsoperationbigfile - * @par type: void - * API test - * @brief pwrite64 鎿嶄綔瓒呰繃2G澶у皬鐨勬枃浠 - * @par description锛 write the file size to 2GB and pwrite64 it - * @par precon: task moudle open - * @par step: see below - * create 2GB file \n - * pwrite64 this file - * @par expect: see below - * create file successful \n - * operator it successful,return successed - * @par prior: nothing - */ - -VOID ItFsFat875(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_875", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_902.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_902.cpp deleted file mode 100644 index 6a1e17a8..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_902.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct stat64 buf1 = { 0 }; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = format(FAT_DEV_PATH, 8, 2); // cluster size 8 fstype is 2 FAT32 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat64(pathname1, &buf1); - ICUNIT_GOTO_NOT_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat64(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/dir"); - - ret = stat64(pathname1, &buf1); - ICUNIT_GOTO_NOT_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT2); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - return FAT_NO_ERROR; -EXIT2: - rmdir(pathname1); -EXIT1: - rmdir(FAT_PATH_NAME); -EXIT: - mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); -EXIT0: - return FAT_NO_ERROR; -} - -VOID ItFsFat902(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_902", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_903.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_903.cpp deleted file mode 100644 index c10cb3cd..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_903.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR buffile[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct stat64 buf1 = { 0 }; - struct stat64 buf2 = { 0 }; - struct stat64 buf3 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/dir"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(buffile, FAT_STANDARD_NAME_LENGTH, "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - ret = stat64(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = fstat64(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat64(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_mode, buf2.st_mode, buf1.st_mode, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT); - - FatDeleteFile(fd, buffile); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - format(FAT_DEV_PATH, 8, 0); // cluster size 8, 0 for auto - return FAT_NO_ERROR; -} - -VOID ItFsFat903(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_903", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_904.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_904.cpp deleted file mode 100644 index e3cc1716..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_904.cpp +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 fd1 = 0; - INT32 fd2 = 0; - INT32 fd3 = 0; - CHAR filebuf[20] = "abcdeabcde"; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct stat buf1 = { 0 }; - - ret = chdir("/"); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT0); - - ret = format(FAT_DEV_PATH, 0, 2); // cluster size 0, 2 for FAT32, will fail - if (ret != 0) { - perror("format sd card"); - } - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "test1"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - ret = fallocate(fd, 1, 0, 1 << 10); // fallocate 1 << 10 for 1KB - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT1); - - close(fd); - - fd = open(pathname1, O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - ret = fallocate(fd, 1, 0, 1 << 20); // fallocate 1 << 20 for 1MB - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT); - - ret = ftruncate(fd, 0xffff); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "test2"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, FAT_IS_ERROR, fd1, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = ftruncate(fd1, 1 << 20); // ftruncate 1 << 20 to 1MB - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf1); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "test3"); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, FAT_IS_ERROR, fd2, EXIT1); - - ret = fallocate(fd2, 1, 0, 10); // fallocate to 10 bytes - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate(fd2, 1, 0, 10); // fallocate to 10 bytes - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate(fd2, 1, 10, 20); // fallocate to 10 + 20 bytes - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "test4"); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, FAT_IS_ERROR, fd1, EXIT3); - - ret = ftruncate(fd3, 1 << 20); // ftruncate 1 << 20 for 1MB - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - FatStatPrintf(buf1); - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_REMOVE); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_REMOVE); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_REMOVE); - - ret = format(FAT_DEV_PATH, 0, 2); // cluster size 0, 2 for FAT32 - if (ret != 0) { - perror("format sd card"); - } - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_MOUNT_REMOVE); - - (void)strncpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_PATH_NAME, sizeof(FAT_PATH_NAME)); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "test1"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - ret = fallocate(fd, 1, 0, 1 << 10); // fallocate 1 << 10 for 1KB - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT1); - - close(fd); - - fd = open(pathname1, O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - ret = fallocate64(fd, 1, 0, 1 << 20); // fallocate 1 << 20 for 1MB - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT); - - ret = ftruncate64(fd, 0xffff); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "test2"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, FAT_IS_ERROR, fd1, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = ftruncate64(fd1, 1 << 20); // ftruncate 1 << 20 for 1MB - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf1); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "test3"); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, FAT_IS_ERROR, fd2, EXIT1); - - ret = fallocate64(fd2, 1, 0, 10); // fallocate 10 bytes - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd2, 1, 0, 10); // fallocate 10 bytes - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd2, 1, 10, 20); // fallocate 10 + 20 bytes - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "test4"); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, FAT_IS_ERROR, fd1, EXIT3); - - ret = ftruncate64(fd3, 1 << 20); // fallocate 1 << 20 for 1MB - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - FatStatPrintf(buf1); - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_REMOVE); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_REMOVE); - - return FAT_NO_ERROR; - -EXIT3: - close(fd3); -EXIT1: - close(fd2); -EXIT2: - close(fd1); -EXIT: - close(fd); -EXIT_REMOVE: - remove(pathname1); - - return FAT_NO_ERROR; - -EXIT_MOUNT_REMOVE: - mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - remove(pathname1); -EXIT0: - return FAT_NO_ERROR; -} -VOID ItFsFat904(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_904", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/full/It_vfs_fat_909.cpp b/testsuites/unittest/fs/vfat/full/It_vfs_fat_909.cpp deleted file mode 100644 index 28ce4c79..00000000 --- a/testsuites/unittest/fs/vfat/full/It_vfs_fat_909.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 i, j, k, ret, len; - INT32 fd = -1; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - off_t off; - CHAR readbuf[2000] = ""; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct stat buf1 = { 0 }; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_MOUNT); - - ret = format(FAT_DEV_PATH, 0, 0x02); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_MOUNT); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_MOUNT); - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, - BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // 256 * BYTES_PER_KBYTES * 4 = 1MB - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname, FAT_STANDARD_NAME_LENGTH, "testfile.txt"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - for (j = 0; j < 100; j++) { // 写100M - ret = write(fd, bufWrite, strlen(bufWrite)); - printf("\n write times = : %d\n", j + 1); // j+1等于10左右时,插拔SD卡 - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTES, ret, EXIT2); // not equal to 1M - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTES * (j + 1)), off, EXIT2); // from 1M to 4G - } - - off = lseek(fd, 64, SEEK_SET); // 64 byte - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); // 64 byte - - for (k = 0; k < 500; k++) { // 读500次 - len = read(fd, readbuf, BYTES_PER_KBYTES); // read BYTES_PER_KBYTES bytes - printf("\n read times = : %d\n", k + 1); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTES, len, EXIT2); // make sure BYTES_PER_KBYTES bytes - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - free(bufWrite); - - return FAT_NO_ERROR; - - free(bufWrite); -EXIT2: - close(fd); -EXIT1: - unlink(pathname); -EXIT: - rmdir(pathname1); -EXIT_MOUNT: - mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - free(bufWrite); -EXIT0: - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_909 -* - @tspec function test -* - @ttitle Insert and remove SD card during reading and writing -* - @tbrief -1. Create a new file and open it -2. Unplug the SD card when writing 10M -3. View serial port printing status and file status. -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFat909(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_909", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_001.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_001.cpp deleted file mode 100644 index 807c552f..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_001.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. - */ - - * PURPOSE ARE DISCLAIMED. IN - * NO EVENT SHALL THE COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[FAT_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm stTime; - - g_testCount++; - - time(&tTime); - localtime_r(&tTime, &stTime); - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - strftime(g_fatPathname1, FAT_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", &stTime); - (void)snprintf_s(fileName, FAT_STANDARD_NAME_LENGTH - 1, FAT_STANDARD_NAME_LENGTH - 1, "/vs/sd/%s_#%d", - g_fatPathname1, (INT32)arg); - - (void)snprintf_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH - 1, "testfile#%d", (INT32)arg); - prctl(PR_SET_NAME, (unsigned long)g_fatPathname1, 0, 0, 0); - - ret = RandWrite(fileName, FILE_SIZE, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = RandRead(fileName, FILE_SIZE, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - return FAT_NO_ERROR; - -EXIT: - return FAT_NO_ERROR; - g_testCount = 0; -} -static UINT32 TestCase(VOID) -{ - INT32 ret; - pthread_t threadId = 0; - pthread_attr_t attr; - - g_testCount = 0; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr, 4); // level 4 - ICUNIT_ASSERT_EQUAL(ret, FAT_NO_ERROR, ret); - - ret = pthread_create(&threadId, &attr, PthreadF01, NULL); - ICUNIT_ASSERT_EQUAL(ret, FAT_NO_ERROR, ret); - - while (g_testCount < 2) { // each thread add 2 at g_testCount - sleep(1); - } - - ret = pthread_join(threadId, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - pthread_join(threadId, NULL); - pthread_attr_destroy(&attr); -EXIT0: - return FAT_NO_ERROR; -} - -VOID ItFsFatPerformance001(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_001", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_002.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_002.cpp deleted file mode 100644 index 1511fdba..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_002.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[FAT_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm stTime; - - g_testCount++; - - time(&tTime); - localtime_r(&tTime, &stTime); - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - strftime(g_fatPathname1, FAT_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", &stTime); - (void)snprintf_s(fileName, FAT_STANDARD_NAME_LENGTH - 1, FAT_STANDARD_NAME_LENGTH - 1, "/vs/sd/%s_#%d", - g_fatPathname1, (INT32)arg); - - (void)snprintf_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH - 1, "testfile#%d", (INT32)arg); - prctl(PR_SET_NAME, (unsigned long)g_fatPathname1, 0, 0, 0); - - ret = FixWrite(fileName, FILE_SIZE, FIX_DATA_LEN, INTERFACE_TYPE); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = FixRead(fileName, FILE_SIZE, FIX_DATA_LEN, INTERFACE_TYPE); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - return FAT_NO_ERROR; - -EXIT: - return FAT_NO_ERROR; - g_testCount = 0; -} -static UINT32 TestCase(VOID) -{ - INT32 ret; - pthread_t threadId = 0; - pthread_attr_t attr; - - printf("Single-Task frite and fread ,The test for SD is started!\n"); - - g_testCount = 0; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr, 4); // level 4 - ICUNIT_ASSERT_EQUAL(ret, FAT_NO_ERROR, ret); - - ret = pthread_create(&threadId, &attr, PthreadF01, NULL); - ICUNIT_ASSERT_EQUAL(ret, FAT_NO_ERROR, ret); - - while (g_testCount < 2) { // each thread add 2 at g_testCount - sleep(1); - } - - ret = pthread_join(threadId, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - pthread_join(threadId, NULL); - pthread_attr_destroy(&attr); -EXIT0: - return FAT_NO_ERROR; -} - -VOID ItFsFatPerformance002(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_002", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_003.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_003.cpp deleted file mode 100644 index 1cba2554..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_003.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[FAT_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm stTime; - - g_testCount++; - - time(&tTime); - localtime_r(&tTime, &stTime); - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - strftime(g_fatPathname1, FAT_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", &stTime); - (void)snprintf_s(fileName, FAT_STANDARD_NAME_LENGTH - 1, FAT_STANDARD_NAME_LENGTH - 1, "/vs/sd/%s_#%d", - g_fatPathname1, (INT32)arg); - - (void)snprintf_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH - 1, "testfile#%d", (INT32)arg); - prctl(PR_SET_NAME, (unsigned long)g_fatPathname1, 0, 0, 0); - - ret = RandWrite(fileName, FILE_SIZE, 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = RandRead(fileName, FILE_SIZE, 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - return FAT_NO_ERROR; - -EXIT: - return FAT_NO_ERROR; - g_testCount = 0; -} -static UINT32 TestCase(VOID) -{ - INT32 ret; - pthread_t threadId; - pthread_attr_t attr; - - g_testCount = 0; - - ret = PosixPthreadInit(&attr, 4); // level 4 - ICUNIT_ASSERT_EQUAL(ret, FAT_NO_ERROR, ret); - - ret = pthread_create(&threadId, &attr, PthreadF01, NULL); - ICUNIT_ASSERT_EQUAL(ret, FAT_NO_ERROR, ret); - - while (g_testCount < 2) { // each thread add 2 at g_testCount - sleep(1); - } - - ret = pthread_join(threadId, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - pthread_join(threadId, NULL); - pthread_attr_destroy(&attr); - return FAT_NO_ERROR; -} - -VOID ItFsFatPerformance003(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_003", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_004.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_004.cpp deleted file mode 100644 index 89b688c6..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_004.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[FAT_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm stTime; - - g_testCount++; - - time(&tTime); - localtime_r(&tTime, &stTime); - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - strftime(g_fatPathname1, FAT_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", &stTime); - (void)snprintf_s(fileName, FAT_STANDARD_NAME_LENGTH - 1, FAT_STANDARD_NAME_LENGTH - 1, "/vs/sd/%s_#%d", - g_fatPathname1, (INT32)arg); - - (void)snprintf_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH - 1, "testfile#%d", (INT32)arg); - prctl(PR_SET_NAME, (unsigned long)g_fatPathname1, 0, 0, 0); - - ret = FixWrite(fileName, FILE_SIZE, FIX_DATA_LEN, 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = FixRead(fileName, FILE_SIZE, FIX_DATA_LEN, 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - return FAT_NO_ERROR; - -EXIT: - return FAT_NO_ERROR; - g_testCount = 0; -} -static UINT32 TestCase(VOID) -{ - INT32 ret; - pthread_t threadId; - pthread_attr_t attr; - - g_testCount = 0; - - ret = PosixPthreadInit(&attr, 4); // level 4 - ICUNIT_ASSERT_EQUAL(ret, FAT_NO_ERROR, ret); - - ret = pthread_create(&threadId, &attr, PthreadF01, NULL); - ICUNIT_ASSERT_EQUAL(ret, FAT_NO_ERROR, ret); - - while (g_testCount < 2) { // each thread add 2 at g_testCount - sleep(1); - } - - ret = pthread_join(threadId, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - pthread_join(threadId, NULL); - pthread_attr_destroy(&attr); - return FAT_NO_ERROR; -} - -VOID ItFsFatPerformance004(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_004", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_005.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_005.cpp deleted file mode 100644 index d121e938..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_005.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[FAT_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm stTime; - - g_testCount++; - - time(&tTime); - localtime_r(&tTime, &stTime); - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - strftime(g_fatPathname1, FAT_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", &stTime); - (void)snprintf_s(fileName, FAT_STANDARD_NAME_LENGTH - 1, FAT_STANDARD_NAME_LENGTH - 1, "/vs/sd/%s_#%d", - g_fatPathname1, (INT32)arg); - - (void)snprintf_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH - 1, "testfile#%d", (INT32)arg); - prctl(PR_SET_NAME, (unsigned long)g_fatPathname1, 0, 0, 0); - - ret = FixWrite(fileName, FILE_SIZE, FIX_DATA_LEN, INTERFACE_TYPE); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = FixRead(fileName, FILE_SIZE, FIX_DATA_LEN, INTERFACE_TYPE); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - return FAT_NO_ERROR; - -EXIT: - return FAT_NO_ERROR; - g_testCount = 0; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_t threadId[FAT_MAX_THREADS]; - pthread_attr_t attr; - - printf("Multiple-Task frite and fread ,The test for SD is started!\n"); - - g_testCount = 0; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr, 4); // level 4 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)(i + 1)); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - while (g_testCount < FAT_MAX_THREADS * 2) { // each thread add 2 at g_testCount - sleep(1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } -EXIT: - pthread_attr_destroy(&attr); -EXIT0: - return FAT_NO_ERROR; -} - -VOID ItFsFatPerformance005(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_005", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_006.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_006.cpp deleted file mode 100644 index 310bf23f..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_006.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[FAT_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm stTime; - - g_testCount++; - - time(&tTime); - localtime_r(&tTime, &stTime); - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - strftime(g_fatPathname1, FAT_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", &stTime); - (void)snprintf_s(fileName, FAT_STANDARD_NAME_LENGTH - 1, FAT_STANDARD_NAME_LENGTH - 1, "/vs/sd/%s_#%d", - g_fatPathname1, (INT32)arg); - - (void)snprintf_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH - 1, "testfile#%d", (INT32)arg); - prctl(PR_SET_NAME, (unsigned long)g_fatPathname1, 0, 0, 0); - - ret = RandWrite(fileName, FILE_SIZE, INTERFACE_TYPE); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = RandRead(fileName, FILE_SIZE, INTERFACE_TYPE); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - return FAT_NO_ERROR; - -EXIT: - return FAT_NO_ERROR; - g_testCount = 0; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_t threadId[3]; - pthread_attr_t attr; - - g_testCount = 0; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr, 4); // level 4 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - for (i = 0; i < 3; i++) { // creat 3 threads - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - while (g_testCount < 6) { // 6 threads each add 2 at g_testCount - sleep(1); - } - - for (i = 0; i < 3; i++) { // join the 3 child threads - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - for (i = 0; i < 3; i++) { // wait for 3 threads ok - pthread_join(threadId[i], NULL); - } -EXIT: - pthread_attr_destroy(&attr); -EXIT0: - return FAT_NO_ERROR; -} - -VOID ItFsFatPerformance006(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_006", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_007.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_007.cpp deleted file mode 100644 index 60095884..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_007.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[FAT_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm stTime; - - g_testCount++; - - time(&tTime); - localtime_r(&tTime, &stTime); - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - strftime(g_fatPathname1, FAT_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", &stTime); - (void)snprintf_s(fileName, FAT_STANDARD_NAME_LENGTH - 1, FAT_STANDARD_NAME_LENGTH - 1, "/vs/sd/%s_#%d", - g_fatPathname1, (INT32)arg); - - (void)snprintf_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH - 1, "testfile#%d", (INT32)arg); - prctl(PR_SET_NAME, (unsigned long)g_fatPathname1, 0, 0, 0); - - ret = RandWrite(fileName, FILE_SIZE, 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = RandRead(fileName, FILE_SIZE, 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - return FAT_NO_ERROR; - -EXIT: - return FAT_NO_ERROR; - g_testCount = 0; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_t threadId[3]; - pthread_attr_t attr; - - g_testCount = 0; - - ret = PosixPthreadInit(&attr, 4); // level 4 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - for (i = 0; i < 3; i++) { // create 3 child threads - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - while (g_testCount < 6) { // 6 threads each add 2 at g_testCount - sleep(1); - } - - for (i = 0; i < 3; i++) { // join 3 child thread - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - for (i = 0; i < 3; i++) { // join all 3 child thread - pthread_join(threadId[i], NULL); - } -EXIT: - pthread_attr_destroy(&attr); - return FAT_NO_ERROR; -} - -VOID ItFsFatPerformance007(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_007", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_008.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_008.cpp deleted file mode 100644 index 27def38d..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_008.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[FAT_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm stTime; - - g_testCount++; - - time(&tTime); - localtime_r(&tTime, &stTime); - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - strftime(g_fatPathname1, FAT_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", &stTime); - (void)snprintf_s(fileName, FAT_STANDARD_NAME_LENGTH - 1, FAT_STANDARD_NAME_LENGTH - 1, "/vs/sd/%s_#%d", - g_fatPathname1, (INT32)arg); - - (void)snprintf_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH - 1, "testfile#%d", (INT32)arg); - prctl(PR_SET_NAME, (unsigned long)g_fatPathname1, 0, 0, 0); - - ret = FixWrite(fileName, FILE_SIZE, FIX_DATA_LEN, 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = FixRead(fileName, FILE_SIZE, FIX_DATA_LEN, 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - return FAT_NO_ERROR; - -EXIT: - return FAT_NO_ERROR; - g_testCount = 0; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_t threadId[3]; - pthread_attr_t attr; - - g_testCount = 0; - - ret = PosixPthreadInit(&attr, 4); // level 4 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - for (i = 0; i < 3; i++) { // create 3 child threads - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - while (g_testCount < 6) { // 6 threads each add 2 at g_testCount - sleep(1); - } - - for (i = 0; i < 3; i++) { // join all 3 child threads - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - for (i = 0; i < 3; i++) { // join all 3 child threads - pthread_join(threadId[i], NULL); - } -EXIT: - pthread_attr_destroy(&attr); - return FAT_NO_ERROR; -} - -VOID ItFsFatPerformance008(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_008", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_013.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_013.cpp deleted file mode 100644 index d5de71f1..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_013.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, i, index, len; - INT32 fd[FAT_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR pathname0[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname0[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - DIR *dir = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB // 1M - ICUNIT_ASSERT_NOT_EQUAL(bufWrite, NULL, bufWrite); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB // 1M - - for (i = 0; i < 200 * 4; i++) { // append 200 * 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(pathname0, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(pathname0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - index = 0; - for (i = 0; i < FAT_FILE_LIMITTED_NUM; i++) { - (void)snprintf_s(bufname0, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", - index); - fd[index] = open(bufname0, O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd[index], FAT_IS_ERROR, fd[index], EXIT2); - - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - index++; - } - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - (void)snprintf_s(bufname0, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - ret = unlink(bufname0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - printf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + // US_PER_SEC - (testTime2.tv_usec - testTime1.tv_usec)); - - free(bufWrite); - return FAT_NO_ERROR; -EXIT3: - for (i = index; i >= 0; i--) { - (void)snprintf_s(bufname0, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - unlink(bufname0); - } -EXIT2: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT1: - closedir(dir); -EXIT: - chdir(SD_MOUNT_DIR); - rmdir(FAT_PATH_NAME); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PERFORMANCE_013 -* -@tspec The function test for filesystem -* -@ttitle How long does it take to delete a directory -* -@tprecon The filesystem module is open -* -@tbrief -1. Create a directory with 200 files -2.200Kb per file -3.delete the file box directory -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPerformance013(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_013", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_014.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_014.cpp deleted file mode 100644 index e1168df5..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_014.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" -#define MS_NOSYNC 2 - -static UINT32 TestCase(VOID) -{ - INT32 ret, i, len; - INT32 index = 0; - INT32 fd[FAT_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = NULL; - DIR *dir = NULL; - struct timeval testTime1; - struct timeval testTime2; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - umount(FAT_MOUNT_DIR); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, MS_NOSYNC, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT4); - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL(bufWrite, NULL, bufWrite); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < 200 * 4; i++) { // append 200 * 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - index = 0; - for (i = 0; i < FAT_FILE_LIMITTED_NUM; i++) { - (void)snprintf_s(bufname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", - index); - fd[index] = open(bufname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd[index], FAT_IS_ERROR, fd[index], EXIT2); - - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - index++; - } - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - sync(); - for (i = index; i >= 0; i--) { - (void)snprintf_s(bufname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - ret = unlink(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - printf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + // US_PER_SEC - (testTime2.tv_usec - testTime1.tv_usec)); - - free(bufWrite); - return FAT_NO_ERROR; -EXIT4: - umount(FAT_MOUNT_DIR); -EXIT3: - for (i = index; i >= 0; i--) { - (void)snprintf_s(bufname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - unlink(bufname1); - } -EXIT2: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT1: - closedir(dir); -EXIT: - chdir(SD_MOUNT_DIR); - rmdir(FAT_PATH_NAME); -EXIT0: - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PERFORMANCE_014 -* -@tspec The function test for filesystem -* -@ttitle How long does it take to delete a directory -* -@tprecon The filesystem module is open -* -@tbrief -1.The fourth parameter of mount is changed to MS_NOSYNC -2.Create a directory with 200 files -3.200Kb per file -4.delete the file box directory -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPerformance014(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_014", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_015.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_015.cpp deleted file mode 100644 index d42ae750..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_015.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[FAT_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < FAT_FILE_LIMITTED_NUM; i++) { // 200 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_NAME_LIMITTED_SIZE; j++) { // 300K - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - sync(); - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - printf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + // US_PER_SEC - (testTime2.tv_usec - testTime1.tv_usec)); - - g_testCount++; - free(bufWrite); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - i); - unlink(pathname); - } - free(bufWrite); -EXIT: - rmdir(bufname); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[FAT_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < FAT_FILE_LIMITTED_NUM; i++) { // 200 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_NAME_LIMITTED_SIZE; j++) { // 300K - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - sync(); - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - printf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + // US_PER_SEC - (testTime2.tv_usec - testTime1.tv_usec)); - g_testCount++; - free(bufWrite); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - i); - unlink(pathname); - } - free(bufWrite); -EXIT: - rmdir(bufname); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[FAT_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < FAT_FILE_LIMITTED_NUM; i++) { // 200 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_NAME_LIMITTED_SIZE; j++) { // 300K - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - sync(); - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - printf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + // US_PER_SEC - (testTime2.tv_usec - testTime1.tv_usec)); - - g_testCount++; - free(bufWrite); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - unlink(pathname); - } - free(bufWrite); -EXIT: - rmdir(bufname); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, NULL); // 2nd thread id - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there are 3 child threads - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_PERFORMANCE_015 -* - @tspec function test -* - @ttitle Multi-threaded takes time to delete directory files -* - @tbrief -1. Create 200 files per directory; -2. The size of each file is 300K; -3. Call the gettimeofday() to get the time; -4. Delete files and directories; -5. Call the gettimeofday() to get the time and View the time of serial port printing. -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatPerformance015(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_015", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_016.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_016.cpp deleted file mode 100644 index c6f64ce2..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_performance_016.cpp +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[FAT_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < FAT_FILE_LIMITTED_NUM; i++) { // 200 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_NAME_LIMITTED_SIZE; j++) { // 300K - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - printf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + // US_PER_SEC - (testTime2.tv_usec - testTime1.tv_usec)); - - g_testCount++; - free(bufWrite); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - unlink(pathname); - } -EXIT: - free(bufWrite); - rmdir(bufname); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[FAT_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < FAT_FILE_LIMITTED_NUM; i++) { // 200 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_NAME_LIMITTED_SIZE; j++) { // 300K - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - printf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + // US_PER_SEC - (testTime2.tv_usec - testTime1.tv_usec)); - - g_testCount++; - free(bufWrite); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - unlink(pathname); - } -EXIT: - free(bufWrite); - rmdir(bufname); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[FAT_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < FAT_FILE_LIMITTED_NUM; i++) { // 200 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_NAME_LIMITTED_SIZE; j++) { // 300K - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - printf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + // US_PER_SEC - (testTime2.tv_usec - testTime1.tv_usec)); - - g_testCount++; - free(bufWrite); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - unlink(pathname); - } -EXIT: - free(bufWrite); - rmdir(bufname); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // 2nd thread id - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // 3 threads - - return FAT_NO_ERROR; -EXIT3: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - goto EXIT; - - chdir("/"); - umount(FAT_MOUNT_DIR); -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_PERFORMANCE_016 -* - @tspec function test -* - @ttitle Multi-threaded takes time to delete directory files -* - @tbrief -1. Create 200 files per directory; -2. The size of each file is 300K; -3. Call the gettimeofday() to get the time; -4. Delete files and directories; -5. Call the gettimeofday() to get the time and View the time of serial port printing. -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatPerformance016(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_016", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_029.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_029.cpp deleted file mode 100644 index f0360221..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_029.cpp +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - INT32 i = 0; - INT32 k; - off_t off; - CHAR bufname[FAT_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - g_fatFlagF01++; - - for (i = 0; i < FAT_MAXIMUM_SIZES; i++) { - (void)memset_s(g_fatPathname2, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - (void)memset_s(g_fatPathname12[i], FAT_STANDARD_NAME_LENGTH, 0, FAT_NAME_LIMITTED_SIZE); - - (void)snprintf_s(bufname, FAT_SHORT_ARRAY_LENGTH, FAT_SHORT_ARRAY_LENGTH, "/test%d", i); - (void)strcat_s(g_fatPathname2, FAT_SHORT_ARRAY_LENGTH, pathname1); - (void)strcat_s(g_fatPathname2, FAT_SHORT_ARRAY_LENGTH, bufname); - (void)strcat_s(g_fatPathname2, FAT_SHORT_ARRAY_LENGTH, ".txt"); - (void)strcpy_s(g_fatPathname12[i], FAT_SHORT_ARRAY_LENGTH, g_fatPathname2); - g_fatFd11[i] = open(g_fatPathname12[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[i], -1, g_fatFd11[i], EXIT1); - - if (i % FAT_SHORT_ARRAY_LENGTH == 9) { // meet i = 9 close the fat fd - for (k = (i / FAT_SHORT_ARRAY_LENGTH) * FAT_SHORT_ARRAY_LENGTH; k <= i; k++) { - ret = close(g_fatFd11[k]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - } - } - - ICUNIT_GOTO_NOT_EQUAL((g_testCount % 2), 0, g_testCount, EXIT1); // 2 for even or not - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - for (i = 0; i < FAT_MAXIMUM_SIZES; i++) { - g_fatFd11[i] = open(g_fatPathname12[i], O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[i], -1, g_fatFd11[i], EXIT1); - - off = lseek(g_fatFd11[i], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 1 * BYTES_PER_MBYTES, off, EXIT1); // 1 * BYTES_PER_MBYTES = 1M - - if (i % FAT_SHORT_ARRAY_LENGTH == 9) { // meet i = 9 close the fat fd - for (k = (i / FAT_SHORT_ARRAY_LENGTH) * FAT_SHORT_ARRAY_LENGTH; k <= i; k++) { - ret = close(g_fatFd11[k]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - } - } - - for (i = 0; i < FAT_MAXIMUM_SIZES; i++) { - ret = unlink(g_fatPathname12[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_fatFlag++; - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - return NULL; -EXIT1: - for (i = 0; i < FAT_MAXIMUM_SIZES; i++) { - close(g_fatFd11[i]); - } -EXIT: - for (i = 0; i < FAT_MAXIMUM_SIZES; i++) { - unlink(g_fatPathname12[i]); - } - g_testCount = 0; - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret; - INT32 len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = "liteos"; - CHAR *bufWrite = nullptr; - off_t off; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - bufWrite = (CHAR *)malloc(1 * BYTES_PER_MBYTES + 1); // 1 * BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < 1 * 32 * 4; i++) { // 4K * 2 * 32 * 4 = 1M - for (j = 0; j < 4; j++) { // 256 * 4 * 4 = 4K - (void)strcat_s(bufWrite, 1 * BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite, 1 * BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite, 1 * BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite, 1 * BYTES_PER_MBYTES + 1, filebuf); - } - - for (j = 0; j < 4; j++) { // 256 * 4 * 4 = 4K - (void)strcat_s(bufWrite, 1 * BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite, 1 * BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite, 1 * BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite, 1 * BYTES_PER_MBYTES + 1, filebuf); - } - } - - for (i = 0; i < FAT_MAXIMUM_SIZES; i++) { - g_fatFd11[i] = open(g_fatPathname12[i], O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[i], -1, g_fatFd11[i], EXIT2); - - len = read(g_fatFd11[i], readbuf, FAT_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(g_fatFd11[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = write(g_fatFd11[i], bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, 1 * BYTES_PER_MBYTES, len, EXIT2); // BYTES_PER_MBYTES = 1MB - - if (i % FAT_SHORT_ARRAY_LENGTH == 9) { // meet i = 9 close the fat fd - for (k = (i / FAT_SHORT_ARRAY_LENGTH) * FAT_SHORT_ARRAY_LENGTH; k <= i; k++) { - ret = close(g_fatFd11[k]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - } - } - - ICUNIT_GOTO_EQUAL((g_testCount % 2), 0, g_testCount, EXIT2); // 2 for even or not - - free(bufWrite); - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(2); // delay 2 s - - return NULL; -EXIT2: - free(bufWrite); -EXIT1: - for (i = 0; i < FAT_MAXIMUM_SIZES; i++) { - close(g_fatFd11[i]); - } -EXIT: - for (i = 0; i < FAT_MAXIMUM_SIZES; i++) { - unlink(g_fatPathname12[i]); - } - g_testCount = 0; - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - DIR *dir = nullptr; - struct dirent *ptr = nullptr; - pthread_t newThread1, newThread2; - pthread_attr_t attr1, attr2; - - g_fatFlag = 0; - g_fatFlagF01 = 0; - g_fatFlagF02 = 0; - - g_testCount = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - while ((g_fatFlag < FAT_PRESSURE_CYCLES) && (g_fatFlag == g_fatFlagF01)) { - ret = PosixPthreadInit(&attr1, 20); // level 20 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newThread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, 20); // level 20 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newThread2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(1); - - ret = PosixPthreadDestroy(&attr2, newThread2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newThread1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - printf("\tg_fatFlag=:%d\t", g_fatFlag); - } - printf("\n"); - ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT2); - - dir = opendir(FAT_PATH_NAME); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newThread2); -EXIT1: - PosixPthreadDestroy(&attr1, newThread1); -EXIT: - rmdir(FAT_PATH_NAME); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PRESSURE_029 -* -@tspec The Pressure test -* -@ttitle Create, read ,write and delete the 1000 files -* -@tprecon The filesystem module is open -* -@tbrief -1. create two tasks; -2. the first task create 1000 files; -3. the second task read ,write these files; -4. delete all the directories; -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPressure029(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_029", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_030.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_030.cpp deleted file mode 100644 index 1de79477..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_030.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 len; - INT32 i = 0; - INT32 j = 0; - INT32 fd = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[258] = "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = NULL; - CHAR *bufWrite1 = NULL; - CHAR *bufWrite2 = NULL; - struct stat buf1[FAT_PRESSURE_CYCLES][FAT_SHORT_ARRAY_LENGTH] = { 0 }; - - g_fatFlag = 0; - - bufWrite = (CHAR *)malloc(5 * BYTES_PER_MBYTES + 1); // 5 * BYTES_PER_MBYTES = 5MB - ICUNIT_ASSERT_NOT_EQUAL(bufWrite, NULL, 0); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, 5 * BYTES_PER_MBYTES + 1); // 5 * BYTES_PER_MBYTES = 5MB - - bufWrite1 = (CHAR *)malloc(256 * BYTES_PER_KBYTES + 1); // 256 * BYTES_PER_KBYTES = 256KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT); - (void)memset_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, 0, // 256 kb - 256 * BYTES_PER_KBYTES + 1); // 256 * BYTES_PER_KBYTES = 256KB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT1); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16kb - } - - for (i = 0; i < 4; i++) { // loop 4 times - (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, bufWrite2); // 256kb - (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, bufWrite2); // 256kb - (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, bufWrite2); // 256kb - (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, bufWrite2); // 256kb - } - for (i = 0; i < 5; i++) { // loop 5 times - (void)strcat_s(bufWrite, 5 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 5 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 5 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 5 * BYTES_PER_MBYTES + 1, bufWrite1); - } - free(bufWrite1); - free(bufWrite2); - - for (i = 0; i < FAT_PRESSURE_CYCLES; i++) { - printf("Loop %d a\n", i + 1); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - printf("Loop %d b\n", i + 1); - - for (j = 0; j < 819; j++) { // loop 819 times - fd = open(pathname, O_NONBLOCK | O_RDWR | O_APPEND, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = write(fd, bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, 5 * BYTES_PER_MBYTES, len, EXIT); // 5 * BYTES_PER_MBYTES = 5MB - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - printf("Loop %d c\n", i + 1); - - for (j = 0; j < 4; j++) { // loop 4 times - fd = open(pathname, O_NONBLOCK | O_RDWR | O_APPEND, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 256, len, EXIT); // should write 256 bytes - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - printf("Loop %d d\n", i + 1); - - for (j = 0; j < 10; j++) { // loop 10 times - fd = open(pathname, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat(pathname, &buf1[i][j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - ret = remove(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_fatFlag++; - - printf("\tg_fatFlag=:%d\t", g_fatFlag); - } - - free(bufWrite); - - return FAT_NO_ERROR; -EXIT1: - free(bufWrite1); -EXIT: - free(bufWrite); - close(fd); - remove(pathname); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PRESSURE_030 -* -@tspec The Pressure test -* -@ttitle write the file to 4GB -* -@tprecon The filesystem module is open -* -@tbrief -1. create two tasks; -2. the first task write the file to 4GB; -3. the second task write one byte to the file once more; -4. delete the files; -* -@texpect -1. Return successed -2. Return successed -3. Return failure -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPressure030(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_030", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_031.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_031.cpp deleted file mode 100644 index 2bc46550..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_031.cpp +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - INT32 len = 0; - INT32 i = 0; - INT32 j = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - off64_t off64Num1, off64Num2; - struct stat64 statbuf1; - - bufWrite = (CHAR *)malloc(8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, 0, // 8 * BYTES_PER_MBYTES = 8MB - 8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, filebuf); - } - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - } - - for (i = 0; i < 4; i++) { // loop 4 times - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES, bufWrite1); // 8 * BYTES_PER_MBYTES = 8MB - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES, bufWrite1); // 8 * BYTES_PER_MBYTES = 8MB - } - - free(bufWrite1); - free(bufWrite2); - - g_testCount++; - g_fatFlagF01++; - - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, "/031.txt"); - - g_fatFd = open64(g_fatPathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd, FAT_IS_ERROR, g_fatFd, EXIT2); - - while (1) { - ret = write(g_fatFd, bufWrite, strlen(bufWrite)); - if (ret <= 0) { - if (g_testCount < (4 * BYTES_PER_KBYTES / 8)) { // 8 MB per write, write 4 * BYTES_PER_KBYTES MB size - printf("The biggest file size is smaller than the 4GB"); - goto EXIT; - } - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // 8 MB per write, BYTES_PER_KBYTES MB/GB - break; - } - g_testCount++; - } - - ret = stat64(g_fatPathname1, &statbuf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - off64Num1 = lseek64(g_fatFd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off64Num1, statbuf1.st_size, off64Num1, EXIT2); - - len = write(g_fatFd, bufWrite, strlen(bufWrite)); - printf("len=:%d,errno=:%d\t", len, errno); - - free(bufWrite); - - off64Num2 = lseek64(g_fatFd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off64Num2, off64Num1, off64Num2, EXIT1); - - ret = close(g_fatFd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - g_fatFlag++; - - return NULL; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - close(g_fatFd); -EXIT: - errno = 0; - ret = remove(g_fatPathname1); - g_testCount = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len, fd; - off64_t off64; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - DIR *dir = nullptr; - struct dirent *ptr = nullptr; - pthread_t newThread1; - pthread_attr_t attr1; - struct stat64 statbuf1; - - g_fatFlag = 0; - g_fatFlagF01 = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - while ((g_fatFlag < FAT_PRESSURE_CYCLES) && (g_fatFlag == g_fatFlagF01)) { - g_testCount = 0; - - ret = PosixPthreadInit(&attr1, TASK_PRIO_TEST - 5); // level 5 lower - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newThread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_join(newThread1, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - fd = open64(g_fatPathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT3); - - ret = stat64(g_fatPathname1, &statbuf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - off64 = lseek64(fd, -FAT_SHORT_ARRAY_LENGTH, SEEK_END); - ICUNIT_GOTO_EQUAL(off64, statbuf1.st_size - FAT_SHORT_ARRAY_LENGTH, off64, EXIT3); - - (void)memset_s(readbuf, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "alalalalal", readbuf, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = remove(g_fatPathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - printf("\tg_fatFlag=:%d\t", g_fatFlag); - } - printf("\n"); - ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT2); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - close(fd); - remove(g_fatPathname1); - goto EXIT; -EXIT2: - closedir(dir); - goto EXIT; -EXIT1: - pthread_join(newThread1, NULL); - pthread_attr_destroy(&attr1); -EXIT: - rmdir(FAT_PATH_NAME); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PRESSURE_031 -* -@tspec The Pressure test -* -@ttitle write the file to 4GB -* -@tprecon The filesystem module is open -* -@tbrief -1. create two tasks; -2. the first task write the file to 4GB; -3. the second task write one byte to the file once more; -4. delete the files; -* -@texpect -1. Return successed -2. Return successed -3. Return failure -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPressure031(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_031", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_038.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_038.cpp deleted file mode 100644 index b8e92354..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_038.cpp +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. - */ - - * PURPOSE ARE DISCLAIMED. IN - * NO EVENT SHALL THE COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static CHAR g_fat1650Pathname4[FAT_SHORT_ARRAY_LENGTH][FAT_SHORT_ARRAY_LENGTH][FAT_NAME_LIMITTED_SIZE] = {0, }; -static CHAR g_fat1650Pathname5[FAT_SHORT_ARRAY_LENGTH][FAT_SHORT_ARRAY_LENGTH][FAT_NAME_LIMITTED_SIZE] = {0, }; -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - INT32 len; - INT32 i = 0; - INT32 j = 0; - CHAR bufname[FAT_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *bufRead = nullptr; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)memset_s(g_fatPathname6, FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)strcat_s(g_fatPathname6, FAT_NAME_LIMITTED_SIZE, pathname1); - - g_testCount++; - g_fatFlagF01++; - - for (i = 0; i < FAT_SHORT_ARRAY_LENGTH; i++) { - (void)memset_s(bufname, FAT_SHORT_ARRAY_LENGTH, 0, FAT_SHORT_ARRAY_LENGTH); - - (void)memset_s(g_fatPathname11[i], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - - (void)snprintf_s(bufname, FAT_SHORT_ARRAY_LENGTH, FAT_SHORT_ARRAY_LENGTH, "/test%d", i); - (void)strcat_s(g_fatPathname6, FAT_NAME_LIMITTED_SIZE, bufname); - (void)strcpy_s(g_fatPathname11[i], FAT_NAME_LIMITTED_SIZE, g_fatPathname6); - - ret = mkdir(g_fatPathname11[i], S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - for (j = 0; j < FAT_SHORT_ARRAY_LENGTH; j++) { - (void)memset_s(g_fatPathname7, FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)memset_s(bufname, FAT_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - (void)memset_s(g_fat1650Pathname4[i][j], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)memset_s(g_fat1650Pathname5[i][j], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - - (void)snprintf_s(bufname, FAT_SHORT_ARRAY_LENGTH, FAT_SHORT_ARRAY_LENGTH, "/test%d", j); - (void)strcat_s(g_fatPathname7, FAT_NAME_LIMITTED_SIZE, g_fatPathname6); - (void)strcat_s(g_fatPathname7, FAT_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_fatPathname7, FAT_NAME_LIMITTED_SIZE, ".txt"); - (void)strcpy_s(g_fat1650Pathname4[i][j], FAT_NAME_LIMITTED_SIZE, g_fatPathname7); - - (void)memset_s(g_fatPathname7, FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)strcat_s(g_fatPathname7, FAT_NAME_LIMITTED_SIZE, g_fatPathname6); - (void)strcat_s(g_fatPathname7, FAT_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_fatPathname7, FAT_NAME_LIMITTED_SIZE, ".cpp"); - (void)strcpy_s(g_fat1650Pathname5[i][j], FAT_NAME_LIMITTED_SIZE, g_fatPathname7); - - g_fatFd12[i][j] = - open(g_fat1650Pathname4[i][j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd12[i][j], -1, g_fatFd12[i][j], EXIT1); - - ret = close(g_fatFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - bufRead = (CHAR *)malloc(10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - ICUNIT_GOTO_NOT_EQUAL(bufRead, NULL, 0, EXIT1); - (void)memset_s(bufRead, 10 * BYTES_PER_MBYTES + 1, 0, 10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - - for (i = 0; i < 10; i++) { // loop 10 times - for (j = 0; j < 10; j++) { // loop 10 times - g_fatFd12[i][j] = open(g_fat1650Pathname4[i][j], O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd12[i][j], -1, g_fatFd12[i][j], EXIT2); - - len = read(g_fatFd12[i][j], bufRead, 10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - ICUNIT_GOTO_EQUAL(len, 10 * BYTES_PER_MBYTES, len, EXIT2); // 10 * BYTES_PER_MBYTES = 10MB - - ret = close(g_fatFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - } - - free(bufRead); - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_fatFlag++; - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - return NULL; -EXIT2: - free(bufRead); -EXIT1: - for (i = 0; i < 10; i++) { // loop 10 times - for (j = 0; j < 10; j++) { // loop 10 times - close(g_fatFd12[i][j]); - } - } -EXIT: - for (i = 9; i >= 0; i--) { // loop 9 + 1 times - for (j = 9; j >= 0; j--) { // loop 9 + 1 times - remove(g_fat1650Pathname4[i][j]); - remove(g_fat1650Pathname5[i][j]); - } - - remove(g_fatPathname11[i]); - } - g_testCount = 0; - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - INT32 len; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - bufWrite = (CHAR *)malloc(10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 10 * BYTES_PER_MBYTES + 1, 0, 10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - - bufWrite1 = (CHAR *)malloc(512 * BYTES_PER_KBYTES + 1); // 512 * BYTES_PER_KBYTES = 512KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, 512 * BYTES_PER_KBYTES + 1, 0, // 512 kb - 512 * BYTES_PER_KBYTES + 1); // 512 * BYTES_PER_KBYTES = 512KB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 8; j++) { // loop 8 times - (void)strcat_s(bufWrite1, 512 * BYTES_PER_KBYTES + 1, bufWrite2); // 512 kb - (void)strcat_s(bufWrite1, 512 * BYTES_PER_KBYTES + 1, bufWrite2); // 512 kb - (void)strcat_s(bufWrite1, 512 * BYTES_PER_KBYTES + 1, bufWrite2); // 512 kb - (void)strcat_s(bufWrite1, 512 * BYTES_PER_KBYTES + 1, bufWrite2); // 512 kb - } - - for (i = 0; i < 10; i++) { // loop 10 times - (void)strcat_s(bufWrite, 10 * BYTES_PER_MBYTES + 1, bufWrite1); // 10 * BYTES_PER_MBYTES = 10MB - (void)strcat_s(bufWrite, 10 * BYTES_PER_MBYTES + 1, bufWrite1); // 10 * BYTES_PER_MBYTES = 10MB - } - free(bufWrite1); - free(bufWrite2); - for (i = 0; i < 10; i++) { // loop 10 times - for (j = 0; j < 10; j++) { // loop 10 times - g_fatFd12[i][j] = open(g_fat1650Pathname4[i][j], O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd12[i][j], -1, g_fatFd12[i][j], EXIT2); - - len = write(g_fatFd12[i][j], bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, 10 * BYTES_PER_MBYTES, len, EXIT2); // 10 * BYTES_PER_MBYTES = 10MB - - ret = close(g_fatFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - } - free(bufWrite); - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - for (i = 0; i < 10; i++) { // loop 10 times - for (j = 0; j < 10; j++) { // loop 10 times - ret = rename(g_fat1650Pathname4[i][j], g_fat1650Pathname5[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - for (i = 9; i >= 0; i--) { // loop 9 + 1 times - for (j = 9; j >= 0; j--) { // loop 9 + 1 times - ret = remove(g_fat1650Pathname5[i][j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - ret = remove(g_fatPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - g_fatFlagF02++; - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(2); // delay 2 s - - return NULL; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - for (i = 0; i < 10; i++) { // loop 10 times - for (j = 0; j < 10; j++) { // loop 10 times - close(g_fatFd12[i][j]); - } - } -EXIT: - for (i = 9; i >= 0; i--) { // loop 9 + 1 times - for (j = 9; j >= 0; j--) { // loop 9 + 1 times - remove(g_fat1650Pathname4[i][j]); - remove(g_fat1650Pathname5[i][j]); - } - remove(g_fatPathname11[i]); - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - g_testCount = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - DIR *dir = nullptr; - struct dirent *ptr = nullptr; - pthread_t newThread1, newThread2; - pthread_attr_t attr1, attr2; - - g_fatFlag = 0; - g_fatFlagF01 = 0; - g_fatFlagF02 = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - while ((g_fatFlag < FAT_PRESSURE_CYCLES) && (g_fatFlag == g_fatFlagF01)) { - g_testCount = 0; - - ret = PosixPthreadInit(&attr1, 20); // level 20 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newThread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, 20); // level 20 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newThread2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(FAT_SHORT_ARRAY_LENGTH); - - ret = PosixPthreadDestroy(&attr2, newThread2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newThread1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - printf("\tg_fatFlag=:%d\t", g_fatFlag); - } - printf("\n"); - ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT); - - dir = opendir(FAT_PATH_NAME); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newThread2); -EXIT1: - PosixPthreadDestroy(&attr1, newThread1); -EXIT: - rmdir(FAT_PATH_NAME); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PRESSURE_038 -* -@tspec The Pressure test -* -@ttitle Create the 10-level directory and create 10 subdirectories while creating the directory -* -@tprecon The filesystem module is open -* -@tbrief -1. create two tasks; -2. the first task create the 10-level directory ; -3. the another task create 10 subdirectories while creating the directory; -4. delete the directories and files; -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPressure038(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_038", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_040.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_040.cpp deleted file mode 100644 index 36507f62..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_040.cpp +++ /dev/null @@ -1,418 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. - */ - - * PURPOSE ARE DISCLAIMED. IN - * NO EVENT SHALL THE COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - INT32 j = 0; - CHAR bufname[FAT_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - off_t off; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - g_fatFlagF01++; - ret = format(FAT_DEV_PATH1, 0, 0); - ICUNIT_GOTO_NOT_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - for (j = 0; j < 4; j++) { // loop 4 times - (void)memset_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)memset_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)memset_s(g_fatPathname13[j], FAT_NAME_LIMITTED_SIZE, 0, FAT_STANDARD_NAME_LENGTH); - (void)memset_s(bufname, FAT_SHORT_ARRAY_LENGTH, 0, FAT_SHORT_ARRAY_LENGTH); - (void)snprintf_s(bufname, FAT_SHORT_ARRAY_LENGTH, FAT_SHORT_ARRAY_LENGTH, "/test%d", j); - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, pathname); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, pathname); - (void)strcat_s(g_fatPathname13[j], FAT_NAME_LIMITTED_SIZE, pathname); - - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_fatPathname13[j], FAT_NAME_LIMITTED_SIZE, bufname); - - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, ".txt"); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, ".cpp"); - (void)strcat_s(g_fatPathname13[j], FAT_NAME_LIMITTED_SIZE, ".jpg"); - - g_fatFd11[j] = open(g_fatPathname11[j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[j], -1, g_fatFd11[j], EXIT2); - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - off = lseek(g_fatFd11[0], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 100 * BYTES_PER_MBYTES, off, // 100mb - EXIT2); - - off = lseek(g_fatFd11[1], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 1MB - - off = lseek(g_fatFd11[2], 0, SEEK_END); // the 2 nd fd - ICUNIT_GOTO_EQUAL(off, BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 1MB - - off = lseek(g_fatFd11[3], 0, SEEK_END); // fd 3 - ICUNIT_GOTO_EQUAL(off, 256 * BYTES_PER_KBYTES, off, EXIT2); // 256 * BYTES_PER_KBYTES = 256KB - - for (j = 0; j < 4; j++) { // loop 4 times - ret = close(g_fatFd11[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - for (j = 0; j < FAT_MOUNT_CYCLES_TEST; j++) { - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - for (j = 0; j < FAT_MOUNT_CYCLES_TEST; j++) { - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - - for (j = 0; j < 4; j++) { // loop 4 times - ret = access(g_fatPathname13[j], F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - - g_fatFlag++; - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - return NULL; -EXIT3: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); -EXIT2: - for (j = 0; j < 4; j++) { // loop 4 times - close(g_fatFd11[j]); - } - - for (j = 0; j < 4; j++) { // loop 4 times - remove(g_fatPathname11[j]); - remove(g_fatPathname12[j]); - remove(g_fatPathname13[j]); - } -EXIT: - g_testCount = 0; - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret; - INT32 j = 0; - UINT64 len; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite1 = NULL; - CHAR *bufWrite2 = NULL; - CHAR *bufWrite3 = NULL; - CHAR *bufWrite4 = NULL; - off_t off; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - bufWrite1 = (CHAR *)malloc(FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES + 1, 0, - FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite3 = (CHAR *)malloc(256 * BYTES_PER_KBYTES + 1); // 256 * BYTES_PER_KBYTES = 256KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite3, NULL, 0, EXIT4); - (void)memset_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, 0, 256 * BYTES_PER_KBYTES + 1); // 256 kb - - bufWrite4 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite4, NULL, 0, EXIT5); - (void)memset_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 4; j++) { // loop 4 times - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - } - - for (j = 0; j < 2; j++) { // loop 2 times - (void)strcat_s(bufWrite2, BYTES_PER_MBYTES + 1, bufWrite3); - (void)strcat_s(bufWrite2, BYTES_PER_MBYTES + 1, bufWrite3); - } - - for (j = 0; j < 2; j++) { // loop 2 times - (void)strcat_s(bufWrite1, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES + 1, bufWrite2); - } - - free(bufWrite4); - - g_testCount++; - - for (j = 0; j < FAT_SHORT_ARRAY_LENGTH; j++) { - len = write(g_fatFd11[0], bufWrite1, strlen(bufWrite1)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES, len, EXIT5); // BYTES_PER_MBYTES = 1MB - } - - len = write(g_fatFd11[1], bufWrite1, strlen(bufWrite1)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES, len, EXIT5); // BYTES_PER_MBYTES = 1MB - - len = write(g_fatFd11[2], bufWrite2, strlen(bufWrite2)); // fd11 2 - ICUNIT_GOTO_EQUAL(len, BYTES_PER_MBYTES, len, EXIT5); - - len = write(g_fatFd11[3], bufWrite3, strlen(bufWrite3)); // fd 3 - ICUNIT_GOTO_EQUAL(len, 256 * BYTES_PER_KBYTES, len, EXIT5); // 256 * BYTES_PER_KBYTES = 256KB - - free(bufWrite1); - free(bufWrite2); - free(bufWrite3); - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - for (j = 0; j < 4; j++) { // loop 4 times - ret = rename(g_fatPathname11[j], g_fatPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - for (j = 0; j < 4; j++) { // loop 4 times - ret = rename(g_fatPathname12[j], g_fatPathname13[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(2); // delay 2 s - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - for (j = 0; j < 4; j++) { // loop 4 times - g_fatFd11[j] = open(g_fatPathname13[j], O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[j], -1, g_fatFd11[j], EXIT2); - } - - off = lseek(g_fatFd11[0], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 100 * BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 100 MB - - off = lseek(g_fatFd11[1], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 1MB - - off = lseek(g_fatFd11[2], 0, SEEK_END); // the 2 nd fd - ICUNIT_GOTO_EQUAL(off, BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 1MB - - off = lseek(g_fatFd11[3], 0, SEEK_END); // fd 3 - ICUNIT_GOTO_EQUAL(off, 256 * BYTES_PER_KBYTES, off, EXIT2); // 256 * BYTES_PER_KBYTES = 256KB - - for (j = 0; j < 4; j++) { // loop 4 times - ret = close(g_fatFd11[j]); - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(g_fatPathname13[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_fatFlagF02++; - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(2); // delay 2 s - - return NULL; -EXIT5: - free(bufWrite3); -EXIT4: - free(bufWrite1); -EXIT3: - free(bufWrite1); -EXIT2: - for (j = 0; j < 4; j++) { // loop 4 times - close(g_fatFd11[j]); - } -EXIT1: - for (j = 0; j < 4; j++) { // loop 4 times - remove(g_fatPathname11[j]); - remove(g_fatPathname12[j]); - remove(g_fatPathname13[j]); - } - - g_testCount = 0; - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newThread1, newThread2; - pthread_attr_t attr1, attr2; - - g_fatFlag = 0; - g_fatFlagF01 = 0; - g_fatFlagF02 = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - while ((g_fatFlag < FAT_PRESSURE_CYCLES) && (g_fatFlag == g_fatFlagF01)) { - g_testCount = 0; - - ret = PosixPthreadInit(&attr1, TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newThread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newThread2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(FAT_SHORT_ARRAY_LENGTH); - - ret = PosixPthreadDestroy(&attr2, newThread2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newThread1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - printf("\tg_fatFlag=:%d\t", g_fatFlag); - } - printf("\n"); - ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT2); - - dir = opendir(FAT_PATH_NAME); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newThread2); -EXIT1: - PosixPthreadDestroy(&attr1, newThread1); -EXIT: - rmdir(FAT_PATH_NAME); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PRESSURE_040 -* -@tspec The Pressure test -* -@ttitle After the creation of four documents 1000 umount / mount 1,000 months after the renaming documents umount / -mount -* -@tprecon The filesystem module is open -* -@tbrief -1. create two tasks; -2. the first task create 4 files ; -3. the another task rename the files and mount/umount the filesysterm; -4. delete the files; -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPressure040(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_040", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_041.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_041.cpp deleted file mode 100644 index 2d2ac83b..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_041.cpp +++ /dev/null @@ -1,413 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. - */ - - * PURPOSE ARE DISCLAIMED. IN - * NO EVENT SHALL THE COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - INT32 j = 0; - CHAR bufname[FAT_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = "/vs/sd/fat_1655"; - off_t off; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - g_fatFlagF01++; - - for (j = 0; j < 4; j++) { // loop 4 times - (void)memset_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)memset_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)memset_s(bufname, FAT_SHORT_ARRAY_LENGTH, 0, FAT_SHORT_ARRAY_LENGTH); - - (void)snprintf_s(bufname, FAT_SHORT_ARRAY_LENGTH, FAT_SHORT_ARRAY_LENGTH, "/test%d", j); - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, pathname); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, pathname2); - - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, bufname); - - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, ".txt"); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, ".txt"); - - g_fatFd11[j] = open(g_fatPathname11[j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[j], -1, g_fatFd11[j], EXIT2); - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - off = lseek(g_fatFd11[0], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 100 * BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 100 MB - - off = lseek(g_fatFd11[1], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 1MB - - off = lseek(g_fatFd11[2], 0, SEEK_END); // the 2 nd fd - ICUNIT_GOTO_EQUAL(off, BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 1MB - - off = lseek(g_fatFd11[3], 0, SEEK_END); // fd 3 - ICUNIT_GOTO_EQUAL(off, 256 * BYTES_PER_KBYTES, off, EXIT2); // 256 * BYTES_PER_KBYTES = 256KB - - for (j = 0; j < 4; j++) { // loop 4 times - ret = close(g_fatFd11[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - for (j = 0; j < FAT_MAXIMUM_OPERATIONS; j++) { - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - for (j = 0; j < FAT_MAXIMUM_OPERATIONS; j++) { - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - - for (j = 0; j < 4; j++) { // loop 4 times - ret = access(g_fatPathname12[j], F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - - g_fatFlag++; - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - return NULL; -EXIT3: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); -EXIT2: - for (j = 0; j < 4; j++) { // loop 4 times - close(g_fatFd11[j]); - } - - for (j = 0; j < 4; j++) { // loop 4 times - remove(g_fatPathname11[j]); - remove(g_fatPathname12[j]); - } -EXIT: - g_testCount = 0; - remove(pathname2); - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret; - INT32 j = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = "/vs/sd/fat_1655"; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite1 = NULL; - CHAR *bufWrite2 = NULL; - CHAR *bufWrite3 = NULL; - CHAR *bufWrite4 = NULL; - off_t off; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - bufWrite1 = (CHAR *)malloc(10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, 0, 10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - - bufWrite2 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite3 = (CHAR *)malloc(256 * BYTES_PER_KBYTES + 1); // 256 * BYTES_PER_KBYTES = 256KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite3, NULL, 0, EXIT4); - (void)memset_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, 0, 256 * BYTES_PER_KBYTES + 1); // 256 kb - - bufWrite4 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite4, NULL, 0, EXIT5); - (void)memset_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 4; j++) { // loop 4 times - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - } - - for (j = 0; j < 2; j++) { // loop 2 times - (void)strcat_s(bufWrite2, BYTES_PER_MBYTES + 1, bufWrite3); - (void)strcat_s(bufWrite2, BYTES_PER_MBYTES + 1, bufWrite3); - } - - for (j = 0; j < 2; j++) { // loop 2 times - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - } - - free(bufWrite4); - - g_testCount++; - - for (j = 0; j < 10; j++) { // loop 10 times - ret = write(g_fatFd11[0], bufWrite1, strlen(bufWrite1)); - ICUNIT_GOTO_EQUAL(ret, 10 * BYTES_PER_MBYTES, ret, EXIT5); // 10 * BYTES_PER_MBYTES = 10MB - } - - ret = write(g_fatFd11[1], bufWrite1, strlen(bufWrite1)); - ICUNIT_GOTO_EQUAL(ret, 10 * BYTES_PER_MBYTES, ret, EXIT5); // 10 * BYTES_PER_MBYTES = 10MB - - ret = write(g_fatFd11[2], bufWrite2, strlen(bufWrite2)); // fd 2 - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTES, ret, EXIT5); // BYTES_PER_MBYTES = 1MB - - ret = write(g_fatFd11[3], bufWrite3, strlen(bufWrite3)); // fd 3 - ICUNIT_GOTO_EQUAL(ret, 256 * BYTES_PER_KBYTES, ret, EXIT5); // 256 * BYTES_PER_KBYTES = 256KB - - free(bufWrite1); - free(bufWrite2); - free(bufWrite3); - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(2); // delay 2 s - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - for (j = 0; j < 4; j++) { // loop 4 times - g_fatFd11[j] = open(g_fatPathname12[j], O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[j], -1, g_fatFd11[j], EXIT2); - } - - off = lseek(g_fatFd11[0], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 100 * BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 100 MB - - off = lseek(g_fatFd11[1], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10 * BYTES_PER_MBYTES, off, EXIT2); // 10 mb - - off = lseek(g_fatFd11[2], 0, SEEK_END); // the 2 nd fd - ICUNIT_GOTO_EQUAL(off, BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 1MB - - off = lseek(g_fatFd11[3], 0, SEEK_END); // fd 3 - ICUNIT_GOTO_EQUAL(off, 256 * BYTES_PER_KBYTES, off, EXIT2); // 256 * BYTES_PER_KBYTES = 256KB - - for (j = 0; j < 4; j++) { // loop 4 times - ret = close(g_fatFd11[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(g_fatPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - g_fatFlagF02++; - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(2); // delay 2 s - - return NULL; -EXIT5: - free(bufWrite3); -EXIT4: - free(bufWrite2); -EXIT3: - free(bufWrite1); -EXIT2: - for (j = 0; j < 4; j++) { // loop 4 times - close(g_fatFd11[j]); - } -EXIT1: - for (j = 0; j < 4; j++) { // loop 4 times - remove(g_fatPathname11[j]); - remove(g_fatPathname12[j]); - } - - g_testCount = 0; - remove(pathname2); - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - DIR *dir = nullptr; - struct dirent *ptr = nullptr; - pthread_t newThread1, newThread2; - pthread_attr_t attr1, attr2; - - g_fatFlag = 0; - g_fatFlagF01 = 0; - g_fatFlagF02 = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - while ((g_fatFlag < FAT_PRESSURE_CYCLES) && (g_fatFlag == g_fatFlagF01)) { - g_testCount = 0; - - ret = PosixPthreadInit(&attr1, 20); // level 20 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newThread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, 20); // level 20 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newThread2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - sleep(5); // sleep 5s - - ret = PosixPthreadDestroy(&attr2, newThread2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newThread1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - printf("\tg_fatFlag=:%d\t", g_fatFlag); - } - printf("\n"); - - dir = opendir(FAT_PATH_NAME); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newThread2); -EXIT1: - PosixPthreadDestroy(&attr1, newThread1); -EXIT: - rmdir(FAT_PATH_NAME); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PRESSURE_041 -* -@tspec The Pressure test -* -@ttitle After the creation of four documents 1000 umount / mount 1,000 months after renaming the directory -* -@tprecon The filesystem module is open -* -@tbrief -1. create two tasks; -2. the first task create 4 files ; -3. the another task rename the directory and mount/umount the filesysterm; -4. delete the files; -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPressure041(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_041", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_042.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_042.cpp deleted file mode 100644 index 3bb7506b..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_042.cpp +++ /dev/null @@ -1,428 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - INT32 len; - INT32 j = 0; - CHAR bufname[FAT_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *bufRead1 = NULL; - CHAR *bufRead2 = NULL; - CHAR *bufRead3 = NULL; - off_t off; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - g_fatFlagF01++; - - for (j = 0; j < 3; j++) { // loop 3 times - (void)memset_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)memset_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)memset_s(bufname, FAT_SHORT_ARRAY_LENGTH, 0, FAT_SHORT_ARRAY_LENGTH); - - (void)snprintf_s(bufname, FAT_SHORT_ARRAY_LENGTH, FAT_SHORT_ARRAY_LENGTH, "/test%d", j); - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, pathname); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, pathname2); - - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, bufname); - - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, ".txt"); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, ".cpp"); - - g_fatFd11[j] = open(g_fatPathname11[j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[j], -1, g_fatFd11[j], EXIT2); - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - bufRead1 = (CHAR *)malloc(10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - ICUNIT_GOTO_NOT_EQUAL(bufRead1, NULL, 0, EXIT2); - (void)memset_s(bufRead1, 10 * BYTES_PER_MBYTES + 1, 0, 10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - - bufRead2 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufRead2, NULL, 0, EXIT3); - (void)memset_s(bufRead2, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufRead3 = (CHAR *)malloc(256 * BYTES_PER_KBYTES + 1); // 256 * BYTES_PER_KBYTES = 256KB - ICUNIT_GOTO_NOT_EQUAL(bufRead3, NULL, 0, EXIT4); - (void)memset_s(bufRead3, 256 * BYTES_PER_KBYTES + 1, 0, 256 * BYTES_PER_KBYTES + 1); // 256 kb - - off = lseek(g_fatFd11[0], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10 * BYTES_PER_MBYTES, off, EXIT5); // 10 mb - - off = lseek(g_fatFd11[1], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, BYTES_PER_MBYTES, off, EXIT5); - - off = lseek(g_fatFd11[2], 0, SEEK_END); // the 2 nd fd - ICUNIT_GOTO_EQUAL(off, 256 * BYTES_PER_KBYTES, off, EXIT5); // 256 kb - - off = lseek(g_fatFd11[0], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT5); - - off = lseek(g_fatFd11[1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT5); - - off = lseek(g_fatFd11[2], 0, SEEK_SET); // fd 2 - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT5); - - len = read(g_fatFd11[0], bufRead1, 10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - ICUNIT_GOTO_EQUAL(len, 10 * BYTES_PER_MBYTES, len, EXIT5); - - len = read(g_fatFd11[1], bufRead2, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_EQUAL(len, BYTES_PER_MBYTES, len, EXIT5); - - len = read(g_fatFd11[2], bufRead3, 256 * BYTES_PER_KBYTES + 1); // 256 kb - ICUNIT_GOTO_EQUAL(len, 256 * BYTES_PER_KBYTES, len, EXIT5); // 256 kb - - for (j = 0; j < 3; j++) { // loop 3 times - ret = close(g_fatFd11[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT5); - } - - for (j = 0; j < 3; j++) { // loop 3 times - g_fatFd11[j] = open(g_fatPathname11[j], O_NONBLOCK | O_TRUNC | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[j], -1, g_fatFd11[j], EXIT5); - } - - len = write(g_fatFd11[0], bufRead2, strlen(bufRead2)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_MBYTES, len, EXIT5); - - len = write(g_fatFd11[1], bufRead3, strlen(bufRead3)); - ICUNIT_GOTO_EQUAL(len, 256 * BYTES_PER_KBYTES, len, EXIT5); // 256 kb - - len = write(g_fatFd11[2], bufRead1, strlen(bufRead1)); // fd 2 - ICUNIT_GOTO_EQUAL(len, 10 * BYTES_PER_MBYTES, len, EXIT5); // 10 mb - - for (j = 0; j < 3; j++) { // loop 3 times - ret = close(g_fatFd11[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT5); - } - - free(bufRead1); - free(bufRead2); - free(bufRead3); - - g_fatFlag++; - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - return NULL; -EXIT5: - free(bufRead3); -EXIT4: - free(bufRead2); -EXIT3: - free(bufRead1); -EXIT2: - for (j = 0; j < 3; j++) { // loop 3 times - close(g_fatFd11[j]); - } - - for (j = 0; j < 3; j++) { // loop 3 times - remove(g_fatPathname11[j]); - remove(g_fatPathname12[j]); - } -EXIT: - g_testCount = 0; - remove(pathname2); - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret; - INT32 j = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite1 = NULL; - CHAR *bufWrite2 = NULL; - CHAR *bufWrite3 = NULL; - CHAR *bufWrite4 = NULL; - off_t off; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - bufWrite1 = (CHAR *)malloc(10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, 0, 10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - - bufWrite2 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite3 = (CHAR *)malloc(256 * BYTES_PER_KBYTES + 1); // 256 * BYTES_PER_KBYTES = 256KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite3, NULL, 0, EXIT4); - (void)memset_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, 0, 256 * BYTES_PER_KBYTES + 1); // 256 kb - - bufWrite4 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite4, NULL, 0, EXIT5); - (void)memset_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 4; j++) { // loop 4 times - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - } - - for (j = 0; j < 2; j++) { // loop 2 times - (void)strcat_s(bufWrite2, BYTES_PER_MBYTES + 1, bufWrite3); - (void)strcat_s(bufWrite2, BYTES_PER_MBYTES + 1, bufWrite3); - } - - for (j = 0; j < 2; j++) { // loop 2 times - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - } - - free(bufWrite4); - - g_testCount++; - - ret = write(g_fatFd11[0], bufWrite1, strlen(bufWrite1)); - ICUNIT_GOTO_EQUAL(ret, 10 * BYTES_PER_MBYTES, ret, EXIT5); // 10 * BYTES_PER_MBYTES = 10MB - - ret = write(g_fatFd11[1], bufWrite2, strlen(bufWrite2)); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTES, ret, EXIT5); // BYTES_PER_MBYTES = 1MB - - ret = write(g_fatFd11[2], bufWrite3, strlen(bufWrite3)); // fd 2 - ICUNIT_GOTO_EQUAL(ret, 256 * BYTES_PER_KBYTES, ret, EXIT5); // 256 * BYTES_PER_KBYTES = 256KB - - free(bufWrite1); - free(bufWrite2); - free(bufWrite3); - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - for (j = 0; j < 3; j++) { // loop 3 times - ret = rename(g_fatPathname11[j], g_fatPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - for (j = 0; j < FAT_MOUNT_CYCLES_TEST; j++) { - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT7); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT7); - } - - for (j = 0; j < 3; j++) { // loop 3 times - g_fatFd11[j] = open(g_fatPathname12[j], O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[j], -1, g_fatFd11[j], EXIT2); - } - - off = lseek(g_fatFd11[0], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 1MB - - off = lseek(g_fatFd11[1], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 256 * BYTES_PER_KBYTES, off, EXIT2); // 256 * BYTES_PER_KBYTES = 256KB - - off = lseek(g_fatFd11[2], 0, SEEK_END); // the 2 nd fd - ICUNIT_GOTO_EQUAL(off, 10 * BYTES_PER_MBYTES, off, EXIT2); // 10 mb - - for (j = 0; j < 3; j++) { // loop 3 times - ret = close(g_fatFd11[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(g_fatPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_fatFlagF02++; - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(2); // delay 2 s - - return NULL; -EXIT7: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, "vfat", 0, NULL); - goto EXIT2; - - free(bufWrite4); -EXIT5: - free(bufWrite3); -EXIT4: - free(bufWrite2); -EXIT3: - free(bufWrite1); -EXIT2: - for (j = 0; j < 3; j++) { // loop 3 times - close(g_fatFd11[j]); - } -EXIT1: - for (j = 0; j < 3; j++) { // loop 3 times - remove(g_fatPathname11[j]); - remove(g_fatPathname12[j]); - } -EXIT: - g_testCount = 0; - remove(pathname2); - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newThread1, newThread2; - pthread_attr_t attr1, attr2; - - g_fatFlag = 0; - g_fatFlagF01 = 0; - g_fatFlagF02 = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - while ((g_fatFlag < FAT_PRESSURE_CYCLES) && (g_fatFlag == g_fatFlagF01)) { - g_testCount = 0; - - ret = PosixPthreadInit(&attr1, 20); // level 20 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newThread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, 20); // level 20 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newThread2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(10); // delay 10 s - - ret = PosixPthreadDestroy(&attr2, newThread2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newThread1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - printf("\tg_fatFlag=:%d\t", g_fatFlag); - } - printf("\n"); - ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT2); - - dir = opendir(FAT_PATH_NAME); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newThread2); -EXIT1: - PosixPthreadDestroy(&attr1, newThread1); -EXIT: - rmdir(FAT_PATH_NAME); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PRESSURE_042 -* -@tspec The Pressure test -* -@ttitle After the creation of four documents 1000 umount / mount 1,000 months after read and write -* -@tprecon The filesystem module is open -* -@tbrief -1. create two tasks; -2. the first task create 3 files ; -3. the another task read and write the files and mount/umount the filesysterm; -4. delete the files; -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPressure042(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_042", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_301.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_301.cpp deleted file mode 100644 index 06aa1e13..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_301.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd = -1; - INT32 len; - INT32 i = FAT_SHORT_ARRAY_LENGTH; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR buffile[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[20 + 1] = "12345678901234567890"; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - struct statfs buf3 = { 0 }; - struct statfs buf4 = { 0 }; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, 8, 2); // cluster size 8 2 for FAT32 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/cdir"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(buffile, FAT_STANDARD_NAME_LENGTH, "/cdir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatfsPrintf(buf1); - - ret = statfs(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT); - ICUNIT_GOTO_EQUAL(buf1.f_bavail, buf2.f_bavail, buf1.f_bavail, EXIT); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT); - - while (i--) { - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(filebuf), len, EXIT); - } - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatfsPrintf(buf3); - - ret = statfs(buffile, &buf4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatfsPrintf(buf4); - - ICUNIT_GOTO_EQUAL(buf3.f_type, 0x4d44, buf3.f_type, EXIT); - ICUNIT_GOTO_EQUAL(buf4.f_type, 0x4d44, buf4.f_type, EXIT); - ICUNIT_GOTO_EQUAL(buf3.f_namelen, 0xFF, buf3.f_namelen, EXIT); - ICUNIT_GOTO_EQUAL(buf4.f_namelen, 0xFF, buf4.f_namelen, EXIT); - ICUNIT_GOTO_EQUAL(buf3.f_bsize, 4096, buf3.f_bsize, EXIT); // 4096 for size 4k - ICUNIT_GOTO_EQUAL(buf4.f_bsize, 4096, buf4.f_bsize, EXIT); // 4096 for size 4k - - i = 250; // loop time 250 - while (i--) { - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(filebuf), len, EXIT); - } - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatfsPrintf(buf3); - - ret = statfs(buffile, &buf4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatfsPrintf(buf4); - - FatDeleteFile(fd, buffile); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT2: - mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - return FAT_NO_ERROR; -EXIT: - format(FAT_DEV_PATH, 8, 0); // cluster size 8, 0 for auto -EXIT0: - return FAT_NO_ERROR; -} - -VOID ItFsFatPressure301(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_301", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} \ No newline at end of file diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_302.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_302.cpp deleted file mode 100644 index 01d621b7..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_302.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR buffile[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 n = 103; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/dir"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(buffile, FAT_STANDARD_NAME_LENGTH, "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - while (n--) { - len = write(fd, "0123456789012345678901234567890123456789", 40); // write 40 bytes - ICUNIT_GOTO_EQUAL(len, 40, len, EXIT); // len must be 40 - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(buffile, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ICUNIT_GOTO_EQUAL(buf1.st_blocks, buf2.st_blocks, buf1.st_blocks, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_mode, buf2.st_mode, buf1.st_mode, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT); - - FatDeleteFile(fd, buffile); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - format(FAT_DEV_PATH, 8, 0); // cluster size 8, 0 for auto - return FAT_NO_ERROR; -} - -VOID ItFsFatPressure302(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_302", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_303.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_303.cpp deleted file mode 100644 index c2996ca6..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_303.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 n = 256; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/dir"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname3, FAT_STANDARD_NAME_LENGTH, "/dir/files"); - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - while (n--) { - len = write(fd, "01234567890123456789012345", 16); // len 16 - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT); - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat(pathname3, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname3, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ICUNIT_GOTO_EQUAL(buf1.st_size, 16 * 256, buf1.st_size, EXIT); // 16 * 256 = 4k - ICUNIT_GOTO_EQUAL(buf2.st_size, 16 * 256, buf2.st_size, EXIT); // 16 * 256 = 4k - ICUNIT_GOTO_EQUAL(buf1.st_blocks, 1, buf1.st_blocks, EXIT); - ICUNIT_GOTO_EQUAL(buf2.st_blocks, 1, buf2.st_blocks, EXIT); - - ICUNIT_GOTO_EQUAL(buf1.st_mode & S_IFMT, S_IFREG, buf1.st_mode & S_IFMT, EXIT); - ICUNIT_GOTO_EQUAL(buf2.st_mode & S_IFMT, S_IFREG, buf2.st_mode & S_IFMT, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT); - - FatDeleteFile(fd, pathname3); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - format(FAT_DEV_PATH, 8, 0); // cluster size 8, 0 for auto - return FAT_NO_ERROR; -} - -VOID ItFsFatPressure303(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_303", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_305.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_305.cpp deleted file mode 100644 index 8b1bc1e4..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_305.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - DIR *dir = NULL; - DIR *dir1[50]; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - while (i < 50) { // loop 50 times - dir1[i] = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - i++; - } - - for (i = 0; i < 50; i++) { // loop 50 times - ret = closedir(dir1[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = format(FAT_DEV_PATH, 8, 2); // cluster size 8 2 for FAT32 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - return FAT_NO_ERROR; -EXIT3: - mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - goto EXIT; -EXIT2: - for (; i >= 0; i--) { - closedir(dir1[i]); - } -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -VOID ItFsFatPressure305(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_305", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_306.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_306.cpp deleted file mode 100644 index 4069af0b..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_306.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[50][FAT_STANDARD_NAME_LENGTH] = {FAT_PATH_NAME, }; - CHAR bufname[FAT_SHORT_ARRAY_LENGTH] = ""; - DIR *dir = NULL; - DIR *dir1[50] = {NULL, }; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT4); - - ret = format(FAT_DEV_PATH, 8, 2); // cluster size 8 2 for FAT32 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT4); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT4); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - for (i = 0; i < 50; i++) { // loop 50 times - (void)memset_s(bufname, FAT_SHORT_ARRAY_LENGTH, 0, FAT_SHORT_ARRAY_LENGTH); - (void)memset_s(pathname2[i], FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - (void)snprintf_s(bufname, FAT_SHORT_ARRAY_LENGTH, FAT_SHORT_ARRAY_LENGTH, "/test%d", i); - FatStrcat2(pathname2[i], bufname, FAT_STANDARD_NAME_LENGTH); - - ret = mkdir(pathname2[i], S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < 50; i++) { // loop 50 times - dir1[i] = opendir(pathname2[i]); - ICUNIT_GOTO_NOT_EQUAL(dir1[i], NULL, dir1[i], EXIT3); - } - - for (i = 0; i < 50; i++) { // loop 50 times - ret = closedir(dir1[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - for (i = 0; i < 50; i++) { // loop 50 times - ret = remove(pathname2[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT4: - mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - goto EXIT; -EXIT3: - for (i = 0; i < 50; i++) { // loop 50 times - closedir(dir1[i]); - } -EXIT2: - for (i = 0; i < 50; i++) { // loop 50 times - remove(pathname2[i]); - } -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); -EXIT0: - return FAT_NO_ERROR; -} - -VOID ItFsFatPressure306(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_306", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_309.cpp b/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_309.cpp deleted file mode 100644 index 199f82f0..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_fs_fat_pressure_309.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_MAIN_DIR; - DIR *dir = NULL; - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, 8, 2); // cluster size 8 2 for FAT32 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < 20; i++) { // loop 20 times - ret = format(FAT_DEV_PATH, 8, 2); // cluster size 8 2 for FAT32 - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, 8, 2); // cluster size 8 2 for FAT32 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, 8, 2); // cluster size 8 2 for FAT32 - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT); - } - - ret = format(FAT_DEV_PATH, 8, 0); // cluster size 8, 0 for auto - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT2: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - goto EXIT; -EXIT1: - closedir(dir); -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFatPressure309(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_309", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_003.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_003.cpp deleted file mode 100644 index 05798938..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_003.cpp +++ /dev/null @@ -1,546 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 fd1[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/file%d.txt", index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1[index1] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100 - len = write(fd1[index1], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = lseek(fd1[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd1[index1], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - LosTaskDelay(3); // delay 3s - printf("pthread_f01 is excecuting\n"); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; - -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 fd1[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is excecuting\n"); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file%d.txt", index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1[index1] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100 - len = write(fd1[index1], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = lseek(fd1[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd1[index1], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; - -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 fd1[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file%d.txt", index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1[index1] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100 - len = write(fd1[index1], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = lseek(fd1[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd1[index1], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; - -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } - - return FAT_NO_ERROR; -} - -/* * -* - @test It_vfs_fat_mutipthread_003 -* - @tspec function test -* - @ttitle multithreading writes the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously write to this file. -3 Check the contents of the file -4. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread003(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_003", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_004.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_004.cpp deleted file mode 100644 index ca68b6b7..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_004.cpp +++ /dev/null @@ -1,509 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 fd1[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - printf("In %s,line %d\n", __FUNCTION__, __LINE__); - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - printf("In %s,line %d, i =%d\n", __FUNCTION__, __LINE__, i); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - printf("In %s,line %d, i =%d\n", __FUNCTION__, __LINE__, i); - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file_%d.txt", - index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - - len = write(fd1[index1], writebuf, strlen(writebuf)); - - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - - index1++; - } - - if (flag == 0) { - index1--; - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f01 is excecuting\n"); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file_%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file_%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 fd1[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - printf("In %s,line %d\n", __FUNCTION__, __LINE__); - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - printf("In %s,line %d, i =%d\n", __FUNCTION__, __LINE__, i); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - printf("In %s,line %d, i =%d\n", __FUNCTION__, __LINE__, i); - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file_%d.txt", - index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - - len = write(fd1[index1], writebuf, strlen(writebuf)); - - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - - index1++; - } - - if (flag == 0) { - index1--; - } - - LosTaskDelay(10); // delay 10 s - printf("pthread_f02 is excecuting\n"); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file_%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file_%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 fd1[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - printf("In %s,line %d\n", __FUNCTION__, __LINE__); - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - printf("In %s,line %d, i =%d\n", __FUNCTION__, __LINE__, i); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - printf("In %s,line %d, i =%d\n", __FUNCTION__, __LINE__, i); - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file_%d.txt", - index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - - len = write(fd1[index1], writebuf, strlen(writebuf)); - - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - - index1++; - } - - if (flag == 0) { - index1--; - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is excecuting\n"); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file_%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file_%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_004 -* - @tspec function test -* - @ttitle multithreading reads the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously read this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread004(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_004", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_005.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_005.cpp deleted file mode 100644 index adcbf5df..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_005.cpp +++ /dev/null @@ -1,427 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len; - INT32 flag = 0; - INT32 fd = -1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - printf("pthread_f01 is excecuting\n"); - bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - } - - for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - } - - free(bufWrite1); - free(bufWrite2); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file0.txt"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - - for (j = 0; j < (8 * BYTES_PER_KBYTES / 8); j++) { // 8 kb - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is excecuting\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = read(fd, readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - free(bufWrite); - - printf("pthread_f01 exiting\n"); - return NULL; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len; - INT32 flag = 0; - INT32 fd = -1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - printf("pthread_f02 is excecuting\n"); - bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - } - - for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - } - - free(bufWrite1); - free(bufWrite2); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file1.txt"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - - for (j = 0; j < (8 * BYTES_PER_KBYTES / 8); j++) { // 8 kb - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f02 is excecuting\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = read(fd, readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - free(bufWrite); - - printf("pthread_f02 exiting\n"); - return NULL; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len; - INT32 flag = 0; - INT32 fd = -1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - printf("pthread_f03 is excecuting\n"); - bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - } - - for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - } - - free(bufWrite1); - free(bufWrite2); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file2.txt"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - for (j = 0; j < (8 * BYTES_PER_KBYTES / 8); j++) { // 8 kb - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f03 is excecuting\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = read(fd, readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - free(bufWrite); - - printf("pthread_f03 exiting\n"); - return NULL; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_005 -* - @tspec function test -* - @ttitle multithreading reads the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously read this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread005(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_005", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_006.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_006.cpp deleted file mode 100644 index 4a3212f6..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_006.cpp +++ /dev/null @@ -1,710 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len; - INT32 index = 0; - INT32 index1 = 0; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - CHAR *bufWrite3 = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - struct stat buf1 = { 0 }; - - bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - } - - for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - } - - free(bufWrite1); - free(bufWrite2); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - index = 0; - for (i = 0; i < FAT_LONG_FILESIZE; i++) { // 5 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < (8 * BYTES_PER_KBYTES / 8); j++) { // 8 k - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - bufWrite3 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite3, NULL, NULL, EXIT); - (void)memset_s(bufWrite3, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite3, BYTES_PER_MBYTES + 1, filebuf); - } - - index1 = 0; - for (i = 0; i < FAT_LONG_FILESIZE; i++) { // 5 个文件 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test0/test00/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index1], bufWrite3, strlen(bufWrite3)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f01 is excecuting\n"); - - ret = lseek(fd[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index1], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test0/test00/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - free(bufWrite3); - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - unlink(pathname); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test0/test00/file%d.txt", i); - unlink(pathname1); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len; - INT32 index = 0; - INT32 index1 = 0; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - CHAR *bufWrite3 = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - struct stat buf1 = { 0 }; - - bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - } - - for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - } - - free(bufWrite1); - free(bufWrite2); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - index = 0; - for (i = 0; i < FAT_LONG_FILESIZE; i++) { // 5 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < (8 * BYTES_PER_KBYTES / 8); j++) { // 8 k - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f02 is excecuting\n"); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - bufWrite3 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite3, NULL, NULL, EXIT); - (void)memset_s(bufWrite3, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite3, BYTES_PER_MBYTES + 1, filebuf); - } - - index1 = 0; - for (i = 0; i < FAT_LONG_FILESIZE; i++) { // 5 个文件 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test1/test11/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index1], bufWrite3, strlen(bufWrite3)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = lseek(fd[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index1], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test1/test11/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - free(bufWrite3); - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - unlink(pathname); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test1/test11/file%d.txt", i); - unlink(pathname1); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len; - INT32 index = 0; - INT32 index1 = 0; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - CHAR *bufWrite3 = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - struct stat buf1 = { 0 }; - - bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - } - - for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - } - - free(bufWrite1); - free(bufWrite2); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - index = 0; - for (i = 0; i < FAT_LONG_FILESIZE; i++) { // 5 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < (8 * BYTES_PER_KBYTES / 8); j++) { // 8 k - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - bufWrite3 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite3, NULL, NULL, EXIT); - (void)memset_s(bufWrite3, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite3, BYTES_PER_MBYTES + 1, filebuf); - } - - index1 = 0; - for (i = 0; i < FAT_LONG_FILESIZE; i++) { // 5 个文件 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test2/test22/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index1], bufWrite3, strlen(bufWrite3)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index1], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test2/test22/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - free(bufWrite3); - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - unlink(pathname); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test2/test22/file%d.txt", i); - unlink(pathname1); - } - free(bufWrite); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_006 -* - @tspec function test -* - @ttitle multithreading reads the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously read this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread006(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_006", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_008.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_008.cpp deleted file mode 100644 index 619eb952..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_008.cpp +++ /dev/null @@ -1,555 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len; - INT32 index = 0; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "1111"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - CHAR buffile2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_STANDARD_NAME_LENGTH; i++) { // 50 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - free(bufWrite); - index1 = FAT_STANDARD_NAME_LENGTH; - for (i = FAT_STANDARD_NAME_LENGTH; i < FAT_MAX_CYCLES; i++) { // 50 个文件 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", - index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - len = write(fd[index1], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // write 4 bytes - if (len <= 0) { - flag = 1; - break; - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - return NULL; - - free(bufWrite); -EXIT1: - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len; - INT32 index = 0; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "1111"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME1; - CHAR buffile2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_STANDARD_NAME_LENGTH; i++) { // 50 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - free(bufWrite); - index1 = FAT_STANDARD_NAME_LENGTH; - for (i = FAT_STANDARD_NAME_LENGTH; i < FAT_MAX_CYCLES; i++) { // 50 个文件 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", - index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - len = write(fd[index1], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // write 4 bytes - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - return NULL; - - free(bufWrite); -EXIT1: - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len; - INT32 index = 0; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "1111"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - CHAR buffile2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_STANDARD_NAME_LENGTH; i++) { // 50 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - free(bufWrite); - index1 = FAT_STANDARD_NAME_LENGTH; - for (i = FAT_STANDARD_NAME_LENGTH; i < FAT_MAX_CYCLES; i++) { // 50 个文件 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", - index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - len = write(fd[index1], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // write 4 bytes - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - g_testCount++; - - return NULL; - -EXIT1: - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_008 -* - @tspec function test -* - @ttitle multithreading reads the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously read this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread008(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_008", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_009.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_009.cpp deleted file mode 100644 index 6959b2a1..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_009.cpp +++ /dev/null @@ -1,404 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - struct stat buf1 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; - -EXIT1: - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME1; - struct stat buf1 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100 - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; - -EXIT1: - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME1; - struct stat buf1 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100 - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; - -EXIT1: - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_009 -* - @tspec function test -* - @ttitle multithreading reads the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously read this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread009(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_009", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_010.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_010.cpp deleted file mode 100644 index a7e1f733..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_010.cpp +++ /dev/null @@ -1,574 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 index1 = 0; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - CHAR buffile2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < 5; i++) { // 5 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 256; j++) { // 写满256 - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 5; // index1 should set to 5 - for (i = 5; i < FAT_MIDDLE_CYCLES; i++) { // 5 个文件 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < 128; j++) { // 写满128 - len = write(fd[index1], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - for (i = index1; i >= 5; i--) { // loop until 5 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - g_testCount++; - - free(bufWrite); - - return NULL; - - free(bufWrite); -EXIT1: - for (i = index1; i >= 5; i--) { // loop until 5 - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - i); - unlink(pathname); - } - - for (i = index1; i >= 5; i--) { // loop until 5 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/file%d.txt", i); - unlink(pathname1); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 index1 = 0; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME1; - CHAR buffile2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < 5; i++) { // 5 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 256; j++) { // 写满256 - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 5; // index1 should set to 5 - for (i = 5; i < FAT_MIDDLE_CYCLES; i++) { // 5 个文件 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < 128; j++) { // 写满128 - len = write(fd[index1], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f02 is excecuting\n"); - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - for (i = index1; i >= 5; i--) { // loop until 5 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; - - free(bufWrite); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - i); - unlink(pathname); - } - - for (i = index1; i >= 5; i--) { // loop until 5 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file%d.txt", i); - unlink(pathname1); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 index1 = 0; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME2; - CHAR buffile2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < 5; i++) { // 5 个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 256; j++) { // 写满256 - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 5; // index1 should set to 5 - for (i = 5; i < FAT_MIDDLE_CYCLES; i++) { // 5 个文件 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < 128; j++) { // 写满128 - len = write(fd[index1], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - for (i = index1; i >= 5; i--) { // loop until 5 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; - - free(bufWrite); -EXIT1: - for (i = index1; i >= 5; i--) { // loop until 5 - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - i); - unlink(pathname); - } - - for (i = index1; i >= 5; i--) { // loop until 5 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file%d.txt", i); - unlink(pathname1); - } - free(bufWrite); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_010 -* - @tspec function test -* - @ttitle multithreading reads the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously read this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread010(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_010", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_012.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_012.cpp deleted file mode 100644 index 4dd8e105..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_012.cpp +++ /dev/null @@ -1,630 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i, j, ret, len, flag; - INT32 index = 0; - INT32 index1 = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf = { 0 }; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/ttest%d", - index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // four byte - if (len <= 0) { - flag = 1; - break; - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i, j, ret, len, flag; - INT32 index = 0; - INT32 index1 = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME1; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf = { 0 }; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 50 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/ttest%d", i); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // 10M - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i, j, ret, len, flag; - INT32 index = 0; - INT32 index1 = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME2; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf = { 0 }; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 50 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - index1 = 0; - for (i = 0; i < 100; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/ttest%d", - index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // 10M - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test It_vfs_fat_mutipthread_012 -* - @tspec function test -* - @ttitle multithreading writes the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously write to this file. -3 Check the contents of the file -4. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread012(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_012", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_014.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_014.cpp deleted file mode 100644 index 23824d53..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_014.cpp +++ /dev/null @@ -1,633 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i = 0; - INT32 j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf = { 0 }; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/ttest%d", index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // four byte - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test00/ttest%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i = 0; - INT32 j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME1; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf = { 0 }; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/ttest%d", index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // four byte - if (len <= 0) { - flag = 1; - break; - } - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test11/ttest%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i = 0; - INT32 j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME2; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf = { 0 }; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/ttest%d", index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // four byte - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test22/ttest%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test It_vfs_fat_mutipthread_014 -* - @tspec function test -* - @ttitle multithreading writes the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously write to this file. -3 Check the contents of the file -4. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread014(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_014", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_016.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_016.cpp deleted file mode 100644 index 7880ef62..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_016.cpp +++ /dev/null @@ -1,666 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i, j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/tttest%d", - index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // four byte - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/tttest_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/tttest_%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/tttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - i = 0; - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/tttest_%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i, j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/tttest%d", - index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // four byte - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/tttest_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/tttest_%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/tttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - i = 0; - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/tttest_%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i, j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/tttest%d", - index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // four byte - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/tttest_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/tttest_%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/tttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - i = 0; - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/tttest_%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test It_vfs_fat_mutipthread_016 -* - @tspec function test -* - @ttitle multithreading writes the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously write to this file. -3 Check the contents of the file -4. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread016(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_016", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_017.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_017.cpp deleted file mode 100644 index 06d41d21..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_017.cpp +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/testdir%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/testdir_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/testdir_%d", - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/testdir%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/testdir_%d", - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test1%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test01_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test01_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test1%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test01_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test It_vfs_fat_mutipthread_017 -* - @tspec function test -* - @ttitle multithreading writes the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously write to this file. -3 Check the contents of the file -4. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread017(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_017", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_018.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_018.cpp deleted file mode 100644 index c66e24f0..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_018.cpp +++ /dev/null @@ -1,646 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i = 0; - INT32 j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/tttest%d", index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/tttest_%d", index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/tttest_%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test00/tttest%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - i = 0; - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/tttest_%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ret = rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ret = rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i = 0; - INT32 j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/tttest%d", index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/tttest_%d", index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/tttest_%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test11/tttest%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - i = 0; - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/tttest_%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ret = rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ret = rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i = 0; - INT32 j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/tttest%d", index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/tttest_%d", index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/tttest_%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test22/tttest%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - i = 0; - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/tttest_%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ret = rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ret = rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test It_vfs_fat_mutipthread_001 -* - @tspec function test -* - @ttitle multithreading writes the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously write to this file. -3 Check the contents of the file -4. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread018(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_018", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_019.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_019.cpp deleted file mode 100644 index 8e71f3bf..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_019.cpp +++ /dev/null @@ -1,448 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f01 is excecuting\n"); - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, nullptr); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test/test0/file2%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f02 is excecuting\n"); - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test/test0/file2%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test/test0/file2%d.txt", i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test/test0/test1/file3%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is excecuting\n"); - break; - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test/test0/test1/file3_%d.txt", index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test/test0/test1/file3_%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test/test0/test1/file3_%d.txt", i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - (void)strcat_s(bufname2, FAT_STANDARD_NAME_LENGTH, "/test0"); - (void)strcat_s(bufname3, FAT_STANDARD_NAME_LENGTH, "/test0/test1"); - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 1); // fd 2 level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_019 -* - @tspec function test -* - @ttitleMultithreading deletes the same file at the same time -* - @tbrief -1. Create a file -2. Create three threads to delete this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread019(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_019", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_020.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_020.cpp deleted file mode 100644 index 0299cc5c..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_020.cpp +++ /dev/null @@ -1,444 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is excecuting\n"); - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file2%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is excecuting\n"); - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); // four bytes - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file2%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file2%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file3%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); // four bytes - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is excecuting\n"); - break; - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file3_%d.txt", - index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file3_%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file3_%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_020 -* - @tspec function test -* - @ttitleMultithreading deletes the same file at the same time -* - @tbrief -1. Create a file -2. Create three threads to delete this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread020(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_020", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_021.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_021.cpp deleted file mode 100644 index 29116342..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_021.cpp +++ /dev/null @@ -1,428 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - printf("pthread_f01 is excecuting\n"); - break; - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file2%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is excecuting\n"); - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); // four bytes - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file2%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file2%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file3%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f03 is excecuting\n"); - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); // four bytes - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file3_%d.txt", - index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file3_%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file3_%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 3); // fd 2 level less for 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_021 -* - @tspec function test -* - @ttitleMultithreading deletes the same file at the same time -* - @tbrief -1. Create a file -2. Create three threads to delete this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread021(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_021", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_022.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_022.cpp deleted file mode 100644 index 6369422a..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_022.cpp +++ /dev/null @@ -1,469 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, NULL, EXIT0); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is excecuting\n"); - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, nullptr); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); -EXIT0: - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file2%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f02 is excecuting\n"); - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file2%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file2%d.txt", i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file3%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f03 is excecuting\n"); - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file3_%d.txt", index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file3_%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file3_%d.txt", i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_022 -* - @tspec function test -* - @ttitleMultithreading deletes the same file at the same time -* - @tbrief -1. Create a file -2. Create three threads to delete this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread022(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_022", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_023.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_023.cpp deleted file mode 100644 index 06b7a1fb..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_023.cpp +++ /dev/null @@ -1,445 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is excecuting\n"); - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file2%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is excecuting\n"); - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); // four bytes - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file2%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file2%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file3%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f03 is excecuting\n"); - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); // four bytes - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file3_%d.txt", - index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file3_%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file3_%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 3); // fd 2 level less for 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_023 -* - @tspec function test -* - @ttitleMultithreading deletes the same file at the same time -* - @tbrief -1. Create a file -2. Create three threads to delete this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread023(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_023", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_024.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_024.cpp deleted file mode 100644 index ad6d4e27..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_024.cpp +++ /dev/null @@ -1,427 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - printf("pthread_f01 is excecuting\n"); - break; - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file2%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is excecuting\n"); - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); // four bytes - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file2%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file2%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file3%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f03 is excecuting\n"); - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); // four bytes - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file3_%d.txt", - index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file3_%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file3_%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 3); // fd 2 level less for 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_024 -* - @tspec function test -* - @ttitleMultithreading deletes the same file at the same time -* - @tbrief -1. Create a file -2. Create three threads to delete this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread024(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_024", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_027.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_027.cpp deleted file mode 100644 index 0e36a7b0..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_027.cpp +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME0, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME1, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME1, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME1, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME2, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME2, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME2, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_027 -* - @tspec pressure test -* - @ttitle multithreaded open, write, read, offset, close the 100M file -* - @tbrief -1. In the peer directory -2. Three threads -3. Same priority -4. 100 files per thread -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ -VOID ItFsFatMutipthread027(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_027", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_029.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_029.cpp deleted file mode 100644 index bc67be1e..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_029.cpp +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME_0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME_0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME_0, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", - FAT_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", - FAT_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", - FAT_PATH_NAME_01, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_0; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_01; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_029 -* - @tspec pressure test -* - @ttitle multithreaded open, write, read, offset, close the 100M file -* - @tbrief -1. In the different levels of directory -2. Three threads -3. Same priority -4. 100 files per thread -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread029(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_029", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_030.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_030.cpp deleted file mode 100644 index 40a2180e..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_030.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME0, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME1, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME1, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME1, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME2, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME2, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME2, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_030 -* - @tspec pressure test -* - @ttitle multithreaded open, search, close the 100M file -* - @tbrief -1. In the peer directory -2. Three threads -3. Same priority -4. 100 files per thread -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread030(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_030", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_032.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_032.cpp deleted file mode 100644 index 5d9a68a3..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_032.cpp +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME_0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME_0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME_0, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", - FAT_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", - FAT_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", - FAT_PATH_NAME_01, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_0; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_01; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_032 -* - @tspec pressure test -* - @ttitle multithreaded open, search, close the 10b file -* - @tbrief -1. In the different levels of directory -2. Three threads -3. Same priority -4. 100 files per thread -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread032(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_032", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_033.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_033.cpp deleted file mode 100644 index b5ac0acd..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_033.cpp +++ /dev/null @@ -1,423 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index, offset; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - DIR *dir = NULL; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME0, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, FAT_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME0, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME0, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index, offset; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - DIR *dir = NULL; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME1, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, FAT_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME1, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME1, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index, offset; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - DIR *dir = NULL; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME2, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, FAT_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME2, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME2, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_033 -* - @tspec pressure test -* - @ttitle multithreaded open, search, close the 100 directory -* - @tbrief -1. In the peer directory -2. Three threads -3. Same priority -4. 100 directory per thread -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread033(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_033", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_035.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_035.cpp deleted file mode 100644 index 623acc00..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_035.cpp +++ /dev/null @@ -1,426 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index, offset; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - DIR *dir = NULL; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, FAT_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index, offset; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - DIR *dir = NULL; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME_0, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, FAT_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME_0, - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME_0, - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index, offset; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - DIR *dir = NULL; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME_01, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, FAT_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME_01, - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME_01, - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_0; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_01; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_035 -* - @tspec pressure test -* - @ttitle multithreaded open, search, close the 100M directory -* - @tbrief -1. In the different levels of directory -2. Three threads -3. Same priority -4. 100 directory per thread -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread035(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_035", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_036.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_036.cpp deleted file mode 100644 index 16e66e5a..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_036.cpp +++ /dev/null @@ -1,426 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME0, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME0, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME0, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME0, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME0, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME1, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME1, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME1, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME1, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME1, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME2, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME2, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME2, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME2, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME2, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_036 -* - @tspec pressure test -* - @ttitle multithreaded creat, rename, remove the 100M directory -* - @tbrief -1. In the peer directory -2. Three threads -3. Same priority -4. 100 directory per thread -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread036(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_036", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_038.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_038.cpp deleted file mode 100644 index 0a43ba6c..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_038.cpp +++ /dev/null @@ -1,432 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test1%d", FAT_PATH_NAME, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test1_%d", FAT_PATH_NAME, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test1_%d", FAT_PATH_NAME, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test1%d", FAT_PATH_NAME, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test1_%d", FAT_PATH_NAME, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test2%d", FAT_PATH_NAME_0, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test2_%d", FAT_PATH_NAME_0, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test2_%d", FAT_PATH_NAME_0, - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test2%d", FAT_PATH_NAME_0, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test2_%d", FAT_PATH_NAME_0, - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test3%d", FAT_PATH_NAME_01, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test3_%d", FAT_PATH_NAME_01, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test3_%d", FAT_PATH_NAME_01, - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test3%d", FAT_PATH_NAME_01, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test3_%d", FAT_PATH_NAME_01, - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_0; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_01; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_038 -* - @tspec pressure test -* - @ttitle multithreaded creat, rename, remove the 100M directory -* - @tbrief -1. In the different levels of directory -2. Three threads -3. Same priority -4. 100 directory per thread -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread038(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_038", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_039.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_039.cpp deleted file mode 100644 index bd35dc08..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_039.cpp +++ /dev/null @@ -1,438 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // there 3 threads - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_039 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the same directory -2. Three threads -3. Same priority -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread039(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_039", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_040.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_040.cpp deleted file mode 100644 index a2dc3b99..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_040.cpp +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", FAT_PATH_NAME2, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_040 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the peer directory -2. Three threads -3. Same priority -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread040(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_040", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_041.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_041.cpp deleted file mode 100644 index 19f31f2d..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_041.cpp +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", - FAT_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_0; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_01; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_041 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the different levels of directory -2. Three threads -3. Same priority -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread041(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_041", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_042.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_042.cpp deleted file mode 100644 index 161ac289..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_042.cpp +++ /dev/null @@ -1,459 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", FAT_PATH_NAME2, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 1); // fd 2 level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_042 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the peer directory -2. Three threads -3. different priority - pthread_f01 high - pthread_f02 middle - pthread_f03 low -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread042(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_042", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_043.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_043.cpp deleted file mode 100644 index a003fa33..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_043.cpp +++ /dev/null @@ -1,441 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)(void) snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 1); // fd 2 level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_043 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the same directory -2. Three threads -3. different priority - pthread_f01 high - pthread_f02 middle - pthread_f03 low -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread043(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_043", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_044.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_044.cpp deleted file mode 100644 index 14b9f3a3..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_044.cpp +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", - FAT_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_0; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_01; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 1); // fd 2 level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_044 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the different levels of directory -2. Three threads -3. different priority - pthread_f01 high - pthread_f02 middle - pthread_f03 low -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ -VOID ItFsFatMutipthread044(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_044", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_045.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_045.cpp deleted file mode 100644 index 64d81794..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_045.cpp +++ /dev/null @@ -1,459 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", FAT_PATH_NAME2, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 3); // fd 2 level less for 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_045 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the peer directory -2. Three threads -3. different priority - pthread_f01 middle - pthread_f02 low - pthread_f03 high -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread045(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_045", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_046.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_046.cpp deleted file mode 100644 index 3bf81ed5..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_046.cpp +++ /dev/null @@ -1,379 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - index--; - ICUNIT_GOTO_NOT_EQUAL(fd[index], -1, fd[index], EXIT1); - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - index++; - } - - for (i = index - 1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - g_testCount++; - free(bufWrite); - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - index--; - ICUNIT_GOTO_NOT_EQUAL(fd[index], -1, fd[index], EXIT1); - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - index++; - } - - for (i = index - 1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - index--; - ICUNIT_GOTO_NOT_EQUAL(fd[index], -1, fd[index], EXIT1); - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME, index); - - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - index++; - } - - for (i = index - 1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - free(bufWrite); - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 3); // fd 2 level less for 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // there 3 threads - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_046 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the same directory -2. Three threads -3. different priority - pthread_f01 middle - pthread_f02 low - pthread_f03 high -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ -VOID ItFsFatMutipthread046(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_046", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_047.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_047.cpp deleted file mode 100644 index 4b68477a..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_047.cpp +++ /dev/null @@ -1,459 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", - FAT_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_0; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_01; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 3); // fd 2 level less for 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_045 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the different levels of directory -2. Three threads -3. different priority - pthread_f01 middle - pthread_f02 low - pthread_f03 high -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread047(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_047", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_048.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_048.cpp deleted file mode 100644 index deb6fa9b..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_048.cpp +++ /dev/null @@ -1,460 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - printf("%s_%d, read ret = %d, errno = %d(%s)\n", __func__, __LINE__, len, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", FAT_PATH_NAME2, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_048 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the peer directory -2. Three threads -3. different priority - pthread_f01 low - pthread_f02 high - pthread_f03 middle -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread048(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_048", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_049.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_049.cpp deleted file mode 100644 index 84a307c4..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_049.cpp +++ /dev/null @@ -1,441 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_049 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the same directory -2. Three threads -3. different priority - pthread_f01 low - pthread_f02 high - pthread_f03 middle -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread049(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_049", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_050.cpp b/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_050.cpp deleted file mode 100644 index 38f4ab95..00000000 --- a/testsuites/unittest/fs/vfat/pressure/It_vfs_fat_mutipthread_050.cpp +++ /dev/null @@ -1,459 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100个文件 - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", - FAT_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 写满100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // 写满10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_0; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_01; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_050 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the different levels of directory -2. Three threads -3. different priority - pthread_f01 low - pthread_f02 high - pthread_f03 middle -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread050(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_050", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest/fs/vfat/smoke/It_vfs_fat_026.cpp b/testsuites/unittest/fs/vfat/smoke/It_vfs_fat_026.cpp deleted file mode 100644 index 5aa48eae..00000000 --- a/testsuites/unittest/fs/vfat/smoke/It_vfs_fat_026.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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 "It_vfs_fat.h" -static const int FAT_FORMAT_SEC = 8; -static const int SIZE_4K = 4096; -static const int WRITE_TIME = 250; - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd = 0; - INT32 len = 0; - INT32 i = FAT_SHORT_ARRAY_LENGTH; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR buffile[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[FAT_STANDARD_NAME_LENGTH] = "12345678901234567890"; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - struct statfs buf3 = { 0 }; - struct statfs buf4 = { 0 }; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = format(FAT_DEV_PATH, FAT_FORMAT_SEC, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/dir"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = strcat_s(buffile, FAT_STANDARD_NAME_LENGTH, "/dir/files"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT3); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - FatStatfsPrintf(buf1); - - ret = statfs(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.f_bavail, buf2.f_bavail, buf1.f_bavail, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.f_bfree, buf2.f_bfree, buf1.f_bfree, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT3); - - while (i--) { - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(filebuf), len, EXIT3); - } - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - FatStatfsPrintf(buf3); - - ret = statfs(buffile, &buf4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - FatStatfsPrintf(buf4); - - ICUNIT_GOTO_EQUAL(buf3.f_type, 0x4d44, buf3.f_type, EXIT3); - ICUNIT_GOTO_EQUAL(buf4.f_type, 0x4d44, buf4.f_type, EXIT3); - ICUNIT_GOTO_EQUAL(buf3.f_namelen, 0xFF, buf3.f_namelen, EXIT3); - ICUNIT_GOTO_EQUAL(buf4.f_namelen, 0xFF, buf4.f_namelen, EXIT3); - ICUNIT_GOTO_EQUAL(buf3.f_bsize, SIZE_4K, buf3.f_bsize, EXIT3); - ICUNIT_GOTO_EQUAL(buf4.f_bsize, SIZE_4K, buf4.f_bsize, EXIT3); - ICUNIT_GOTO_EQUAL(buf3.f_bfree + 1, buf1.f_bfree, buf3.f_bfree + 1, EXIT3); - ICUNIT_GOTO_EQUAL(buf4.f_bfree + 1, buf2.f_bfree, buf4.f_bfree + 1, EXIT3); - - i = WRITE_TIME; - while (i--) { - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(filebuf), len, EXIT3); - } - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - FatStatfsPrintf(buf3); - - ret = statfs(buffile, &buf4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - FatStatfsPrintf(buf4); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - close(fd); -EXIT2: - FatStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - FatStrcat2(pathname1, "/dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(FAT_PATH_NAME); -EXIT0: - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_026 -* -@tspec The function test for filesystem -* -@ttitle Use the statfs to view the information for the filesystem -* -@tprecon The filesystem module is open -* -@tbrief -1. create one file; -2. use the statfs to view the information for the filesystem; -3. write the file and view the information once again; -4. delete all the file and directory. -* -@texpect -* -@tprior 1 -* -@tauto TRUE -* -@tremark -* Successful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat026(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_026", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL0, TEST_FUNCTION); -} -- GitLab