Skip to content

Commit

Permalink
fix chsut.sh and src/forge_cfg.py -T
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-pavel committed Apr 11, 2022
1 parent aed5b80 commit 1e8f1a4
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.py[co]
init_all.py
*.pyc
*.pyo
/init_all.py

# Packages
*.egg
Expand Down
8 changes: 4 additions & 4 deletions chsut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#Author: Maciek Fijalkowski

path=$(pwd)
script_path=$(cd "$(dirname "${0}")" && pwd)

if [ "$1" == --help -o "$1" == -h ]; then
printf "This is a help message. This script can change SOFTWARE_UNDER_TEST
Expand All @@ -15,10 +15,10 @@ Usage: ./chsut
./chsut -h
-------- prints this message.\n\n"
elif [ $# -eq 0 ]; then
grep "^SOFTWARE_UNDER_TEST*" $path/features/init_all.py
grep "^SOFTWARE_UNDER_TEST*" "${script_path}/init_all.py"
else
printf "Changing SOFTWARE_UNDER_TEST variable to %s...\n" $1
sed -i "s/^SOFTWARE_UNDER_TEST\ =\ \".*\",/SOFTWARE_UNDER_TEST\ =\ \"$1\",/" \
$path/features/init_all.py
sed -i "s/^SOFTWARE_UNDER_TEST = .*,/SOFTWARE_UNDER_TEST = ('${1}'),/" \
"${script_path}/init_all.py"
printf "Done.\n"
fi
4 changes: 2 additions & 2 deletions doc/coding-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ Writing new tests
-----------------

Since forge moved from lettuce to pytest, writing new tests is just python programming.
Functions available in `tests/srv_control.py` are used to operate remote DHCP/DNS servers.
Functions available in `tests/srv_msg.py` are used to generate and parse traffic. Don't forget
Functions available in `src/srv_control.py` are used to operate remote DHCP/DNS servers.
Functions available in `src/srv_msg.py` are used to generate and parse traffic. Don't forget
to write test description for new tests.

Additional info
Expand Down
6 changes: 2 additions & 4 deletions doc/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ Now you need to apply new configuration.
sudo netplan apply
```


### 4. Clone Forge from Git Repository
You can use git clone to download Forge from repository.

Expand Down Expand Up @@ -234,13 +233,12 @@ source ./venv/bin/activate
You need to copy default config file as a working one:

```shell
+cp tests/init_all.py_default tests/init_all.py
+cp ./init_all.py_default ./init_all.py
```


And now edit this file:
```shell
nano tests/init_all.py
nano ./init_all.py
```

Parameters that need to be set or uncommented, some of them will be empty:
Expand Down
2 changes: 1 addition & 1 deletion init_all.py_default
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ SERVER2_IFACE = ''

# If you want to build tests history in history.html set HISTORY to True if not,
# to False but for more detailed information about tests, use --with_xunit option
# when starting forge_cfg.py
# when starting src/forge_cfg.py
# HISTORY = True

# Save log file in tests result folder
Expand Down
10 changes: 6 additions & 4 deletions src/forge_cfg.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

# Copyright (C) 2013-2022 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
Expand Down Expand Up @@ -166,12 +168,12 @@ def gethwaddr(self, ifname):

def basic_validation(self):
if self.software_install_path == "":
print ("Configuration failure, software_install_path empty. "
"Please use ./forge_cfg.py -T to validate configuration.")
print ("Configuration failure, software_install_path is empty. "
"Please use ./src/forge_cfg.py -T to validate configuration.")
sys.exit(-1)
if self.mgmt_address == "":
print("Configuration failure, mgmt_address empty." \
" Please use ./forge_cfg.py -T to validate configuration.")
print("Configuration failure, mgmt_address is empty. "
"Please use ./src/forge_cfg.py -T to validate configuration.")
sys.exit(-1)

def set_env_val(self, env_name, env_val):
Expand Down
1 change: 1 addition & 0 deletions src/init_all.py

0 comments on commit 1e8f1a4

Please sign in to comment.