Move `iree_run_module_test` portability handling to `iree_native_test` (#10788)

Define file location with a `{{}}` locator and parse it in
`iree_native_test`.

For example, simple.vmfb will be set as 
```
iree_native_test(
...
  ARGS
    "--module_file={{simple.vmfb}}"
...
)
```
And `iree_native_test` handles the portability within the function by
check/removing the `{{}}` locator.
diff --git a/build_tools/cmake/iree_native_test.cmake b/build_tools/cmake/iree_native_test.cmake
index 85f272e..12c2bca 100644
--- a/build_tools/cmake/iree_native_test.cmake
+++ b/build_tools/cmake/iree_native_test.cmake
@@ -25,6 +25,9 @@
 #     device. TEST_INPUT_FILE_ARG is automatically added if specified.
 # ARGS: additional arguments passed to the test binary. TEST_INPUT_FILE_ARG and
 #     --device=DRIVER are automatically added if specified.
+#     File-related arguments can be passed with `{{}}` locator,
+#     e.g., --function_input=@{{foo.npy}}. The locator is used to portably
+#     pass the file arguments to tests and add the file to DATA.
 # SRC: binary target to run as the test.
 # WILL_FAIL: The target will run, but its pass/fail status will be inverted.
 # LABELS: Additional labels to apply to the test. The package path is added
@@ -89,6 +92,25 @@
     list(APPEND _RULE_DATA "${_RULE_TEST_INPUT_FILE_ARG}")
   endif()
 
+  # Detect file location with `{{}}` and handle its portability for all entries
+  # in `_RULE_ARGS`.
+  foreach(_ARG ${_RULE_ARGS})
+    string(REGEX MATCH ".+{{(.+)}}" _FILE_ARG "${_ARG}")
+    if(_FILE_ARG)
+      set(_FILE_PATH ${CMAKE_MATCH_1})
+      list(APPEND _RULE_DATA "${_FILE_PATH}")
+      if (ANDROID)
+        cmake_path(GET _FILE_PATH FILENAME _FILE_BASENAME)
+        set(_FILE_PATH "${_ANDROID_ABS_DIR}/${_FILE_BASENAME}")
+      endif()
+      # remove the `{{}}` from `_ARG` and append it to `_TEST_ARGS`.
+      string(REGEX REPLACE "{{.+}}" "" _FILE_FLAG_PREFIX "${_ARG}")
+      list(APPEND _TEST_ARGS "${_FILE_FLAG_PREFIX}${_FILE_PATH}")
+    else()  # naive append
+      list(APPEND _TEST_ARGS "${_ARG}")
+    endif(_FILE_ARG)
+  endforeach(_ARG)
+
   # Replace binary passed by relative ::name with iree::package::name
   string(REGEX REPLACE "^::" "${_PACKAGE_NS}::" _SRC_TARGET ${_RULE_SRC})
 
@@ -101,7 +123,7 @@
       COMMAND
         "${CMAKE_SOURCE_DIR}/build_tools/cmake/run_android_test.${IREE_HOST_SCRIPT_EXT}"
         "${_ANDROID_ABS_DIR}/$<TARGET_FILE_NAME:${_SRC_TARGET}>"
-        ${_RULE_ARGS}
+        ${_TEST_ARGS}
     )
     # Use environment variables to instruct the script to push artifacts
     # onto the Android device before running the test. This needs to match
@@ -126,7 +148,7 @@
       COMMAND
         "${IREE_ROOT_DIR}/build_tools/cmake/run_riscv_test.sh"
         "$<TARGET_FILE:${_SRC_TARGET}>"
-        ${_RULE_ARGS}
+        ${_TEST_ARGS}
     )
     iree_configure_test(${_TEST_NAME})
   else()
@@ -135,7 +157,7 @@
         ${_TEST_NAME}
       COMMAND
         "$<TARGET_FILE:${_SRC_TARGET}>"
-        ${_RULE_ARGS}
+        ${_TEST_ARGS}
     )
     iree_configure_test(${_TEST_NAME})
   endif()
diff --git a/build_tools/cmake/iree_run_module_test.cmake b/build_tools/cmake/iree_run_module_test.cmake
index 6c2aa39..b5671ce 100644
--- a/build_tools/cmake/iree_run_module_test.cmake
+++ b/build_tools/cmake/iree_run_module_test.cmake
@@ -100,19 +100,9 @@
 
   iree_package_path(_PACKAGE_PATH)
 
