Clean up cros-rust ebuilds in dev-rust and sys-apps.

This enables unit testing on arm and aarch64. The minijail ebuilds will
be handled in a follow up CL.

BUG=chromium:1158447
TEST=CQ passes

Change-Id: Ifa8d8bf6b17c4af7ffc47be3330b9c297da69ca1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/2590490
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Allen Webb <allenwebb@google.com>
Tested-by: Allen Webb <allenwebb@google.com>
diff --git a/dev-rust/p9/p9-9999.ebuild b/dev-rust/p9/p9-9999.ebuild
index 7bfc88f..2d33c1e 100644
--- a/dev-rust/p9/p9-9999.ebuild
+++ b/dev-rust/p9/p9-9999.ebuild
@@ -3,15 +3,17 @@
 
 EAPI=7
 
+CROS_RUST_SUBDIR="vm_tools/p9"
+
 CROS_WORKON_LOCALNAME="../platform2"
 CROS_WORKON_PROJECT="chromiumos/platform2"
 CROS_WORKON_INCREMENTAL_BUILD=1
-CROS_WORKON_SUBTREE="vm_tools/p9"
+CROS_WORKON_SUBTREE="${CROS_RUST_SUBDIR}"
 
 inherit cros-fuzzer cros-workon cros-rust
 
 DESCRIPTION="Server implementation of the 9P file system protocol"
-HOMEPAGE="https://chromium.googlesource.com/chromiumos/platform2/+/master/vm_tools/p9/"
+HOMEPAGE="https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/vm_tools/p9/"
 
 LICENSE="BSD-Google"
 KEYWORDS="~*"
@@ -38,13 +40,6 @@
 	cros-rust_pkg_setup p9
 }
 
-src_unpack() {
-	cros-workon_src_unpack
-	S+="/vm_tools/p9"
-
-	cros-rust_src_unpack
-}
-
 src_compile() {
 	pushd wire_format_derive > /dev/null || die
 	ecargo_build
@@ -61,11 +56,12 @@
 }
 
 src_test() {
-	if ! use x86 && ! use amd64 ; then
-		elog "Skipping unit tests on non-x86 platform"
-	else
-		ecargo_test
-	fi
+	(
+		cd wire_format_derive || die
+		cros-rust_src_test
+	)
+
+	cros-rust_src_test
 }
 
 src_install() {
diff --git a/dev-rust/syscall_defines/syscall_defines-9999.ebuild b/dev-rust/syscall_defines/syscall_defines-9999.ebuild
index 5d04c01..61981f1 100644
--- a/dev-rust/syscall_defines/syscall_defines-9999.ebuild
+++ b/dev-rust/syscall_defines/syscall_defines-9999.ebuild
@@ -12,33 +12,10 @@
 inherit cros-workon cros-rust
 
 DESCRIPTION="Linux syscall defines."
-HOMEPAGE="https://chromium.googlesource.com/chromiumos/platform/+/master/crosvm/syscall_defines"
+HOMEPAGE="https://chromium.googlesource.com/chromiumos/platform/+/HEAD/crosvm/syscall_defines"
 
 LICENSE="BSD-Google"
 KEYWORDS="~*"
 IUSE="test"
 
 RDEPEND="!!<=dev-rust/syscall_defines-0.1.0-r2"
-
-src_unpack() {
-	cros-workon_src_unpack
-	S+="/syscall_defines"
-
-	cros-rust_src_unpack
-}
-
-src_compile() {
-	use test && ecargo_test --no-run
-}
-
-src_test() {
-	if use x86 || use amd64; then
-		ecargo_test
-	else
-		elog "Skipping rust unit tests on non-x86 platform"
-	fi
-}
-
-src_install() {
-	cros-rust_publish "${PN}" "$(cros-rust_get_crate_version)"
-}
diff --git a/dev-rust/tempfile/tempfile-9999.ebuild b/dev-rust/tempfile/tempfile-9999.ebuild
index a06fc0a..acdfdc8 100644
--- a/dev-rust/tempfile/tempfile-9999.ebuild
+++ b/dev-rust/tempfile/tempfile-9999.ebuild
@@ -11,7 +11,7 @@
 inherit cros-workon cros-rust
 
 DESCRIPTION="A library for managing temporary files and directories"
-HOMEPAGE="https://chromium.googlesource.com/chromiumos/platform/+/master/crosvm/tempfile"
+HOMEPAGE="https://chromium.googlesource.com/chromiumos/platform/+/HEAD/crosvm/tempfile"
 
 LICENSE="BSD-Google"
 KEYWORDS="~*"
@@ -27,26 +27,3 @@
 "
 
 RDEPEND="!!<=dev-rust/tempfile-3.0.7-r2"
-
-src_unpack() {
-	cros-workon_src_unpack
-	S+="/tempfile"
-
-	cros-rust_src_unpack
-}
-
-src_compile() {
-	use test && ecargo_test --no-run
-}
-
-src_test() {
-	if use x86 || use amd64; then
-		ecargo_test
-	else
-		elog "Skipping rust unit tests on non-x86 platform"
-	fi
-}
-
-src_install() {
-	cros-rust_publish "${PN}" "$(cros-rust_get_crate_version)"
-}
diff --git a/sys-apps/flashrom-tester/flashrom-tester-9999.ebuild b/sys-apps/flashrom-tester/flashrom-tester-9999.ebuild
index 49bcf5f..2a19213 100644
--- a/sys-apps/flashrom-tester/flashrom-tester-9999.ebuild
+++ b/sys-apps/flashrom-tester/flashrom-tester-9999.ebuild
@@ -3,10 +3,12 @@
 
 EAPI=7
 
+CROS_RUST_SUBDIR="util/flashrom_tester"
+
 CROS_WORKON_USE_VCSID="1"
 CROS_WORKON_PROJECT="chromiumos/third_party/flashrom"
 CROS_WORKON_LOCALNAME="flashrom"
-CROS_WORKON_SUBTREE="util/flashrom_tester"
+CROS_WORKON_SUBTREE="${CROS_RUST_SUBDIR}"
 
 inherit cros-workon cros-rust
 
@@ -27,12 +29,6 @@
 
 RDEPEND="!<=sys-apps/flashrom-tester-1.60-r41"
 
-src_unpack() {
-	cros-workon_src_unpack
-	S+="/${CROS_WORKON_SUBTREE}"
-	cros-rust_src_unpack
-}
-
 src_compile() {
 	# Override HOST_CFLAGS so that build dependencies use the correct
 	# flags on cross-compiled targets using cc-rs.
@@ -40,18 +36,12 @@
 	export HOST_CFLAGS="${BUILD_CFLAGS}"
 	ecargo_build
 	if use test; then
-		ecargo_test --no-run
-		ecargo_test --no-run -p flashrom
+		ecargo_test --no-run --workspace
 	fi
 }
 
 src_test() {
-	if use x86 || use amd64; then
-		ecargo_test
-		ecargo_test -p flashrom
-	else
-		elog "Skipping rust unit tests on non-x86 platform"
-	fi
+	cros-rust_src_test --workspace
 }
 
 src_install() {