From 0c8e145e64abb083ca3320b0ae7763d146ce8384 Mon Sep 17 00:00:00 2001 From: chenqy930 Date: Tue, 21 Mar 2023 15:16:27 +0800 Subject: [PATCH] Fix base64 test failed in different environment Issue:I6OVGY Signed-off-by: chenqy930 Change-Id: I0ae0fe4a74f630c301bad2dd9f602f8b57551cdc --- es2panda/aot/main.cpp | 4 ++-- es2panda/compiler/core/compileQueue.cpp | 2 -- es2panda/test/base64/inputFile/expected.txt | 2 +- es2panda/test/runner.py | 7 ++++++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/es2panda/aot/main.cpp b/es2panda/aot/main.cpp index 9c57e484d7..ecb6860511 100644 --- a/es2panda/aot/main.cpp +++ b/es2panda/aot/main.cpp @@ -122,6 +122,8 @@ static void DumpProgramInfos(const std::map &programsInfo, const std::unique_ptr &options) { + DumpProgramInfos(programsInfo, options); + if (programsInfo.size() == 1) { auto *prog = &(programsInfo.begin()->second->program); if (options->OutputFiles().empty() && options->CompilerOutput().empty()) { @@ -147,8 +149,6 @@ static bool GenerateProgram(const std::mapsource = buffer; - } - if (!src_->fileName.empty()) { auto cacheFileIter = options_->cacheFiles.find(src_->fileName); if (cacheFileIter != options_->cacheFiles.end()) { src_->hash = GetHash32String(reinterpret_cast(buffer.c_str())); diff --git a/es2panda/test/base64/inputFile/expected.txt b/es2panda/test/base64/inputFile/expected.txt index dac0202f24..486c8cb8c6 100644 --- a/es2panda/test/base64/inputFile/expected.txt +++ b/es2panda/test/base64/inputFile/expected.txt @@ -11,4 +11,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -UEFOREEAAAAAAAAACQAAAPwBAACMAAAAFQAAAAQAAAA8AAAAAQAAAPgBAAAAAAAATAAAAAEAAABMAAAAuwAAAIwAAADhAAAADQEAAIwAAAD8AQAAAgAAAHQAAAADAAAAfAAAAAAAAACIAAAAAQAAAIgAAAC7AAAADQEAAKEAAACvAAAAtgAAAD4BAAAnTF9FU1R5cGVBbm5vdGF0aW9uOwAZaGVsbG8gd29ybGQhAAtwcmludAAHc3RyADNMX0VTU2xvdE51bWJlckFubm90YXRpb247AAAAAACAQAAAAgAAJ0xfRVNUeXBlSW5mb1JlY29yZDsAAAAAAAEAAAIAABdmdW5jX21haW5fMAATTF9HTE9CQUw7AAAAAAABAAECAAABAAAAAAEAAIgCAb8BAAACAAXrAQAABrIBAAAA7u4AAMMBL21udC9jaGVucWl1eWFvL2NvZGUvb3Blbmhhcm1vbnkvYXJrY29tcGlsZXIvZXRzX2Zyb250ZW5kL2VzMnBhbmRhL3Rlc3QvYmFzZTY0L2lucHV0RmlsZS9pbnB1dC5qcwAVU2xvdE51bWJlcgAAAAEApgEAAAUAAAA3BwMhAERwRIFEkj4AAEgAAAIAPwEBAGEFPwICAGEGYAUqAwYAZQkLAQIQiQD/////DwAFwgIABhAA5AEAAA== +UEFOREEAAAAAAAAACQAAAKQBAACMAAAAFQAAAAQAAAA8AAAAAQAAAKABAAAAAAAATAAAAAEAAABMAAAAuwAAAIwAAADhAAAADQEAAIwAAACkAQAAAgAAAHQAAAADAAAAfAAAAAAAAACIAAAAAQAAAIgAAAC7AAAADQEAAKEAAACvAAAAtgAAAD4BAAAnTF9FU1R5cGVBbm5vdGF0aW9uOwAZaGVsbG8gd29ybGQhAAtwcmludAAHc3RyADNMX0VTU2xvdE51bWJlckFubm90YXRpb247AAAAAACAQAAAAgAAJ0xfRVNUeXBlSW5mb1JlY29yZDsAAAAAAAEAAAIAABdmdW5jX21haW5fMAATTF9HTE9CQUw7AAAAAAABAAECAAABAAAAAAEAAIgCAWUBAAACAAWRAQAABlgBAAAA7u4AABFpbnB1dC5qcwAVU2xvdE51bWJlcgAAAAEATAEAAAUAAAA3BwMhAERwRIFEkj4AAEgAAAIAPwEBAGEFPwICAGEGYAUqAwYAZQkLAQIQiQD/////DwAFwgIABhAAAACKAQAA diff --git a/es2panda/test/runner.py b/es2panda/test/runner.py index 33de0a2c4d..a74bdb40db 100755 --- a/es2panda/test/runner.py +++ b/es2panda/test/runner.py @@ -1094,7 +1094,9 @@ class Base64Test(Test): def run(self, runner): cmd = runner.cmd_prefix + [runner.es2panda, "--base64Output"] if self.input_type == "file": - cmd.extend([os.path.join(self.path, "input.js")]) + input_file_name = 'input.js' + cmd.extend(['--source-file', input_file_name]) + cmd.extend([os.path.join(self.path, input_file_name)]) elif self.input_type == "string": input_file = os.path.join(self.path, "input.txt") try: @@ -1145,6 +1147,9 @@ class Base64Runner(Runner): self.tests.append(Base64Test(os.path.join(self.test_directory, "inputFile"), "file")) self.tests.append(Base64Test(os.path.join(self.test_directory, "inputString"), "string")) + def test_path(self, src): + return os.path.basename(src) + def main(): args = get_args() -- Gitee