[a80bf33] | 1 | Test de compribación de la libreria File No modifica nada |
---|
| 2 | ======================================== |
---|
| 3 | Este test NECESITA LA CACHE |
---|
| 4 | |
---|
| 5 | Comprobamos que existe CACHE |
---|
| 6 | $ ls -d $OGCAC$OGIMG # Este test NECESITA LA CACHE ############################## |
---|
| 7 | /opt/opengnsys/cache/opt/opengnsys/images |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | $ ogMakeDir CACHE prueba |
---|
| 11 | $ ls -d $OGCAC$OGIMG/prueba |
---|
| 12 | /opt/opengnsys/cache/opt/opengnsys/images/prueba |
---|
| 13 | |
---|
| 14 | $ touch $OGCAC$OGIMG/fichero_prueba |
---|
| 15 | $ ogCopyFile CACHE fichero_prueba CACHE prueba |
---|
| 16 | $ ls $OGCAC$OGIMG/prueba |
---|
| 17 | fichero_prueba |
---|
| 18 | |
---|
| 19 | $ ogGetPath CACHE fichero_prueba |
---|
| 20 | /opt/opengnsys/cache/opt/opengnsys/images/fichero_prueba |
---|
| 21 | |
---|
| 22 | # Si no existe el fichero |
---|
| 23 | $ ogGetPath CACHE fichero_prueba3; echo $? |
---|
| 24 | 1 |
---|
| 25 | |
---|
| 26 | $ ogGetParentPath CACHE fichero_prueba |
---|
| 27 | /opt/opengnsys/cache/opt/opengnsys/images |
---|
| 28 | |
---|
| 29 | # si el fichero no existe |
---|
| 30 | $ ogGetParentPath CACHE prueba/fichero_prueba3q23 |
---|
| 31 | /opt/opengnsys/cache/opt/opengnsys/images/prueba |
---|
| 32 | |
---|
| 33 | # Si dir padre no existe |
---|
| 34 | $ ogGetParentPath CACHE pruebaNO/fichero_prueba3; echo $? |
---|
| 35 | 1 |
---|
| 36 | |
---|
| 37 | $ AUX=$(ogCalculateChecksum $OGCAC$OGIMG/fichero_prueba); AUX2=$(md5sum $OGCAC$OGIMG/fichero_prueba| cut -f1 -d\ ); if [ "$AUX" == "$AUX2" ]; then echo si; else echo no; fi |
---|
| 38 | si |
---|
| 39 | |
---|
| 40 | $ ogCompareChecksumFiles CACHE fichero_prueba CACHE prueba/fichero_prueba; echo $? |
---|
| 41 | 0 |
---|
| 42 | |
---|
| 43 | $ echo 333 >> $OGCAC$OGIMG/fichero_prueba2 |
---|
| 44 | $ ogMakeChecksumFile CACHE fichero_prueba2 |
---|
| 45 | $ ls $OGCAC$OGIMG/fichero_prueba2.sum |
---|
| 46 | /opt/opengnsys/cache/opt/opengnsys/images/fichero_prueba2.sum |
---|
| 47 | |
---|
| 48 | $ ogMakeChecksumFile CACHE prueba/fichero_prueba |
---|
| 49 | $ ogCompareChecksumFiles CACHE fichero_prueba2 CACHE prueba/fichero_prueba; echo $? |
---|
| 50 | 1 |
---|
| 51 | |
---|
| 52 | $ ogIsNewerFile CACHE fichero_prueba2 CACHE prueba/fichero_prueba; echo $? |
---|
| 53 | 0 |
---|
| 54 | |
---|
| 55 | $ ogIsNewerFile CACHE prueba/fichero_prueba CACHE fichero_prueba2; echo $? |
---|
| 56 | 1 |
---|
| 57 | |
---|
| 58 | $ ogIsNewerFile CACHE fichero_prueba CACHE prueba/fichero_prueba; echo $? |
---|
| 59 | 1 |
---|
| 60 | |
---|
| 61 | $ ogDeleteTree CACHE prueba |
---|
| 62 | $ ls -d $OGCAC$OGIMG/prueba |
---|
| 63 | ls: cannot access /opt/opengnsys/cache/opt/opengnsys/images/prueba: No such file or directory |
---|
| 64 | |
---|
| 65 | $ ogDeleteFile CACHE fichero_prueba |
---|
| 66 | $ ls $OGCAC$OGIMG/fichero_prueba |
---|
| 67 | ls: cannot access /opt/opengnsys/cache/opt/opengnsys/images/fichero_prueba: No such file or directory |
---|
| 68 | |
---|
| 69 | # Limpiamos el directorio |
---|
| 70 | $ rm -rf $OGCAC$OGIMG/fichero_prueba2* $OGCAC$OGIMG/prueba2 |
---|
| 71 | |
---|
| 72 | |
---|
| 73 | MEJORAS |
---|
| 74 | ======= |
---|
| 75 | ogCompareChecksumFiles -> si no existen los ficheros de Checksum da verdadero. Deberia dar falso |
---|