-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added failing test to show that we add single quotes around environme…
…nt variable values Signed-off-by: Stefan Marr <[email protected]>
- Loading branch information
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
default_experiment: Test | ||
|
||
benchmark_suites: | ||
Suite: | ||
gauge_adapter: Time | ||
command: TestBenchMarks %(benchmark)s %(warmup)s | ||
benchmarks: | ||
- Bench1 | ||
env: | ||
LUA_PATH: "?.lua;../../awfy/Lua/?.lua" | ||
|
||
executors: | ||
TestRunner1: | ||
path: . | ||
executable: env_quote_vm.py | ||
|
||
experiments: | ||
Test: | ||
suites: | ||
- Suite | ||
executions: | ||
- TestRunner1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright (c) 2009-2025 Stefan Marr <https://www.stefan-marr.de/> | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in | ||
# all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
# THE SOFTWARE. | ||
from ...configurator import Configurator, load_config | ||
from ...executor import Executor | ||
from ...persistence import DataStore | ||
|
||
from ..rebench_test_case import ReBenchTestCase | ||
|
||
|
||
class EnvQuoteTest(ReBenchTestCase): | ||
|
||
def setUp(self): | ||
super(EnvQuoteTest, self).setUp() | ||
self._set_path(__file__) | ||
|
||
def test_execution_should_recognize_invalid_run_and_continue_normally(self): | ||
cnf = Configurator(load_config(self._path + '/env_quote.conf'), | ||
DataStore(self.ui), | ||
self.ui, data_file=self._tmp_file) | ||
runs = list(cnf.get_runs()) | ||
self.assertEqual(runs[0].get_number_of_data_points(), 0) | ||
|
||
ex = Executor([runs[0]], False, self.ui) | ||
ex.execute() | ||
|
||
self.assertEqual(runs[0].get_number_of_data_points(), 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
import sys | ||
|
||
# get the environemnt variable LUA_PATH | ||
lua_path = os.environ.get('LUA_PATH', '') | ||
if lua_path == "?.lua;../../awfy/Lua/?.lua": | ||
print("Correct") | ||
sys.exit(0) | ||
else: | ||
print("Error: LUA_PATH has unexpected value: " + lua_path) | ||
print("Previously we has stray single quotes around the value.") | ||
sys.exit(1) |