Commit 3e706bd9 authored by gejun's avatar gejun

remove warnings in UT

parent 25693a82
......@@ -564,7 +564,7 @@ static uint16_t MakeEntry(unsigned int extra,
return len | (copy_offset << 8) | (extra << 11);
}
static void ComputeTable() {
static void ALLOW_UNUSED ComputeTable() {
uint16_t dst[256];
// Place invalid entries in all places to detect missing initialization
......
......@@ -14,8 +14,7 @@ protected:
};
//! gejun: check basic functions of butil::FileWatcher
TEST_F(FileWatcherTest, random_op)
{
TEST_F(FileWatcherTest, random_op) {
srand (time(0));
butil::FileWatcher fw;
......@@ -42,11 +41,11 @@ TEST_F(FileWatcherTest, random_op)
switch (rand() % 2) {
case 0:
system ("touch dummy_file");
ASSERT_EQ(0, system("touch dummy_file"));
LOG(INFO) << "action: touch dummy_file";
break;
case 1:
system ("rm -f dummy_file");
ASSERT_EQ(0, system("rm -f dummy_file"));
LOG(INFO) << "action: rm -f dummy_file";
break;
case 2:
......@@ -56,6 +55,7 @@ TEST_F(FileWatcherTest, random_op)
usleep (10000);
}
system ("rm -f dummy_file");
ASSERT_EQ(0, system("rm -f dummy_file"));
}
}
} // namespace
......@@ -77,7 +77,7 @@ void show_prof_and_rm(const char* bin_name, const char* filename, size_t topn) {
} else {
snprintf(cmd, sizeof(cmd), "if [ -e %s ] ; then CPUPROFILE_FREQUENCY=1000 ./pprof --text %s %s; rm -f %s; fi", filename, bin_name, filename, filename);
}
system(cmd);
ASSERT_EQ(0, system(cmd));
}
static void check_memory_leak() {
......
......@@ -127,7 +127,7 @@ TEST_F(TempFileTest, save_binary_twice)
ASSERT_NE((void*)0, fp);
test_t act_data;
bzero(&act_data, sizeof(act_data));
fread(&act_data, sizeof(act_data), 1, fp);
ASSERT_EQ(1, fread(&act_data, sizeof(act_data), 1, fp));
fclose(fp);
ASSERT_EQ(0, memcmp(&data, &act_data, sizeof(data)));
......@@ -139,7 +139,7 @@ TEST_F(TempFileTest, save_binary_twice)
fp = fopen(tmp.fname(), "r");
ASSERT_NE((void*)0, fp);
bzero(&act_data, sizeof(act_data));
fread(&act_data, sizeof(act_data), 1, fp);
ASSERT_EQ(1, fread(&act_data, sizeof(act_data), 1, fp));
fclose(fp);
ASSERT_EQ(0, memcmp(&data2, &act_data, sizeof(data2)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment