Messages in this thread | | | Subject | checking for "config" file existence. | From | Jeffrin Jose T <> | Date | Thu, 12 Nov 2020 23:10:47 +0530 |
| |
hello,
i wrote a small program to check for the existence of "config" files for testing projects under kselftest framework.
chmod 755 test_config.py This file should be located in "tools/testing/selftests" This can be run as "./test_config.py"
-- software engineer rajagiri school of engineering and technology - autonomous
#!/usr/bin/python3 # SPDX-License-Identifier: GPL-2.0 # Copyright (C) 2020 RSET
import os from pathlib import Path
ok = 0 notok = 0 for filename in os.listdir(): fileall = Path("./"+filename) filecheck = Path("./"+filename+"/"+"config") if (fileall.is_dir()) and (filename != "kselftest"): if filecheck.exists(): print(filename," [PASS]\n") ok = ok + 1 else: print(filename," [FAIL]\n") notok = notok + 1
print(ok+notok,"TESTED") print(ok, "PASSED") print(notok,"FAILED")
| |