Files
rk35xx-android14/external/bcc/tests/python/test_utils.py
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

24 lines
706 B
Python
Executable File

#!/usr/bin/env python3
# Copyright (c) Catalysts GmbH
# Licensed under the Apache License, Version 2.0 (the "License")
from bcc.utils import get_online_cpus, detect_language
import multiprocessing
import unittest
import os
class TestUtils(unittest.TestCase):
def test_get_online_cpus(self):
online_cpus = get_online_cpus()
num_cores = multiprocessing.cpu_count()
self.assertEqual(len(online_cpus), num_cores)
def test_detect_language(self):
candidates = ["c", "java", "perl", "php", "node", "ruby", "python"]
language = detect_language(candidates, os.getpid())
self.assertEqual(language, "python")
if __name__ == "__main__":
unittest.main()