mehrdadh commented on a change in pull request #8748:
URL: https://github.com/apache/tvm/pull/8748#discussion_r694583014



##########
File path: apps/microtvm/reference-vm/arduino/base-box/base_box_test.sh
##########
@@ -0,0 +1,39 @@
+#!/bin/bash -e
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# Usage: base_box_test.sh <MICROTVM_PLATFORM>
+#     Execute microTVM Arduino tests.
+#
+
+set -e
+set -x
+
+if [ "$#" -lt 1 ]; then
+    echo "Usage: base_box_test.sh <MICROTVM_PLATFORM>"
+    exit -1
+fi
+
+microtvm_platform=$1
+
+pytest tests/micro/arduino/test_arduino_workflow.py 
--microtvm-platforms=${microtvm_platform}
+
+if [ $microtvm_platform == "nano33ble" ]; then
+    echo "NOTE: skipped test_arduino_rpc_server.py on $microtvm_platform -- 
known failure"

Review comment:
       Can you open an issue and comment the issue number here for reference?

##########
File path: apps/microtvm/reference-vm/base-box-tool.py
##########
@@ -363,6 +392,7 @@ def test_command(args):
         microtvm_test_platform["microtvm_platform"] = args.microtvm_platform
 
     providers = args.provider
+    print(providers)

Review comment:
       remove?

##########
File path: apps/microtvm/reference-vm/base-box-tool.py
##########
@@ -41,14 +41,46 @@
     "vmware_desktop",
 )
 
-# List of microTVM platforms for testing.
-ALL_MICROTVM_PLATFORMS = (
-    "stm32f746xx_nucleo",
-    "stm32f746xx_disco",
-    "nrf5340dk",
-    "mps2_an521",
+# List of supported electronics platforms. Each must correspond
+# to a sub-directory of this directory.
+ALL_PLATFORMS = (
+    "arduino",
+    "zephyr",
 )
 
+# List of identifying strings for microTVM platforms for testing.
+# Must match PLATFORMS as defined in tvm/tests/micro/[platform]/conftest.py
+# TODO add a way to declare supported platforms to ProjectAPI
+ALL_MICROTVM_PLATFORMS = {
+    "arduino": (
+        "due",
+        "feathers2",
+        "metrom4",
+        "nano33ble",
+        "pybadge",
+        "spresense",
+        "teensy40",
+        "teensy41",
+        "wioterminal",
+    ),
+    "zephyr": (
+        "stm32f746xx_nucleo",
+        "stm32f746xx_disco",
+        "nrf5340dk",
+        "mps2_an521",
+    ),
+}
+
+# Extra scripts required to execute on provisioning
+# in [platform]/base-box/base_box_provision.sh
+EXTRA_SCRIPTS = {
+    "arduino": (),
+    "zephyr": (
+        "docker/install/ubuntu_init_zephyr_project.sh",
+        "docker/install/ubuntu_install_qemu.sh",

Review comment:
       Bad merge. Remove this line: `"docker/install/ubuntu_install_qemu.sh"`

##########
File path: apps/microtvm/reference-vm/base-box-tool.py
##########
@@ -439,26 +473,27 @@ def parse_args():
         "--provider",
         choices=ALL_PROVIDERS,
         action="append",
-        help="Name of the provider or providers to act on; if not specified, 
act on all.",
+        required=True,
+        help="Name of the provider or providers to act on",
     )
 
-    parser.add_argument(
-        "platform",
-        help="Name of the platform VM to act on. Must be a sub-directory of 
this directory.",
-    )
+    # "test" has special options for different platforms, and "build", 
"release" might
+    # in the future, so we'll add the platform argument to each one 
individually.
+    platform_help_str = "Electronics platform to use (e.g. Arduino, Zephyr)"

Review comment:
       maybe change to "RTOS platforms to use..."?

##########
File path: apps/microtvm/reference-vm/arduino/Vagrantfile
##########
@@ -0,0 +1,89 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+Vagrant.configure("2") do |config|
+  config.vm.box = "tlcpack/microtvm-arduino-0.18.3"
+
+  if ENV.has_key?("TVM_RVM_NUM_CORES")
+    num_cores = ENV["TVM_RVM_NUM_CORES"]
+  else
+    num_cores = 2
+  end
+
+  if ENV.has_key?("TVM_RVM_RAM_BYTES")
+    ram_bytes = ENV["TVM_RVM_RAM_BYTES"]
+  else
+    ram_bytes = 2048
+  end
+
+  tvm_home = "../../../.."
+  dirs_to_mount = [Pathname.new(Pathname.new(tvm_home).expand_path())]
+  if ENV.has_key?("TVM_PROJECT_DIR") then
+    dirs_to_mount.append(ENV["TVM_PROJECT_DIR"])
+    puts "NOTE: also configuring project dir: %s" % [dirs_to_mount[-1]]
+  end
+
+  git_file = Pathname.new(tvm_home + "/.git")
+  if git_file.ftype() == "file" then
+    gitdir_match = Regexp.new('^gitdir: (?<gitdir>.*/.git).*\n$', 
Regexp::MULTILINE).match(git_file.read())
+    if !gitdir_match.nil? then
+      
dirs_to_mount.append(Pathname.new(tvm_home).realpath.join(gitdir_match.named_captures["gitdir"]))
+      puts "NOTE: also configuring git-worktree gitdir: %s" % 
[dirs_to_mount[-1]]
+    end
+  end
+
+  config.vm.provision "shell", path: "provision_setup.sh", env: {"TVM_HOME": 
dirs_to_mount[0]}, privileged: false
+
+  # Enable USB Controller on VirtualBox
+  vm_name = "microtvm-#{Time.now.tv_sec}"
+  config.vm.provider "virtualbox" do |vb, overrides|
+    vb.name = vm_name
+    vb.cpus = num_cores
+    vb.memory = ram_bytes
+    vb.customize ["modifyvm", :id, "--usb", "on"]
+    vb.customize ["modifyvm", :id, "--usbehci", "on"]
+    vb.customize ["modifyvm", :id, "--usbxhci", "on"]
+    vb.customize [ "guestproperty", "set", :id, 
"/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000]
+    dirs_to_mount.each do |d|
+      overrides.vm.synced_folder d.to_s, d.to_s
+    end
+  end
+
+  config.vm.provider "parallels" do |prl, overrides|

Review comment:
       Are you going to build the image for parallels and vmware? If not, I 
suggest to remove these two since without testing them it will confuse people.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to