Skip to content

Commit

Permalink
Self-review
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Sep 20, 2023
1 parent 3a0696e commit b365344
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 122 deletions.
6 changes: 3 additions & 3 deletions testsuite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ $ ./run.py
# Creating tests
All tests are based on running a Python script. There are three test drivers:

- `python-script`: run in host in sandboxed build mode
- `shared-build`: run in host in shared build mode
- `docker-wrapper`: run in a pristine docker Ubuntu image in shared build mode
- `python-script`: run in host in both sandboxed and shared build mode.
- The build mode can be narrowed down with the `build_mode` attribute.
- `docker-wrapper`: run in a pristine docker Ubuntu image in shared build mode.
10 changes: 10 additions & 0 deletions testsuite/drivers/driver/python_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ def restore_working_dir(self):
# Restore the working directory to its initial state, by deleting
# everything and copying originals back from .orig dir

def make_writable(path):
# Make everything inside a directory writable recursively
for root, dirs, files in os.walk(path):
for d in dirs:
os.chmod(os.path.join(root, d), 0o777)
for f in files:
os.chmod(os.path.join(root, f), 0o666)

base = self.test_env['working_dir']
orig_name = ".orig"

Expand All @@ -105,6 +113,8 @@ def restore_working_dir(self):
if os.path.isfile(path):
os.remove(path)
else:
# Git marks some files read-only, so make them writable
make_writable(path)
shutil.rmtree(path)

# Restore the original files
Expand Down
22 changes: 0 additions & 22 deletions testsuite/drivers/driver/shared_build.py

This file was deleted.

4 changes: 1 addition & 3 deletions testsuite/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@
import e3.testsuite.driver
from drivers.driver.docker_wrapper import DockerWrapperDriver
from drivers.driver.python_script import PythonScriptDriver
from drivers.driver.shared_build import SharedBuildDriver
from drivers.helpers import on_windows


class Testsuite(e3.testsuite.Testsuite):
tests_subdir = 'tests'
test_driver_map = {
'python-script': PythonScriptDriver,
'docker-wrapper': DockerWrapperDriver,
'shared-build': SharedBuildDriver
'docker-wrapper': DockerWrapperDriver
}

def add_options(self, parser):
Expand Down
3 changes: 2 additions & 1 deletion testsuite/tests/build/hashes/compiler-input/test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
driver: shared-build
driver: python-script
build_mode: shared
indexes:
toolchain_index:
in_fixtures: true
3 changes: 2 additions & 1 deletion testsuite/tests/build/hashes/compiler-missing/test.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
driver: shared-build
driver: python-script
build_mode: shared
indexes:
basic_no_compiler_index: {}
3 changes: 2 additions & 1 deletion testsuite/tests/build/hashes/config-types/test.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
driver: shared-build
driver: python-script
build_mode: shared
indexes:
build_hash_index: {}
3 changes: 2 additions & 1 deletion testsuite/tests/build/hashes/hashing-inputs/test.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
driver: shared-build
driver: python-script
build_mode: shared
indexes:
build_hash_index: {}
3 changes: 2 additions & 1 deletion testsuite/tests/build/hashes/incomplete-config/test.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
driver: shared-build
driver: python-script
build_mode: shared
indexes:
build_hash_index: {}
3 changes: 2 additions & 1 deletion testsuite/tests/config/shared-deps/test.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
driver: shared-build
driver: python-script
build_mode: shared
indexes:
build_hash_index: {}
78 changes: 0 additions & 78 deletions testsuite/tests/solver/compiler-installed-shared-build/test.py

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions testsuite/tests/solver/compiler-installed/test.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
driver: python-script
build_mode: sandboxed
# This test can't be run twice as it alters the environment in ways too complex
# to restore to the initial status. Instead we use a separate copy of the test.
indexes:
toolchain_index:
in_fixtures: true

0 comments on commit b365344

Please sign in to comment.