4 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #pragma once /* __TESTER_H__ */
22 #include <sensor_internal.h>
26 #include "sensor_manager.h"
28 #define TESTER_ARGC 3 /* e.g. {sensorctl, test, accelerometer} */
30 #define REGISTER_TESTER(name, tester_type) \
31 static tester_type tester(name);
35 tester(const char *name);
38 virtual bool setup(sensor_type_t type, int argc, char *argv[]) { return true; }
39 virtual bool teardown(void) { return true; }
40 virtual bool run(int argc, char *argv[]) = 0;
42 const std::string& name() const { return m_name; }
48 class tester_manager : public sensor_manager {
50 static void register_tester(tester *test);
53 virtual ~tester_manager();
55 bool run(int argc, char *argv[]);
59 static std::vector<tester *> testers;
61 tester *get_tester(const char *type);