2
0

main.cpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright 2010-2015 Branimir Karadzic. All rights reserved.
  3. * License: http://www.opensource.org/licenses/BSD-2-Clause
  4. */
  5. /*
  6. * Copyright 2012 Matthew Endsley
  7. * All rights reserved
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted providing that the following conditions
  11. * are met:
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. * 2. Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in the
  16. * documentation and/or other materials provided with the distribution.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  19. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  20. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  22. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  24. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  25. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  26. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  27. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  28. * POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. #include "test.h"
  31. int runAllTests()
  32. {
  33. DBG(BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME);
  34. return UnitTest::RunAllTests();
  35. }
  36. #if BX_PLATFORM_ANDROID
  37. # include <android/native_activity.h>
  38. void ANativeActivity_onCreate(ANativeActivity*, void*, size_t)
  39. {
  40. exit(runAllTests() );
  41. }
  42. #elif BX_PLATFORM_NACL
  43. # include <ppapi/c/pp_errors.h>
  44. # include <ppapi/c/ppp.h>
  45. PP_EXPORT const void* PPP_GetInterface(const char* /*_name*/)
  46. {
  47. return NULL;
  48. }
  49. PP_EXPORT int32_t PPP_InitializeModule(PP_Module /*_module*/, PPB_GetInterface /*_interface*/)
  50. {
  51. DBG("PPAPI version: %d", PPAPI_RELEASE);
  52. runAllTests();
  53. return PP_ERROR_NOINTERFACE;
  54. }
  55. PP_EXPORT void PPP_ShutdownModule()
  56. {
  57. }
  58. #else
  59. int main()
  60. {
  61. return runAllTests();
  62. }
  63. #endif // BX_PLATFORM