"src/client/git@developer.sourcefind.cn:one/TransferBench.git" did not exist on "26717d504b8c72f972a9388a1d446e9a9c57ef83"
Commit 589de109 authored by moto's avatar moto Committed by Facebook GitHub Bot
Browse files

Update package smoke test (#3465)

Summary:
1. Update smoke test script to change directory so that there is no `torchaudio` directory in CWD when smoke test is being executed.
2. Disable the part of smoke test which requires FFmpeg for wheel. The preparation for https://github.com/pytorch/test-infra/pull/4358

Pull Request resolved: https://github.com/pytorch/audio/pull/3465

Reviewed By: nateanl

Differential Revision: D47345117

Pulled By: mthrok

fbshipit-source-id: 95aad0a22922d44ee9a24a05d9ece85166b8c17e
parent 9c7bf1bc
......@@ -36,7 +36,7 @@ jobs:
cache-key: macos-m1-ffmpeg
pre-script: packaging/pre_build_script.sh
post-script: packaging/post_build_script.sh
smoke-test-script: test/smoke_test/smoke_test.py
smoke-test-script: test/smoke_test/smoke_test_no_ffmpeg.py
package-name: torchaudio
name: ${{ matrix.repository }}
uses: pytorch/test-infra/.github/workflows/build_wheels_macos.yml@main
......
......@@ -36,7 +36,7 @@ jobs:
cache-key: linux-ffmpeg
pre-script: packaging/pre_build_script.sh
post-script: packaging/post_build_script.sh
smoke-test-script: test/smoke_test/smoke_test.py
smoke-test-script: test/smoke_test/smoke_test_no_ffmpeg.py
package-name: torchaudio
name: ${{ matrix.repository }}
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
......
......@@ -36,7 +36,7 @@ jobs:
cache-key: macos-ffmpeg
pre-script: packaging/pre_build_script.sh
post-script: packaging/post_build_script.sh
smoke-test-script: test/smoke_test/smoke_test.py
smoke-test-script: test/smoke_test/smoke_test_no_ffmpeg.py
package-name: torchaudio
name: ${{ matrix.repository }}
uses: pytorch/test-infra/.github/workflows/build_wheels_macos.yml@main
......
......@@ -34,7 +34,7 @@ jobs:
cache-key: windows-ffmpeg
wheel-build-params: "--plat-name win_amd64"
post-script: ""
smoke-test-script: test/smoke_test/smoke_test.py
smoke-test-script: test/smoke_test/smoke_test_no_ffmpeg.py
package-name: torchaudio
name: ${{ matrix.repository }}
uses: pytorch/test-infra/.github/workflows/build_wheels_windows.yml@main
......
#!/usr/bin/env bash
set -eux
# This script is used by CI to perform smoke tests on installed binaries.
# When `import torchaudio` is executed from the root directory of the repo,
# the source `torchaudio` directory will shadow the actual installation.
# Changing to this directory to avoid that.
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
python smoke_test.py
#!/usr/bin/env python3
"""Run smoke tests"""
import argparse
import logging
......@@ -19,26 +20,44 @@ def ffmpeg_test():
from torchaudio.io import StreamReader # noqa: F401
def main() -> None:
options = _parse_args()
def _run_smoke_test(check_ffmpeg):
base_smoke_test()
if not check_ffmpeg:
print("Skipping ffmpeg test.")
else:
ffmpeg_test()
print("Smoke test passed.")
def main(args=None) -> None:
options = _parse_args(args)
if options.debug:
logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.DEBUG)
base_smoke_test()
if options.ffmpeg:
ffmpeg_test()
print("Smoke test passed.")
_chdir()
_run_smoke_test(options.ffmpeg)
def _parse_args():
def _parse_args(args):
parser = argparse.ArgumentParser()
# Warning: Please note this option should not be widely used, only use it when absolutely necessary
parser.add_argument("--no-ffmpeg", dest="ffmpeg", action="store_false")
parser.add_argument("--debug", action="store_true", help="Enable debug logging.")
return parser.parse_args()
return parser.parse_args(args)
def _chdir():
# smoke test should not be performed on the root directory of checked out source code.
import os
from pathlib import Path
os.chdir(Path(__file__).parent)
assert "torchaudio" not in os.listdir(os.getcwd())
if __name__ == "__main__":
......
from smoke_test import main
main(["--no-ffmpeg"])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment