Add DiceDrive::from_file factory method

This new function will be used in microdroid_manager to read the dice
chain written during first_stage_init for Microdroid VMs with microdroid
vendor partition.

This patch also adds a simple unit test to ensure that a dice chain read
from the file is equal to the one written to it.

Bug: 287593065
Test: atest libdice_driver_test
Change-Id: I5fa10a4b405b23f2c1980a920f0e72077623c01c
diff --git a/libs/dice/driver/Android.bp b/libs/dice/driver/Android.bp
index 4a17334..c93bd7d 100644
--- a/libs/dice/driver/Android.bp
+++ b/libs/dice/driver/Android.bp
@@ -2,8 +2,8 @@
     default_applicable_licenses: ["Android-Apache-2.0"],
 }
 
-rust_library {
-    name: "libdice_driver",
+rust_defaults {
+    name: "libdice_driver_defaults",
     crate_name: "dice_driver",
     defaults: [
         "avf_build_flags_rust",
@@ -25,6 +25,7 @@
         "libonce_cell",
         "libopenssl",
         "libthiserror",
+        "libserde_cbor",
     ],
     multilib: {
         lib32: {
@@ -32,3 +33,18 @@
         },
     },
 }
+
+rust_library {
+    name: "libdice_driver",
+    defaults: ["libdice_driver_defaults"],
+}
+
+rust_test {
+    name: "libdice_driver_test",
+    defaults: ["libdice_driver_defaults"],
+    test_suites: ["general-tests"],
+    rustlibs: [
+        "libhex",
+        "libtempfile",
+    ],
+}