next-checks: add cargo doc checks

Fail on warnings and don't build the dependencies' doc

If TEST_FEATURES is empty, then add the "" feature.

Change-Id: If152f7276277eb24f6e7e4d9373e5ea0a486d509
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
diff --git a/script/next-checks/next-checks-generic-tests.sh b/script/next-checks/next-checks-generic-tests.sh
index 4ebf846..85c1378 100755
--- a/script/next-checks/next-checks-generic-tests.sh
+++ b/script/next-checks/next-checks-generic-tests.sh
@@ -52,7 +52,10 @@
   #     with cargo test.
   IFS=" " read -a all_features <<< "$(make PLAT=fvp --silent list_features)"
 else
-  IFS=" " read -a all_features <<< "$($TEST_FEATURES)"
+  IFS=" " read -a all_features <<< ${TEST_FEATURES}
+  if [ ${#all_features[@]} = 0 ]; then
+    all_features+=("")
+  fi
 fi
 
 for features in "${all_features[@]}"; do
@@ -72,9 +75,24 @@
 
 echo
 
+# Run cargo doc
+
+echo "cargo doc --no-deps" >> "$LOG_TEST_FILENAME" 2>&1
+
+RUSTDOCFLAGS="-D warnings" cargo doc --no-deps >> "$LOG_TEST_FILENAME" 2>&1
+
+if [ "$?" != 0 ]; then
+  echo "cargo doc: FAILURE"
+  ((ERROR_COUNT++))
+else
+  echo "cargo doc: PASS"
+fi
+
+echo "-------------------------------------" >> "$LOG_TEST_FILENAME" 2>&1
+
 cd -
 if [ "$ERROR_COUNT" != 0 ]; then
-  echo "Some cargo tests checks have failed."
+  echo "Some cargo checks have failed."
   exit 1
 fi