Skip to content

Commit 9af39f1

Browse files
author
Hongzhen Luo
committed
[EROFS] test: fix indentation issues
Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com>
1 parent 701f164 commit 9af39f1

1 file changed

Lines changed: 26 additions & 26 deletions

File tree

src/overlaybd/tar/erofs/test/erofs_stress.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ class StressInterImpl: public StressGenInter {
5858
std::string hash_val;
5959

6060
while (size > 0) {
61-
len = std::min(size, block_size);
62-
std::string block_str = get_randomstr(len, false);
63-
if (file->file->pwrite(block_str.c_str(), len, offset) != len)
64-
LOG_ERROR_RETURN(-1, -1, "fail to write to host file `", file->path);
65-
hash_val = std::to_string(hash_fn(hash_val + block_str));
66-
size -= len;
67-
offset += len;
61+
len = std::min(size, block_size);
62+
std::string block_str = get_randomstr(len, false);
63+
if (file->file->pwrite(block_str.c_str(), len, offset) != len)
64+
LOG_ERROR_RETURN(-1, -1, "fail to write to host file `", file->path);
65+
hash_val = std::to_string(hash_fn(hash_val + block_str));
66+
size -= len;
67+
offset += len;
6868
}
6969
node->content = hash_val;
7070
return true;
@@ -82,14 +82,14 @@ class StressInterImpl: public StressGenInter {
8282
LOG_ERROR_RETURN(-1, -1, "fail to stat file");
8383
left = st.st_size;
8484
while (left > 0) {
85-
len = std::min((off_t)block_size, left);
86-
if (len != erofs_file->pread(buf, len, offset))
87-
LOG_ERROR_RETURN(-1, -1, "fail to pread file");
88-
89-
std::string block_str(buf, len);
90-
hash_val = std::to_string(hash_fn(hash_val + block_str));
91-
left -= len;
92-
offset += len;
85+
len = std::min((off_t)block_size, left);
86+
if (len != erofs_file->pread(buf, len, offset))
87+
LOG_ERROR_RETURN(-1, -1, "fail to pread file");
88+
89+
std::string block_str(buf, len);
90+
hash_val = std::to_string(hash_fn(hash_val + block_str));
91+
left -= len;
92+
offset += len;
9393
}
9494
node->content = hash_val;
9595
return true;
@@ -290,12 +290,12 @@ class StressCase003: public StressBase, public StressInterImpl {
290290
}
291291

292292
std::vector<int> layer_dirs(int idx) {
293-
std::vector<int> ret;
293+
std::vector<int> ret;
294294

295-
/* 10 dirs, each dir contains 10 files */
296-
for (int i = 0; i < 10; i ++)
297-
ret.emplace_back(10);
298-
return ret;
295+
/* 10 dirs, each dir contains 10 files */
296+
for (int i = 0; i < 10; i ++)
297+
ret.emplace_back(10);
298+
return ret;
299299
}
300300

301301
};
@@ -327,12 +327,12 @@ class StressCase004: public StressBase, public StressInterImpl {
327327
}
328328

329329
std::vector<int> layer_dirs(int idx) {
330-
std::vector<int> ret;
330+
std::vector<int> ret;
331331

332-
/* 10 dirs, each dir contains 10 files */
333-
for (int i = 0; i < 10; i ++)
334-
ret.emplace_back(10);
335-
return ret;
332+
/* 10 dirs, each dir contains 10 files */
333+
for (int i = 0; i < 10; i ++)
334+
ret.emplace_back(10);
335+
return ret;
336336
}
337337
};
338338

@@ -405,7 +405,7 @@ TEST(ErofsStressTest, TC004) {
405405

406406
TEST(ErofsStressTest, TC005) {
407407
std::srand(static_cast<unsigned int>(std::time(0)));
408-
StressCase005 *tc005 = new StressCase005("./erofs_stress_005", 2);
408+
StressCase005 *tc005 = new StressCase005("./erofs_stress_005", 10);
409409

410410
ASSERT_EQ(tc005->run(), true);
411411
delete tc005;

0 commit comments

Comments
 (0)