-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from cwruRobotics/install-on-boot-refactor-and…
…-test Install on boot refactor and unit test
- Loading branch information
Showing
4 changed files
with
47 additions
and
13 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
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
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
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,25 @@ | ||
import os | ||
|
||
from pi_main.install_on_boot import main | ||
|
||
ROS_DISTRO = os.getenv("ROS_DISTRO") | ||
|
||
EXPECTED_SYSTEM_FILES = [f"/etc/ros/{ROS_DISTRO}/cwrubotix_pi.d/.installed_files", | ||
f"/etc/ros/{ROS_DISTRO}/cwrubotix_pi.d/pi.launch.py", | ||
"/usr/sbin/cwrubotix_pi-start", | ||
"/usr/sbin/cwrubotix_pi-stop"] | ||
|
||
|
||
def test_install_on_boot() -> None: | ||
"""Test that file copying and systemd are made.""" | ||
main() | ||
|
||
# Test for rules files being copied correctly | ||
# Could be split into a separate test but main() does both | ||
actual_rules_files = set(os.listdir(os.path.join("/etc", "udev", "rules.d"))) | ||
expected_rules_files = set(["i2c.rules", "camera.rules", "pixhawk.rules"]) | ||
assert expected_rules_files.issubset(actual_rules_files) | ||
|
||
# Checks for files created by robot_upstart | ||
for file in EXPECTED_SYSTEM_FILES: | ||
assert os.path.isfile(file) |