-  # All the file paths referred in the _RULE_RUNNER_ARGS are relative paths to
-  # make it portable, and all the paths in `_RUNNER_DATA` are absolute paths to
-  # make sure it can be checked/copied by the `iree_native_test` flow.
-  list(APPEND _RUNNER_DATA ${_RULE_MODULE_SRC})
-  # Android test runs on device and needs to set the file location properly.
-  # TODO(#10744): Move it into `iree_native_test`
-  if(ANDROID)
-    cmake_path(GET _RULE_MODULE_SRC FILENAME _SRC_FILE_BASE)
-    set(_SRC_PATH "${_PACKAGE_PATH}/${_RULE_NAME}/${_SRC_FILE_BASE}")
-  else()
-    file(RELATIVE_PATH _SRC_PATH
-      "${CMAKE_CURRENT_BINARY_DIR}" "${_RULE_MODULE_SRC}")
-  endif()
+  # All the file paths referred in the _RUNNER_FILE_ARGS are absolute paths and
+  # the portability is handled by `iree_native_test`.
+  list(APPEND _RUNNER_FILE_ARGS "--module_file={{${_RULE_MODULE_SRC}}}")
 
   if(_RULE_EXPECTED_OUTPUT)
     # this may be a file or a literal output. In the latter case, the
@@ -127,7 +117,6 @@
       string(REPLACE "\n" " " _EXPECTED_OUTPUT_STR "${_EXPECTED_OUTPUT}")
       set(_EXPECTED_OUTPUT_STR "--expected_output=\"${_EXPECTED_OUTPUT_STR}\"")
       list(APPEND _RULE_RUNNER_ARGS ${_EXPECTED_OUTPUT_STR})
-      list(APPEND _RUNNER_DATA ${_OUTPUT_FILE_ABS_PATH})
     elseif(_OUTPUT_FILE_TYPE STREQUAL ".npy")
       # Large npy files are not stored in the codebase. Need to download them
       # from GCS iree-model-artifacts first and store them in the following possible
@@ -152,18 +141,8 @@
           ${IREE_BENCHMARK_SUITE_DIR}\n\
           Please check if you need to download it first.")
       else()
-        # Android runs on device and pushs the file into a different path.
-        # TODO(#10744): Move it into `iree_native_test`
-        if(ANDROID)
-          cmake_path(GET _OUTPUT_FILE_ABS_PATH FILENAME _OUTPUT_FILE_BASE)
-          list(APPEND
-            _RULE_RUNNER_ARGS "--expected_output=@${_PACKAGE_PATH}/${_RULE_NAME}/${_OUTPUT_FILE_BASE}")
-        else()
-          file(RELATIVE_PATH _OUTPUT_FILE_RELATIVE_PATH
-            "${CMAKE_CURRENT_BINARY_DIR}" "${_OUTPUT_FILE_ABS_PATH}")
-          list(APPEND _RULE_RUNNER_ARGS "--expected_output=@${_OUTPUT_FILE_RELATIVE_PATH}")
-        endif()
-        list(APPEND _RUNNER_DATA ${_OUTPUT_FILE_ABS_PATH})
+        list(APPEND _RUNNER_FILE_ARGS
+          "--expected_output=@{{${_OUTPUT_FILE_ABS_PATH}}}")
       endif()
     else()
       message(SEND_ERROR "Unsupported expected output file type: ${_RULE_EXPECTED_OUTPUT}")
@@ -181,14 +160,8 @@
       CONTENT
         "${_OUTPUT_FLAGS}"
     )
-    list(APPEND _RUNNER_DATA "${CMAKE_CURRENT_BINARY_DIR}/${_RULE_NAME}_flagfile")
-    # Android test runs on device and needs to set the file location properly.
-    # TODO(#10744): Move it into `iree_native_test`
-    if(ANDROID)
-      set(_OUTPUT_FLAGFILE "${_PACKAGE_PATH}/${_RULE_NAME}/${_RULE_NAME}_flagfile")
-    else()
-      set(_OUTPUT_FLAGFILE "${_RULE_NAME}_flagfile")
-    endif()
+    list(APPEND _RUNNER_FILE_ARGS
+      "--flagfile={{${CMAKE_CURRENT_BINARY_DIR}/${_RULE_NAME}_flagfile}}")
   endif()
 
   # A target specifically for the test.
@@ -214,10 +187,7 @@
     SRC
       "${_RUNNER_TARGET}"
     ARGS
-      "--module_file=${_SRC_PATH}"
-      "--flagfile=${_OUTPUT_FLAGFILE}"
-    DATA
-      "${_RUNNER_DATA}"
+      ${_RUNNER_FILE_ARGS}
     WILL_FAIL
       ${_TEST_XFAIL}
     LABELS