1#!/usr/bin/env python3 2# -*- coding: utf-8 -*- 3# 4# Copyright (c) 2023 Huawei Device Co., Ltd. 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17 18import os 19import subprocess 20import time 21 22import schedule 23 24 25def job(cmd): 26 subprocess.run(cmd, shell=False) 27 28 29if __name__ == "__main__": 30 os.chdir(os.path.dirname(os.path.realpath(__file__))) 31 # do preparations 32 schedule.every().day.at("01:00").do(job, cmd=os.path.join( 33 ".", "auto_xts_test", "run.bat")).tag('daily_xts_task') 34 # do sdk_test 35 schedule.every().day.at("01:00").do( 36 job, cmd=f'python {os.path.join(".", "sdk_test", "entry.py")}').tag('daily_sdk_task') 37 # do perf_test 38 schedule.every().day.at("01:00").do( 39 job, cmd=f'python {os.path.join(".", "performance_test", "performance_entry.py")}') 40 # send mail 41 schedule.every().day.at("01:00").do( 42 job, cmd=f'python {os.path.join(".", "send_email.py")}').tag("send_email") 43 schedule.run_all() 44 while True: 45 schedule.run_pending() 46 time.sleep(1) 47