mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 08:14:00 +08:00
test_updated: test permissions are preserved (#31881)
* test perserved * space old-commit-hash: 07ec5e5fdb322977c6c7c24286e537b76e5f9203
This commit is contained in:
@@ -2,6 +2,7 @@ import os
|
||||
import pathlib
|
||||
import shutil
|
||||
import signal
|
||||
import stat
|
||||
import subprocess
|
||||
import tempfile
|
||||
import time
|
||||
@@ -29,9 +30,13 @@ def update_release(directory, name, version, agnos_version, release_notes):
|
||||
with open(directory / "common" / "version.h", "w") as f:
|
||||
f.write(f'#define COMMA_VERSION "{version}"')
|
||||
|
||||
with open(directory / "launch_env.sh", "w") as f:
|
||||
launch_env = directory / "launch_env.sh"
|
||||
with open(launch_env, "w") as f:
|
||||
f.write(f'export AGNOS_VERSION="{agnos_version}"')
|
||||
|
||||
st = os.stat(launch_env)
|
||||
os.chmod(launch_env, st.st_mode | stat.S_IEXEC)
|
||||
|
||||
test_symlink = directory / "test_symlink"
|
||||
if not os.path.exists(str(test_symlink)):
|
||||
os.symlink("common/version.h", test_symlink)
|
||||
@@ -123,6 +128,7 @@ class BaseUpdateTest(unittest.TestCase):
|
||||
self.assertEqual(self.params.get("UpdaterNewReleaseNotes", encoding="utf-8"), f"<p>{release_notes}</p>\n")
|
||||
self.assertEqual(get_version(str(self.staging_root / "finalized")), version)
|
||||
self.assertEqual(get_consistent_flag(str(self.staging_root / "finalized")), True)
|
||||
self.assertTrue(os.access(str(self.staging_root / "finalized" / "launch_env.sh"), os.X_OK))
|
||||
|
||||
with open(self.staging_root / "finalized" / "test_symlink") as f:
|
||||
self.assertIn(version, f.read())
|
||||
|
||||
Reference in New Issue
Block a user