diff options
| author | PMR <pmr@pmr-lander> | 2018-02-23 08:48:15 +0000 |
|---|---|---|
| committer | PMR <pmr@pmr-lander> | 2018-02-23 08:48:15 +0000 |
| commit | a276274548da2c4949f167b1a9257e30884fb06a (patch) | |
| tree | d5b149f389d80fbc3fdcdc6e55d14a5f7ecf958c /bin | |
| parent | e7bfd5fad6af67d7c4f80147126324d73775acad (diff) | |
| parent | 04df0fcc7e932f2f3421e1ff00f761e81f2cd697 (diff) | |
Merge #338546 from ~sylvain-pineau/plainbox-provider-checkbox:classic-friendly-2
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/pm_test | 10 | ||||
| -rwxr-xr-x | bin/removable_storage_test | 16 |
2 files changed, 22 insertions, 4 deletions
diff --git a/bin/pm_test b/bin/pm_test index 35cd215e..481b5666 100755 --- a/bin/pm_test +++ b/bin/pm_test @@ -637,7 +637,7 @@ class AutoStartFile(object): [Desktop Entry] Name={pm_operation} test Comment=Verify {pm_operation} works properly -Exec=sudo /usr/bin/python3 {script} -r {repetitions} -w {wakeup} --hardware-delay {hardware_delay} --pm-delay {pm_delay} --min-pm-time {min_pm_time} --max-pm-time {max_pm_time} --append --total {total} --start {start} --pm-timestamp {pm_timestamp} {silent} --log-level={log_level} --log-dir={log_dir} --suspends-before-reboot={suspend_cycles} --checkbox-respawn-cmd={checkbox_respawn} {fwts} {pm_operation} +Exec=sudo {script} -r {repetitions} -w {wakeup} --hardware-delay {hardware_delay} --pm-delay {pm_delay} --min-pm-time {min_pm_time} --max-pm-time {max_pm_time} --append --total {total} --start {start} --pm-timestamp {pm_timestamp} {silent} --log-level={log_level} --log-dir={log_dir} --suspends-before-reboot={suspend_cycles} --checkbox-respawn-cmd={checkbox_respawn} {fwts} {pm_operation} Type=Application X-GNOME-Autostart-enabled=true Hidden=false @@ -673,9 +673,13 @@ Hidden=false """ logging.debug('Writing desktop file ({0!r})...' .format(self.desktop_filename)) - + snap_name = os.getenv('SNAP_NAME') + if snap_name: + script = '/snap/bin/{}.pm-test'.format(snap_name) + else: + script = '/usr/bin/python3 {}'.format(os.path.realpath(__file__)) contents = (self.TEMPLATE - .format(script=os.path.realpath(__file__), + .format(script=script, repetitions=self.args.repetitions - 1, wakeup=self.args.wakeup, hardware_delay=self.args.hardware_delay, diff --git a/bin/removable_storage_test b/bin/removable_storage_test index ddd4e1b6..42e197ad 100755 --- a/bin/removable_storage_test +++ b/bin/removable_storage_test @@ -99,6 +99,20 @@ def md5_hash_file(path): return md5.hexdigest() +def on_ubuntucore(): + """ + Check if running from on ubuntu core + """ + snap = os.getenv("SNAP") + if snap: + with open(os.path.join(snap, 'meta/snap.yaml')) as f: + for l in f.readlines(): + if l == "confinement: classic\n": + return False + return True + return False + + class DiskTest(): ''' Class to contain various methods for testing removable disks ''' @@ -177,7 +191,7 @@ class DiskTest(): Indirectly sets: self.rem_disks{,_nm,_memory_cards,_memory_cards_nm,_speed} """ - if "SNAP" in os.environ: + if on_ubuntucore(): self._probe_disks_udisks2_cli() else: bus, loop = connect_to_system_bus() |
