ICU-20734 Improve fuzzer_driver

See #1204
diff --git a/icu4c/source/test/fuzzer/Makefile.in b/icu4c/source/test/fuzzer/Makefile.in
index 37c609d..259e6b0 100644
--- a/icu4c/source/test/fuzzer/Makefile.in
+++ b/icu4c/source/test/fuzzer/Makefile.in
@@ -73,7 +73,9 @@
 	$(RMV) Makefile
 
 check-local: all-local
-	$(foreach trgt,$(FUZZER_TARGETS), echo $(trgt); $(INVOKE) ./$(trgt) \
+	# Create a dummy test case file with content "abc123"
+	echo "abc123" > dummytestcase
+	$(foreach trgt,$(FUZZER_TARGETS), echo $(trgt); $(INVOKE) ./$(trgt) dummytestcase -q \
             $(TEST_OUTPUT_OPTS) || exit \
             $(IOTEST_OPTS);)
 
diff --git a/icu4c/source/test/fuzzer/fuzzer_driver.cpp b/icu4c/source/test/fuzzer/fuzzer_driver.cpp
index 820ed85..9bffb93 100644
--- a/icu4c/source/test/fuzzer/fuzzer_driver.cpp
+++ b/icu4c/source/test/fuzzer/fuzzer_driver.cpp
@@ -1,8 +1,12 @@
 // © 2019 and later: Unicode, Inc. and others.
 // License & terms of use: http://www.unicode.org/copyright.html
 
+#include <fstream>
+#include <iostream>
+#include <sstream>
 #include <stddef.h>
 #include <stdint.h>
+#include <string>
 
 #include "cmemory.h"
 
@@ -10,11 +14,45 @@
 
 int main(int argc, char* argv[])
 {
-  (void) argc;
-  (void) argv;
-  const char *fuzzer_data = "abc123";
-   
-  LLVMFuzzerTestOneInput((const uint8_t *) fuzzer_data, strlen(fuzzer_data));
+    bool show_warning = true;
+    bool show_error = true;
+#if UPRV_HAS_FEATURE(address_sanitizer)
+    show_warning = false;
+#endif
+#if UPRV_HAS_FEATURE(memory_sanitizer)
+    show_warning = false;
+#endif
+    if (argc > 2 && strcmp(argv[2], "-q") == 0) {
+        show_warning = false;
+        show_error = false;
+    }
+    if (show_warning) {
+        std::cerr << "WARNING: This binary work only under build configure with" << std::endl
+                  << " CFLAGS=\"-fsanitize=$SANITIZE\""
+                  << " CXXFLAGS=\"-fsanitize=$SANITIZE\""
+                  << " ./runConfigureICU ... " << std::endl
+                  << "  where $SANITIZE is 'address' or 'memory'" << std::endl
+                  << "Plesae run the above step and make tests to rebuild" << std::endl;
+        // Do not return -1 here so we will pass the unit test.
+    }
+    if (argc < 2) {
+        if (show_error) {
+            std::cerr << "Usage: " << argv[0] << "  testcasefile [-q]" << std::endl
+                      << "  -q : quiet while error" << std::endl;
+        }
+        return -1;
+    }
+    const char *path = argv[1];
+    std::ifstream file(path, std::ios::binary);
+    if (!file.is_open()) {
+        if (show_error) {
+            std::cerr << "Cannot open testcase file " << path << std::endl;
+        }
+        return -1;
+    }
+    std::ostringstream ostrm;
+    ostrm << file.rdbuf();
+    LLVMFuzzerTestOneInput((const uint8_t *) ostrm.str().c_str(), ostrm.str().size());
 
-  return 0;
+    return 0;
 }