Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lihuiba committed Jun 1, 2024
1 parent 436bbaf commit e75f23b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 54 deletions.
4 changes: 2 additions & 2 deletions common/executor/test/test_async.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ limitations under the License.
#include <photon/fs/filesystem.h>
#include <photon/fs/localfs.h>
#include <photon/thread/thread.h>
#include <pthread.h>
#include <sched.h>
// #include <pthread.h>
// #include <sched.h>
#include "../../../test/ci-tools.h"
// #include <immintrin.h>

Expand Down
2 changes: 0 additions & 2 deletions common/executor/test/test_export_as_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include <photon/common/alog.h>
#include <photon/photon.h>
#include <photon/thread/thread.h>
#include "../../../test/ci-tools.h"

#include <thread>

TEST(enter_as_executor, test) {
Expand Down
1 change: 1 addition & 0 deletions fs/exportfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ namespace fs
ExportBase::ref = 1;
if (thread_pool_capacity != 0) ExportBase::pool = new_thread_pool(thread_pool_capacity);
evloop->async_run();
LOG_INFO(" OK");
return 0;
}
int exportfs_fini()
Expand Down
57 changes: 7 additions & 50 deletions fs/test/test_exportfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,13 @@ using namespace photon;
using namespace photon::fs;
using namespace testing;

// #ifdef __linux__
// static const int event_engine = photon::INIT_EVENT_EPOLL;
// #else
// static const int event_engine = photon::INIT_EVENT_KQUEUE;
// #endif

inline void photon_init() {
init(INIT_EVENT_DEFAULT, INIT_IO_EXPORTFS);
init(INIT_EVENT_DEFAULT, INIT_IO_NONE);
exportfs_init();
}

inline void photon_fini() {
exportfs_fini();
fini();
}

Expand Down Expand Up @@ -108,14 +104,6 @@ int callbackvoid(void*, AsyncResult<void>* ret) {
}

TEST(ExportFS, basic) {
// photon::vcpu_init();
// photon::fd_events_init(event_engine);
// exportfs_init();
// DEFER({
// exportfs_fini();
// photon::fd_events_fini();
// photon::vcpu_fini();
// });
PMock::MockNullFile* mockfile = new PMock::MockNullFile();
PMock::MockNullFileSystem* mockfs = new PMock::MockNullFileSystem();
PMock::MockNullDIR* mockdir = new PMock::MockNullDIR();
Expand Down Expand Up @@ -266,10 +254,6 @@ TEST(ExportFS, init_fini_failed_situation) {
DEFER({
log_output = _o_output;
});
// photon::vcpu_init();
// photon::fd_events_init(event_engine);
// ret = exportfs_init();
// EXPECT_EQ(0, ret);

auto ret = exportfs_init();
EXPECT_EQ(-1, ret);
Expand All @@ -283,8 +267,6 @@ TEST(ExportFS, init_fini_failed_situation) {

ret = exportfs_init();
EXPECT_EQ(0, ret);
// photon::fd_events_fini();
// photon::vcpu_fini();
}

TEST(ExportFS, op_failed_situation) {
Expand All @@ -293,14 +275,6 @@ TEST(ExportFS, op_failed_situation) {
DEFER({
log_output = _o_output;
});
// photon::vcpu_init();
// photon::fd_events_init(event_engine);
// exportfs_init();
// DEFER({
// exportfs_fini();
// photon::fd_events_fini();
// // photon::vcpu_fini();
// });
PMock::MockNullFile* mockfile = new PMock::MockNullFile;
errno = 0;
EXPECT_CALL(*mockfile, read(_, _))
Expand All @@ -322,14 +296,6 @@ TEST(ExportFS, op_failed_situation) {
}

TEST(ExportFS, xattr) {
// photon::vcpu_init();
// photon::fd_events_init(event_engine);
// exportfs_init();
// DEFER({
// exportfs_fini();
// photon::fd_events_fini();
// photon::vcpu_fini();
// });
PMock::MockNullFile* mockfile = new PMock::MockNullFile();
PMock::MockNullFileSystem* mockfs = new PMock::MockNullFileSystem();
auto file = dynamic_cast<IAsyncFileXAttr*>(export_as_async_file(mockfile));
Expand Down Expand Up @@ -392,14 +358,6 @@ TEST(ExportFS, xattr_sync) {
std::thread th([&]{
photon_init();
DEFER(photon_fini());
// photon::vcpu_init();
// photon::fd_events_init(event_engine);
// exportfs_init();
// DEFER({
// exportfs_fini();
// photon::fd_events_fini();
// photon::vcpu_fini();
// });
file = dynamic_cast<IFileXAttr*>(export_as_sync_file(mockfile));
fs = dynamic_cast<IFileSystemXAttr*>(export_as_sync_fs(mockfs));
sem.wait(1);
Expand Down Expand Up @@ -448,9 +406,8 @@ int main(int argc, char **argv)
{
photon_init();
DEFER(photon_fini());
return 0;
// ::testing::InitGoogleTest(&argc, argv);
// int ret = RUN_ALL_TESTS();
// LOG_ERROR_RETURN(0, ret, VALUE(ret));
// return ret;
::testing::InitGoogleTest(&argc, argv);
int ret = RUN_ALL_TESTS();
LOG_ERROR_RETURN(0, ret, VALUE(ret));
return ret;
}

0 comments on commit e75f23b

Please sign in to comment.