TDengine/source/libs/planner/test/planTestMain.cpp

57 lines
1.5 KiB
C++
Raw Normal View History

/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2022-02-28 09:56:38 +00:00
#include <string>
2022-02-28 09:56:38 +00:00
#include <gtest/gtest.h>
2022-04-22 01:54:27 +00:00
#include "getopt.h"
2022-02-28 09:56:38 +00:00
#include "mockCatalog.h"
2022-04-19 05:25:19 +00:00
#include "planTestUtil.h"
2022-02-28 09:56:38 +00:00
class PlannerEnv : public testing::Environment {
2022-04-26 03:50:35 +00:00
public:
2022-02-28 09:56:38 +00:00
virtual void SetUp() {
initMetaDataEnv();
generateMetaData();
}
2022-04-26 03:50:35 +00:00
virtual void TearDown() { destroyMetaDataEnv(); }
2022-02-28 09:56:38 +00:00
PlannerEnv() {}
virtual ~PlannerEnv() {}
};
2022-04-19 05:25:19 +00:00
static void parseArg(int argc, char* argv[]) {
2022-04-26 03:50:35 +00:00
int opt = 0;
const char* optstring = "";
2022-05-05 06:49:00 +00:00
static struct option long_options[] = {{"dump", optional_argument, NULL, 'd'}, {0, 0, 0, 0}};
2022-04-19 05:25:19 +00:00
while ((opt = getopt_long(argc, argv, optstring, long_options, NULL)) != -1) {
switch (opt) {
case 'd':
2022-05-05 06:49:00 +00:00
setDumpModule(optarg);
2022-04-19 05:25:19 +00:00
break;
default:
break;
}
}
}
2022-02-28 09:56:38 +00:00
int main(int argc, char* argv[]) {
2022-04-26 03:50:35 +00:00
testing::AddGlobalTestEnvironment(new PlannerEnv());
testing::InitGoogleTest(&argc, argv);
2022-04-19 05:25:19 +00:00
parseArg(argc, argv);
2022-04-26 03:50:35 +00:00
return RUN_ALL_TESTS();
2022-02-28 09:56:38 +00:00
}