test/py: usb: Distinguish b/w ext2/ext4 partitions

'usb part' command shows the partition maps and shows the partition type
by displaying number such as 0c, 83 etc. Observed that ext2 and ext4
partitions shows the same number, i.e, 83, so, using the fstype command
to distiniguish between ext2 and ext4 partitions.

Signed-off-by: Love Kumar <love.kumar@amd.com>
diff --git a/test/py/tests/test_usb.py b/test/py/tests/test_usb.py
index 2397fd3..e1f203b 100644
--- a/test/py/tests/test_usb.py
+++ b/test/py/tests/test_usb.py
@@ -227,7 +227,8 @@
 
             lines = output.split('\n')
             part_fat = []
-            part_ext = []
+            part_ext2 = []
+            part_ext4 = []
             for line in lines:
                 obj = re.search(r'(\d)\s+\d+\s+\d+\s+\w+\d+\w+-\d+\s+(\d+\w+)', line)
                 if obj:
@@ -239,15 +240,21 @@
                         print('Fat detected')
                         part_fat.append(part_id)
                     elif part_type == '83':
-                        print('ext detected')
-                        part_ext.append(part_id)
+                        print('ext(2/4) detected')
+                        output = u_boot_console.run_command(
+                            'fstype usb %d:%d' % i, part_id
+                        )
+                        if 'ext2' in output:
+                            part_ext2.append(part_id)
+                        elif 'ext4' in output:
+                            part_ext4.append(part_id)
                     else:
                         pytest.fail('Unsupported Filesystem on device %d' % i)
-            devices[i]['ext4'] = part_ext
-            devices[i]['ext2'] = part_ext
+            devices[i]['ext4'] = part_ext4
+            devices[i]['ext2'] = part_ext2
             devices[i]['fat'] = part_fat
 
-            if not part_ext and not part_fat:
+            if not part_ext2 and not part_ext4 and not part_fat:
                 pytest.fail('No partition detected on device %d' % i)
 
     return devices, controllers, storage_device
@@ -497,7 +504,7 @@
             for part in partitions:
                 part_detect = 1
                 file, size, expected_crc32 = \
-                    usb_ext4load_ext4write(u_boot_console, 'ext4', x, part)
+                    usb_ext4load_ext4write(u_boot_console, fs, x, part)
                 addr = u_boot_utils.find_ram_base(u_boot_console)
 
                 offset = random.randrange(128, 1024, 128)
@@ -526,7 +533,7 @@
     for x in range(0, int(storage_device)):
         if devices[x]['detected'] == 'yes':
             u_boot_console.run_command('usb dev %d' % x)
-            for fs in ['fat', 'ext4']:
+            for fs in ['fat', 'ext2', 'ext4']:
                 try:
                     partitions = devices[x][fs]
                 except:
@@ -556,7 +563,7 @@
     for x in range(0, int(storage_device)):
         if devices[x]['detected'] == 'yes':
             u_boot_console.run_command('usb dev %d' % x)
-            for fs in ['fat', 'ext4']:
+            for fs in ['fat', 'ext2', 'ext4']:
                 try:
                     partitions = devices[x][fs]
                 except:
@@ -570,7 +577,7 @@
                     if fs == 'fat':
                         file, size, expected_crc32 = \
                             usb_fatload_fatwrite(u_boot_console, fs, x, part)
-                    elif fs == 'ext4':
+                    elif fs in ['ext4', 'ext2']:
                         file, size, expected_crc32 = \
                             usb_ext4load_ext4write(u_boot_console, fs, x, part)
 
@@ -600,7 +607,7 @@
     for x in range(0, int(storage_device)):
         if devices[x]['detected'] == 'yes':
             u_boot_console.run_command('usb dev %d' % x)
-            for fs in ['fat', 'ext4']:
+            for fs in ['fat', 'ext2', 'ext4']:
                 try:
                     partitions = devices[x][fs]
                 except: