unbounded-arrays-emission-tester.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. """
  4. Copyright (c) Contributors to the Open 3D Engine Project.
  5. For complete copyright and license terms please see the LICENSE at the root of this distribution.
  6. SPDX-License-Identifier: Apache-2.0 OR MIT
  7. """
  8. import sys
  9. import os
  10. import platform
  11. sys.path.append("..")
  12. from clr import *
  13. import os.path
  14. from os.path import join, normpath, basename
  15. import testhelper
  16. import testfuncs
  17. result = 0 # to define for sub-tests
  18. resultFailed = 0
  19. def doTests(compiler, silent, azdxcpath):
  20. """
  21. This test validates:
  22. 1. unbounded-arrays-unique-idx-should-pass.azsl with --unique-idx used to fail in v1.7.19, should pass now.
  23. 2. unbounded-arrays-unique-idx-should-pass-2srgs.azsl with --unique-idx should pass too, because each unbounded array is in a unique register space.
  24. """
  25. global result
  26. global resultFailed
  27. # Working directory should have been set to this script's directory by the calling parent
  28. # You can get it once doTests() is called, but not during initialization of the module,
  29. # because at that time it will still be set to the working directory of the calling script
  30. workDir = os.getcwd().replace('\\', '/')
  31. # expect success when using --unique-idx
  32. sampleFilePath = os.path.abspath(os.path.join(workDir, "../Semantic/unbounded-arrays-unique-idx-should-pass.azsl"))
  33. if testhelper.verifyEmissionPatterns(sampleFilePath, compiler, silent, ["--unique-idx","--namespace=dx"]) : result += 1
  34. else: resultFailed += 1
  35. # expect success when using --unique-idx
  36. sampleFilePath = os.path.abspath(os.path.join(workDir, "../Semantic/unbounded-arrays-unique-idx-should-pass-2srgs.azsl"))
  37. if testhelper.verifyEmissionPatterns(sampleFilePath, compiler, silent, ["--unique-idx","--namespace=dx"]) : result += 1
  38. else: resultFailed += 1
  39. testhelper.printFailedTestList(silent)
  40. if __name__ == "__main__":
  41. print ("please call from testapp.py")