summaryrefslogtreecommitdiff
path: root/bin
diff options
authorSylvain Pineau <sylvain.pineau@canonical.com>2019-01-17 17:57:50 +0100
committerSylvain Pineau <sylvain.pineau@canonical.com>2019-01-17 17:57:50 +0100
commitd179a51aa3482837a3cba533adc1f7e19f573be0 (patch)
tree496e7882178e0a60b97ec1ba0ade3fc25a841196 /bin
parentff7f7de5f946bc45e254f09d5da76850b4dd9b73 (diff)
Import plainbox-provider-checkbox_0.47.0~rc2.orig.tar.gzupstream-0.47.0_rc2patched-0.47.0_rc2-1
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bluez_list_adapters.py37
-rwxr-xr-xbin/bt_list_adapters.py46
-rwxr-xr-xbin/memory_stress_ng4
3 files changed, 85 insertions, 2 deletions
diff --git a/bin/bluez_list_adapters.py b/bin/bluez_list_adapters.py
new file mode 100755
index 0000000..87c68c2
--- /dev/null
+++ b/bin/bluez_list_adapters.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python3
+#
+# This file is part of Checkbox.
+#
+# Copyright 2018 Canonical Ltd.
+#
+# Authors:
+# Jonathan Cave <jonathan.cave@canonical.com>
+#
+# Checkbox is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3,
+# as published by the Free Software Foundation.
+#
+# Checkbox is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Checkbox. If not, see <http://www.gnu.org/licenses/>.
+
+import checkbox_support.bt_helper as bt_helper
+
+import sys
+
+
+def main():
+ manager = bt_helper.BtManager()
+ bt_adapter_not_found = True
+ for dev in manager.get_bt_adapters():
+ bt_adapter_not_found = False
+ print(dev._if.object_path.split('/')[-1])
+ return bt_adapter_not_found
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/bin/bt_list_adapters.py b/bin/bt_list_adapters.py
new file mode 100755
index 0000000..e791442
--- /dev/null
+++ b/bin/bt_list_adapters.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python3
+#
+# This file is part of Checkbox.
+#
+# Copyright 2018 Canonical Ltd.
+#
+# Authors:
+# Jonathan Cave <jonathan.cave@canonical.com>
+#
+# Checkbox is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3,
+# as published by the Free Software Foundation.
+#
+# Checkbox is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Checkbox. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+
+
+def main():
+ rfkill = '/sys/class/rfkill'
+ found_adatper = False
+ for rfdev in os.listdir(rfkill):
+ typef = os.path.join(rfkill, rfdev, 'type')
+ type = ''
+ with open(typef, 'r') as f:
+ type = f.read().strip()
+ if type != 'bluetooth':
+ continue
+ found_adatper = True
+ namef = os.path.join(rfkill, rfdev, 'name')
+ name = ''
+ with open(namef, 'r') as f:
+ name = f.read().strip()
+ print(rfdev, name)
+ if found_adatper == False:
+ raise SystemExit('No bluetooth adatpers registered with rfkill')
+
+
+if __name__ == "__main__":
+ main()
diff --git a/bin/memory_stress_ng b/bin/memory_stress_ng
index 181404a..905ed50 100755
--- a/bin/memory_stress_ng
+++ b/bin/memory_stress_ng
@@ -70,9 +70,9 @@ get_params() {
# had_error -- sets to "1" if an error occurred
run_stressor() {
local runtime="$2"
- # Add 50% to runtime; will forcefully terminate if stress-ng
+ # Double runtime; will forcefully terminate if stress-ng
# fails to return in that time.
- end_time=$((runtime*15/10))
+ end_time=$((runtime*2))
echo "Running stress-ng $1 stressor for $2 seconds...."
logger -t "memory_stress_ng" "Running stress-ng $1 stressor for $2 seconds..."
# Use "timeout" command to launch stress-ng, to catch it should it go into la-la land