fixture.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*************************************************************************
  2. * Copyright (C) [2020] by Cambricon, Inc. All rights reserved
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * The above copyright notice and this permission notice shall be included in
  11. * all copies or substantial portions of the Software.
  12. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  15. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18. * THE SOFTWARE.
  19. *************************************************************************/
  20. #ifndef INFER_SERVER_API_TEST_FIXTURE_H_
  21. #define INFER_SERVER_API_TEST_FIXTURE_H_
  22. #include <memory>
  23. #include "cnis/infer_server.h"
  24. #include "test_base.h"
  25. class InferServerTestAPI : public InferServerTest {
  26. public:
  27. InferServerTestAPI() : server_(new infer_server::InferServer(device_id_)) {}
  28. protected:
  29. void SetUp() override { SetMluContext(); }
  30. void TearDown() override {}
  31. std::unique_ptr<infer_server::InferServer> server_;
  32. };
  33. #ifdef CNIS_WITH_CONTRIB
  34. #include <opencv2/opencv.hpp>
  35. #include "cnis/contrib/video_helper.h"
  36. bool cvt_bgr_to_yuv420sp(const cv::Mat& bgr_image, uint32_t alignment, infer_server::video::PixelFmt pixel_fmt,
  37. uint8_t* yuv_2planes_data);
  38. #endif
  39. #endif // INFER_SERVER_API_TEST_FIXTURE_H_