lkml.org 
[lkml]   [2020]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Subjectchecking for "config" file existence.
From
Date
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")
\
 
 \ /
  Last update: 2020-11-12 18:41    [W:0.050 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site