TLPAggregationTestFixture.cpp 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Copyright (c) 2017 The Linux Foundation. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are
  6. * met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above
  10. * copyright notice, this list of conditions and the following
  11. * disclaimer in the documentation and/or other materials provided
  12. * with the distribution.
  13. * * Neither the name of The Linux Foundation nor the names of its
  14. * contributors may be used to endorse or promote products derived
  15. * from this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
  18. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  19. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
  20. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  21. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  22. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  23. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  24. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  25. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  26. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  27. * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. */
  29. #include "TLPAggregationTestFixture.h"
  30. /////////////////////////////////////////////////////////////////////////////////
  31. //define the static Pipes which will be used by all derived tests.
  32. Pipe TLPAggregationTestFixture::m_IpaToUsbPipeNoAgg(IPA_CLIENT_TEST3_CONS,
  33. IPA_TEST_CONFIGURATION_8);
  34. Pipe TLPAggregationTestFixture::m_IpaToUsbPipeAggr(IPA_CLIENT_TEST_CONS,
  35. IPA_TEST_CONFIGURATION_8);
  36. Pipe TLPAggregationTestFixture::m_UsbNoAggToIpaPipeAgg(IPA_CLIENT_TEST3_PROD,
  37. IPA_TEST_CONFIGURATION_8);
  38. Pipe TLPAggregationTestFixture::m_UsbDeaggToIpaPipeNoAgg(IPA_CLIENT_TEST_PROD,
  39. IPA_TEST_CONFIGURATION_8);
  40. Pipe TLPAggregationTestFixture::m_UsbDeaggToIpaPipeAgg(IPA_CLIENT_TEST2_PROD,
  41. IPA_TEST_CONFIGURATION_8);
  42. Pipe TLPAggregationTestFixture::m_IpaToUsbPipeAggTime(IPA_CLIENT_TEST2_CONS,
  43. IPA_TEST_CONFIGURATION_8);
  44. Pipe TLPAggregationTestFixture::m_UsbNoAggToIpaPipeAggTime(IPA_CLIENT_TEST4_PROD,
  45. IPA_TEST_CONFIGURATION_8);
  46. /////////////////////////////////////////////////////////////////////////////////
  47. TLPAggregationTestFixture::TLPAggregationTestFixture()
  48. {
  49. m_testSuiteName.push_back("TLPAgg");
  50. m_maxIPAHwType = IPA_HW_v2_6L;
  51. Register(*this);
  52. }
  53. /////////////////////////////////////////////////////////////////////////////////
  54. bool TLPAggregationTestFixture::Setup()
  55. {
  56. bool bRetVal = true;
  57. //Set the configuration to support USB->IPA and IPA->USB pipes.
  58. ConfigureScenario(8);
  59. //Initialize the pipe for all the tests - this will open the inode which represents the pipe.
  60. bRetVal &= m_IpaToUsbPipeNoAgg.Init();
  61. bRetVal &= m_IpaToUsbPipeAggr.Init();
  62. bRetVal &= m_UsbNoAggToIpaPipeAgg.Init();
  63. bRetVal &= m_UsbDeaggToIpaPipeNoAgg.Init();
  64. bRetVal &= m_UsbDeaggToIpaPipeAgg.Init();
  65. bRetVal &= m_IpaToUsbPipeAggTime.Init();
  66. bRetVal &= m_UsbNoAggToIpaPipeAggTime.Init();
  67. return bRetVal;
  68. }
  69. /////////////////////////////////////////////////////////////////////////////////
  70. bool TLPAggregationTestFixture::Teardown()
  71. {
  72. //The Destroy method will close the inode.
  73. m_IpaToUsbPipeNoAgg.Destroy();
  74. m_IpaToUsbPipeAggr.Destroy();
  75. m_UsbNoAggToIpaPipeAgg.Destroy();
  76. m_UsbDeaggToIpaPipeNoAgg.Destroy();
  77. m_UsbDeaggToIpaPipeAgg.Destroy();
  78. m_IpaToUsbPipeAggTime.Destroy();
  79. m_UsbNoAggToIpaPipeAggTime.Destroy();
  80. return true;
  81. }
  82. /////////////////////////////////////////////////////////////////////////////////