From f922d2b01897c5852ce2512cd916aa567d76eaf7 Mon Sep 17 00:00:00 2001 From: rsora Date: Fri, 6 Mar 2020 11:24:57 +0100 Subject: [PATCH 1/2] Remove upload port as required CLI parameter in "upload" command --- cli/upload/upload.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/cli/upload/upload.go b/cli/upload/upload.go index c9b2300b665..c5a735add97 100644 --- a/cli/upload/upload.go +++ b/cli/upload/upload.go @@ -54,8 +54,6 @@ func NewCommand() *cobra.Command { uploadCommand.Flags().BoolVarP(&verify, "verify", "t", false, "Verify uploaded binary after the upload.") uploadCommand.Flags().BoolVarP(&verbose, "verbose", "v", false, "Optional, turns on verbose mode.") - uploadCommand.MarkFlagRequired("port") - return uploadCommand } From 9d165e623cac02b17cd6d92f2bcc47a856a59028 Mon Sep 17 00:00:00 2001 From: rsora Date: Fri, 6 Mar 2020 12:10:21 +0100 Subject: [PATCH 2/2] Add "board attach" integ test --- test/test_upload.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/test_upload.py b/test/test_upload.py index 8a8125a4528..bb44b8dbe58 100644 --- a/test/test_upload.py +++ b/test/test_upload.py @@ -38,9 +38,35 @@ def test_upload(run_command, data_dir, detected_boards): fqbn=board.fqbn, sketch_path=sketch_path ) ) + # Upload without port must fail + result = run_command( + "upload -b {fqbn} {sketch_path}".format( + sketch_path=sketch_path, fqbn=board.fqbn, port=board.address + ) + ) + assert result.failed # Upload assert run_command( "upload -b {fqbn} -p {port} {sketch_path}".format( sketch_path=sketch_path, fqbn=board.fqbn, port=board.address ) ) + + +def test_upload_after_attach(run_command, data_dir, detected_boards): + # Init the environment explicitly + assert run_command("core update-index") + + for board in detected_boards: + # Download core + assert run_command("core install {}".format(board.core)) + # Create a sketch + sketch_path = os.path.join(data_dir, "foo") + assert run_command("sketch new {}".format(sketch_path)) + assert run_command( + "board attach serial://{port} {sketch_path}".format(port=board.address, sketch_path=sketch_path) + ) + # Build sketch + assert run_command("compile {sketch_path}".format(sketch_path=sketch_path)) + # Upload + assert run_command("upload {sketch_path}".format(sketch_path=sketch_path))