diff options
| author | Yong He <yonghe@outlook.com> | 2023-09-01 01:25:31 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-01 01:25:31 -0700 |
| commit | 9c11a87f8f811a9a110d73a24ab93443ea347506 (patch) | |
| tree | 9b1b0f154cff0faf7efd8d77fcd7f7911aea4a44 /tools/slang-unit-test | |
| parent | b7d19330c2d42937835d674758a05af3891e025b (diff) | |
Fix GLSL code gen around RayQuery and HitObject types. (#3173)
* Update slang-llvm.
* Fix.
* fix.
* Fix unit tests for multi-thread execution.
* Fix tests.
* fixes.
* update tests.
* Add gfx-smoke to linux expected failure list.
* Try fix test.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools/slang-unit-test')
| -rw-r--r-- | tools/slang-unit-test/unit-test-lock-file.cpp | 3 | ||||
| -rw-r--r-- | tools/slang-unit-test/unit-test-persistent-cache.cpp | 3 | ||||
| -rw-r--r-- | tools/slang-unit-test/unit-test-translation-unit-import.cpp | 14 |
3 files changed, 11 insertions, 9 deletions
diff --git a/tools/slang-unit-test/unit-test-lock-file.cpp b/tools/slang-unit-test/unit-test-lock-file.cpp index be767a5ee..4915770fe 100644 --- a/tools/slang-unit-test/unit-test-lock-file.cpp +++ b/tools/slang-unit-test/unit-test-lock-file.cpp @@ -2,6 +2,7 @@ #include "tools/unit-test/slang-unit-test.h" #include "../../source/core/slang-io.h" +#include "../../source/core/slang-process.h" #include <atomic> #include <future> @@ -10,7 +11,7 @@ using namespace Slang; -static const String fileName = Path::simplify(Path::getParentDirectory(Path::getExecutablePath()) + "/test_lock_file"); +static const String fileName = Path::simplify(Path::getParentDirectory(Path::getExecutablePath()) + "/test_lock_file" + String(Process::getId())); SLANG_UNIT_TEST(lockFileOpenClose) { diff --git a/tools/slang-unit-test/unit-test-persistent-cache.cpp b/tools/slang-unit-test/unit-test-persistent-cache.cpp index d2d8aeb25..cb7ebcab2 100644 --- a/tools/slang-unit-test/unit-test-persistent-cache.cpp +++ b/tools/slang-unit-test/unit-test-persistent-cache.cpp @@ -5,6 +5,7 @@ #include "../../source/core/slang-io.h" #include "../../source/core/slang-file-system.h" #include "../../source/core/slang-random-generator.h" +#include "../../source/core/slang-process.h" #include <chrono> #include <thread> @@ -86,7 +87,7 @@ struct PersistentCacheTest PersistentCacheTest(Count maxEntryCount = 0) { osFileSystem = OSFileSystem::getMutableSingleton(); - cacheDirectory = Path::simplify(Path::getParentDirectory(Path::getExecutablePath()) + "/persistent-cache-test"); + cacheDirectory = Path::simplify(Path::getParentDirectory(Path::getExecutablePath()) + "/persistent-cache-test" + String(Process::getId())); removeCacheFiles(); diff --git a/tools/slang-unit-test/unit-test-translation-unit-import.cpp b/tools/slang-unit-test/unit-test-translation-unit-import.cpp index 9e79831e5..3a0a98e17 100644 --- a/tools/slang-unit-test/unit-test-translation-unit-import.cpp +++ b/tools/slang-unit-test/unit-test-translation-unit-import.cpp @@ -8,6 +8,7 @@ #include "tools/unit-test/slang-unit-test.h" #include "../../slang-com-ptr.h" #include "../../source/core/slang-io.h" +#include "../../source/core/slang-process.h" using namespace Slang; @@ -31,8 +32,7 @@ SLANG_UNIT_TEST(translationUnitImport) )"; // Source for a module that transitively uses the generated source via a file. - const char* userSource = R"( - import moduleG; + const char* userSourceBody = R"( [shader("compute")] [numthreads(4,1,1)] void computeMain( @@ -42,11 +42,12 @@ SLANG_UNIT_TEST(translationUnitImport) buffer[sv_dispatchThreadID.x] = g(); })"; - + auto moduleName = "moduleG" + String(Process::getId()); + String userSource = "import " + moduleName + ";\n" + userSourceBody; auto session = spCreateSession(); auto request = spCreateCompileRequest(session); - File::writeAllText("moduleG.slang", fileSource); + File::writeAllText(moduleName + ".slang", fileSource); spAddCodeGenTarget(request, SLANG_HLSL); int generatedTranslationUnitIndex = spAddTranslationUnit(request, SLANG_SOURCE_LANGUAGE_SLANG, "generatedUnit"); @@ -55,7 +56,7 @@ SLANG_UNIT_TEST(translationUnitImport) int entryPointTranslationUnitIndex = spAddTranslationUnit(request, SLANG_SOURCE_LANGUAGE_SLANG, "userUnit"); spAddTranslationUnitSourceString( - request, entryPointTranslationUnitIndex, "userFile", userSource); + request, entryPointTranslationUnitIndex, "userFile", userSource.getUnownedSlice().begin()); spAddEntryPoint(request, entryPointTranslationUnitIndex, "computeMain", SLANG_STAGE_COMPUTE); auto compileResult = spCompile(request); @@ -67,7 +68,6 @@ SLANG_UNIT_TEST(translationUnitImport) spDestroyCompileRequest(request); spDestroySession(session); - - File::remove("moduleG.slang"); + File::remove(moduleName + ".slang"); } |
