Changeset 15986
- Timestamp:
- Jan 2, 2008, 10:49:57 AM (18 years ago)
- Location:
- trunk/psModules/test
- Files:
-
- 7 edited
-
concepts/tap_pmConcepts.c (modified) (2 diffs)
-
concepts/tap_pmConceptsAverage.c (modified) (10 diffs)
-
concepts/tap_pmConceptsPhotcode.c (modified) (4 diffs)
-
config/Makefile.am (modified) (1 diff)
-
config/tap_pmConfig.c (modified) (51 diffs)
-
config/tap_pmConfigCommand.c (modified) (4 diffs)
-
config/tap_pmConfigMask.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/test/concepts/tap_pmConcepts.c
r14882 r15986 3 3 * @brief Contains the tests for pmConcepts.c: 4 4 * 5 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $6 * @date $Date: 200 7-09-18 18:59:30$5 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2008-01-02 20:49:56 $ 7 7 * pmConceptSpecAlloc() 8 8 pmConceptsList() … … 83 83 psLogSetLevel(PS_LOG_INFO); 84 84 psTraceSetLevel(".", ERR_TRACE_LEVEL); 85 plan_tests(1 0);85 plan_tests(126); 86 86 87 87 // -------------------------------------------------------------------- -
trunk/psModules/test/concepts/tap_pmConceptsAverage.c
r15650 r15986 82 82 cell->hdu = pmHDUAlloc("cellExtName"); 83 83 for (int i = 0 ; i < NUM_READOUTS ; i++) { 84 cell->readouts->data[i] = generateSimpleReadout(cell);84 cell->readouts->data[i] = psMemDecrRefCounter((psPtr) generateSimpleReadout(cell)); 85 85 } 86 86 … … 129 129 psArrayRealloc(chip->cells, NUM_CELLS); 130 130 for (int i = 0 ; i < NUM_CELLS ; i++) { 131 chip->cells->data[i] = generateSimpleCell(chip); 132 } 133 134 // XXX: Add code to initialize chip pmConcepts 135 136 131 chip->cells->data[i] = psMemDecrRefCounter((psPtr) generateSimpleCell(chip)); 132 } 137 133 return(chip); 138 134 } … … 153 149 psArrayRealloc(fpa->chips, NUM_CHIPS); 154 150 for (int i = 0 ; i < NUM_CHIPS ; i++) { 155 fpa->chips->data[i] = generateSimpleChip(fpa); 156 } 157 158 // XXX: Eventually, when you finish the pmConcepts tests, add full concept 159 // reading code from wherever. 151 fpa->chips->data[i] = psMemDecrRefCounter((psPtr) generateSimpleChip(fpa)); 152 } 160 153 pmConceptsBlankFPA(fpa); 161 // bool mdok;162 // psMetadata *fileData = psMetadataLookupMetadata(&mdok, fpa->hdu->format, "FILE");163 // char *fpaNameHdr = psMetadataLookupStr(&mdok, fileData, "FPA.NAME");164 // psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.NAME", PS_META_REPLACE, NULL, fpaNameHdr);165 166 154 return(fpa); 167 155 } 168 169 // XXX: This should only be necessary until the psFree() functions for170 // FPA/chip/cell/readout correctly free all child chips/cells/readouts171 void myFreeCell(pmCell *cell)172 {173 for (int k = 0 ; k < cell->readouts->n ; k++) {174 psFree(cell->readouts->data[k]);175 }176 psFree(cell);177 }178 179 void myFreeChip(pmChip *chip) {180 for (int j = 0 ; j < chip->cells->n ; j++) {181 myFreeCell(chip->cells->data[j]);182 }183 psFree(chip);184 }185 186 void myFreeFPA(pmFPA *fpa)187 {188 for (int i = 0 ; i < fpa->chips->n ; i++) {189 myFreeChip(fpa->chips->data[i]);190 }191 psFree(fpa);192 }193 194 156 195 157 … … 219 181 220 182 for (int fpaID = 0 ; fpaID < NUM_FPAS ; fpaID++) { 221 myFreeFPA(sourceFPA[fpaID]);183 psFree(sourceFPA[fpaID]); 222 184 } 223 185 psFree(sources); 224 myFreeFPA(targetFPA);186 psFree(targetFPA); 225 187 psFree(camera); 226 188 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 245 207 246 208 for (int fpaID = 0 ; fpaID < NUM_FPAS ; fpaID++) { 247 myFreeFPA(sourceFPA[fpaID]);209 psFree(sourceFPA[fpaID]); 248 210 } 249 211 psFree(sources); 250 myFreeFPA(targetFPA);212 psFree(targetFPA); 251 213 psFree(camera); 252 214 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 261 223 pmFPA *targetFPA = generateSimpleFPA(camera); 262 224 pmFPA *sourceFPA[NUM_FPAS]; 225 psMetadata *cameras[NUM_FPAS]; 263 226 264 227 // Ensure that the FPA.TIME average is computed correctly … … 266 229 psF64 actualTime = 0.0; 267 230 for (int fpaID = 0 ; fpaID < NUM_FPAS ; fpaID++) { 268 sourceFPA[fpaID] = generateSimpleFPA(camera); 231 cameras[fpaID] = psMetadataAlloc(); 232 sourceFPA[fpaID] = generateSimpleFPA(cameras[fpaID]); 269 233 psTime *fpaTime = psMetadataLookupPtr(NULL, (sourceFPA[fpaID])->concepts, "FPA.TIME"); 270 234 // Add a small value to the psTime so that we can test/ensure that pmConceptsAverageFPAs() … … 279 243 } 280 244 } 281 ok(pmConceptsAverageFPAs(targetFPA, sources), "pmConceptsAverage(NULL, sources) returned FALSE"); 245 // XXX: The memory leak occurs during the following single call 246 ok(pmConceptsAverageFPAs(targetFPA, sources), "pmConceptsAverage(targetFPA, sources) returned TRUE"); 282 247 actualTime/= (float) NUM_FPAS; 283 248 psTime *fpaTime = psMetadataLookupPtr(NULL, targetFPA->concepts, "FPA.TIME"); 284 249 ok(abs(actualTime - psTimeToMJD(fpaTime)) < 1e-4, "pmConceptsAverageFPAs() calculated the average time correctly"); 285 250 286 287 // Replace the FPA.TIMESYS with a non-conforming value, verify that pmConceptsAverageFPAs() returnes an error 251 // Replace the FPA.TIMESYS with a non-conforming value, verify that pmConceptsAverageFPAs() returns an error 252 288 253 psTimeType timeSys = psMetadataLookupS32(NULL, sourceFPA[0]->concepts, "FPA.TIMESYS"); 289 254 psMetadataAddS32(sourceFPA[NUM_FPAS-1]->concepts, PS_LIST_HEAD, "FPA.TIMESYS", PS_META_REPLACE, NULL, timeSys+10); … … 302 267 // Free data, check for memory leaks 303 268 for (int fpaID = 0 ; fpaID < NUM_FPAS ; fpaID++) { 304 myFreeFPA(sourceFPA[fpaID]); 269 psFree(sourceFPA[fpaID]); 270 psFree(cameras[fpaID]); 305 271 } 306 272 psFree(sources); 307 myFreeFPA(targetFPA); 273 // psFree(filter); 274 psFree(targetFPA); 308 275 psFree(camera); 309 276 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 310 277 } 311 312 313 278 314 279 // ---------------------------------------------------------------------- … … 461 426 psMetadataAddS32(srcCell->concepts, PS_LIST_HEAD, "CELL.Y0", PS_META_REPLACE, NULL, tmpS32); 462 427 463 myFreeFPA(tgtFPA);464 myFreeFPA(srcFPA);428 psFree(tgtFPA); 429 psFree(srcFPA); 465 430 psFree(tgtCamera); 466 431 psFree(srcCamera); -
trunk/psModules/test/concepts/tap_pmConceptsPhotcode.c
r14882 r15986 89 89 str[0] = "ARGS:"; 90 90 str[1] = "-site"; 91 // str[2] = "../dataFiles/SampleIPPConfig"; 91 92 str[2] = "../config/data/SampleIPPConfig"; 92 93 psS32 argc = 3; … … 97 98 pmFPAview *view = pmFPAviewAlloc(0); 98 99 100 skip_start(!config, 2, "Skipping tests because pmConfigRead() failed"); 99 101 bool rc; 100 102 psMetadata *recipe = psMetadataLookupPtr(&rc, config->recipes, "PPIMAGE"); … … 105 107 ok(testPhotcode, "pmConceptsPhotcodeForView(config, file, view) returned non-NULL"); 106 108 ok(!strcmp(goodPhotcode, testPhotcode), "pmConceptsPhotcodeForView() produced the correct string"); 109 skip_end(); 107 110 psFree(config); 108 111 psFree(file); … … 112 115 } 113 116 114 //HERE -
trunk/psModules/test/config/Makefile.am
r14880 r15986 21 21 SampleIPPConfig 22 22 23 SampleIPPConfig: data/SampleIPPConfig24 cp $? $@25 26 23 EXTRA_DIST = data 27 24 -
trunk/psModules/test/config/tap_pmConfig.c
r14880 r15986 20 20 * XXXX: Must determine what to do with NULL arguments, then test it. 21 21 * 22 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $23 * @date $Date: 200 7-09-18 18:55:36$22 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 23 * @date $Date: 2008-01-02 20:49:09 $ 24 24 * 25 25 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 31 31 #include "tap.h" 32 32 #include "pstap.h" 33 #define ERR_TRACE_LEVEL 033 #define ERR_TRACE_LEVEL 10 34 34 #define VERBOSE 0 35 35 … … 115 115 bool rc = pmConfigFileRead(&config, "SampleIPPConfig2", "DESCRIPTION"); 116 116 ok(rc == false, "pmConfigFileRead() returned FALSE before calling pmConfigSet()"); 117 pmConfigSet(" data/path2");117 pmConfigSet("../dataFiles/path2:dataFiles/path2"); 118 118 rc = pmConfigFileRead(&config, "SampleIPPConfig2", "DESCRIPTION"); 119 119 ok(rc == true, "pmConfigFileRead() returned TRUE after calling pmConfigSet() (test 1)"); … … 131 131 bool rc = pmConfigFileRead(&config, "SampleIPPConfig2", "DESCRIPTION"); 132 132 ok(rc == false, "pmConfigFileRead() returned FALSE before calling pmConfigSet()"); 133 pmConfigSet("junk: data/path2:data/path5");133 pmConfigSet("junk:../dataFiles/path2:dataFiles/path2:data/path5"); 134 134 rc = pmConfigFileRead(&config, "SampleIPPConfig2", "DESCRIPTION"); 135 135 ok(rc == true, "pmConfigFileRead() returned TRUE after calling pmConfigSet() (test 2)"); … … 148 148 psMemId id = psMemGetId(); 149 149 pmConfigSet("junk01"); 150 pmConfigSet("junk: data/path2:data/path5");150 pmConfigSet("junk:../dataFiles/path2:dataFiles/path2:data/path5"); 151 151 pmConfigSet("junk02"); 152 152 pmConfigDone(); … … 213 213 } 214 214 215 216 215 // Test with acceptable config file name, no paths 217 // This generates an error because config is non-NULL and pmConfigFileRead() 218 // psFrees it. Create a bugzilla report. 219 { 220 psMemId id = psMemGetId(); 221 psMetadata *config = psMetadataAlloc(); 222 psString name = "data/SampleIPPConfig"; 216 { 217 psMemId id = psMemGetId(); 218 psMetadata *config = NULL; 219 psString name = "../dataFiles/SampleIPPConfig"; 220 psString name2 = "dataFiles/SampleIPPConfig"; 223 221 psString desc = "DESCRIPTION"; 222 // First try to read data from ../dataFiles, then try dataFiles. 224 223 bool rc = pmConfigFileRead(&config, name, desc); 224 if (!rc) { 225 rc = pmConfigFileRead(&config, name2, desc); 226 } 225 227 ok(rc == true, "pmConfigFileRead() returned TRUE with acceptable inputs"); 226 228 … … 245 247 psMemId id = psMemGetId(); 246 248 psMetadata *config = NULL; 247 psString name = "data/SampleIPPConfig"; 249 psString name = "../dataFiles/SampleIPPConfig"; 250 psString name2 = "dataFiles/SampleIPPConfig"; 248 251 psString desc = "DESCRIPTION"; 249 252 bool rc = pmConfigFileRead(&config, name, desc); 253 if (!rc) { 254 rc = pmConfigFileRead(&config, name2, desc); 255 } 250 256 ok(rc == true, "pmConfigFileRead() returned TRUE with acceptable inputs"); 251 257 … … 265 271 } 266 272 273 267 274 // Test with acceptable config file name, no paths 268 275 { 269 276 psMemId id = psMemGetId(); 270 277 psMetadata *config = NULL; 271 psString name = "data/SampleIPPConfig"; 278 psString name = "../dataFiles/SampleIPPConfig"; 279 psString name2 = "dataFiles/SampleIPPConfig"; 272 280 psString desc = "DESCRIPTION"; 273 281 bool rc = pmConfigFileRead(&config, name, desc); 282 if (!rc) { 283 rc = pmConfigFileRead(&config, name2, desc); 284 } 274 285 ok(rc == true, "pmConfigFileRead() returned TRUE with acceptable inputs"); 275 286 … … 289 300 } 290 301 302 291 303 // Test with acceptable config file name, with path 292 304 // Note: This also tests the pmConfigSet() function. … … 296 308 psString name = "SampleIPPConfig2"; 297 309 psString desc = "DESCRIPTION"; 298 pmConfigSet(" data/path2");310 pmConfigSet("../dataFiles/path2:dataFiles/path2"); 299 311 bool rc = pmConfigFileRead(&config, name, desc); 300 312 ok(rc == true, "pmConfigFileRead() returned TRUE using paths"); … … 396 408 } 397 409 410 398 411 // Test with acceptable input 399 412 // psTraceSetLevel("psModules.config", 10); … … 404 417 psMetadata *header = psMetadataAlloc(); 405 418 psMetadata *camera = NULL; 406 bool rc = pmConfigFileRead(&camera, "data/camera0/format0.config", "Camera 0 Config File"); 407 ok(rc == true, "pmConfigFileRead() read data/camera0/format0.config"); 419 bool rc = pmConfigFileRead(&camera, "../dataFiles/camera0/format0.config", "Camera 0 Config File"); 420 if (!rc) { 421 rc = pmConfigFileRead(&camera, "dataFiles/camera0/format0.config", "Camera 0 Config File"); 422 } 423 ok(rc == true, "pmConfigFileRead() read ../dataFiles/camera0/format0.config"); 408 424 psMetadataAddStr(header, PS_LIST_TAIL, "F0_KEY0", 0, "", "string20"); 409 425 rc = pmConfigValidateCameraFormat(&valid, camera, header); … … 480 496 bool readRecipes = false; 481 497 // Load a sample config file 482 bool rc = pmConfigFileRead(&config->site, "data/SampleIPPConfig", "DESCRIPTION"); 498 bool rc = pmConfigFileRead(&config->site, "../dataFiles/SampleIPPConfig", "DESCRIPTION"); 499 if (!rc) { 500 rc = pmConfigFileRead(&config->site, "dataFiles/SampleIPPConfig", "DESCRIPTION"); 501 } 483 502 ok(rc == true && !config, "pmConfigFileRead() was successful"); 484 503 // Set metadata tags for a simulated FITS header … … 541 560 pmConfigSet("data"); 542 561 pmConfig *config = pmConfigAlloc(); 543 bool rc = pmConfigFileRead(&config->site, "data/SampleIPPConfig", "DESCRIPTION"); 562 bool rc = pmConfigFileRead(&config->site, "../dataFiles/SampleIPPConfig", "DESCRIPTION"); 563 if (!rc) { 564 rc = pmConfigFileRead(&config->site, "dataFiles/SampleIPPConfig", "DESCRIPTION"); 565 } 544 566 ok(rc == true, "pmConfigFileRead() was successful"); 545 567 psString cameraName = "CAMERA0"; … … 555 577 } 556 578 579 557 580 // -------------------------------------------------------------------- 558 581 // -------------------------------------------------------------------- … … 597 620 pmConfig *config = pmConfigAlloc(); 598 621 config->site = psMetadataAlloc(); 599 bool rc = pmConfigFileRead(&config->site, "data/SampleIPPConfig", "DESCRIPTION"); 622 bool rc = pmConfigFileRead(&config->site, "../dataFiles/SampleIPPConfig", "DESCRIPTION"); 623 if (!rc) { 624 rc = pmConfigFileRead(&config->site, "dataFiles/SampleIPPConfig", "DESCRIPTION"); 625 } 600 626 ok(rc == true, "pmConfigFileRead() was successful"); 601 627 skip_start(rc == false, 1, "Skipping pmConfigDB() tests because we could not read config file"); … … 608 634 } 609 635 636 637 610 638 // -------------------------------------------------------------------- 611 639 // -------------------------------------------------------------------- … … 652 680 psMetadata *header = psMetadataAlloc(); 653 681 psMetadata *format = psMetadataAlloc(); 654 bool rc = pmConfigFileRead(&format, "data/camera0/format0.config", "Camera 0 Config File"); 682 bool rc = pmConfigFileRead(&format, "../dataFiles/camera0/format0.config", "Camera 0 Config File"); 683 if (!rc) { 684 rc = pmConfigFileRead(&format, "dataFiles/camera0/format0.config", "Camera 0 Config File"); 685 } 655 686 ok(rc == true, "pmConfigFileRead() read camera format correctly"); 656 687 … … 680 711 str[0] = "ARGS:"; 681 712 str[1] = "-site"; 682 str[2] = " data/SampleIPPConfig";713 str[2] = "../dataFiles/SampleIPPConfig"; 683 714 char *filename = "FILENAME"; 684 715 char *list = "LIST"; 685 716 psArray *array = pmConfigFileSets(NULL, str, filename, list); 717 if (!array) { 718 str[2] = "dataFiles/SampleIPPConfig"; 719 array = pmConfigFileSets(NULL, str, filename, list); 720 } 686 721 ok(array == NULL, "pmConfigFileSets() returned NULL with NULL argc pointer"); 687 722 psErr *tmpErr = psErrorLast(); … … 700 735 str[0] = "ARGS:"; 701 736 str[1] = "-site"; 702 str[2] = " data/SampleIPPConfig";737 str[2] = "../dataFiles/SampleIPPConfig"; 703 738 int myArgc = -1; 704 739 char *filename = "FILENAME"; 705 740 char *list = "LIST"; 706 741 psArray *array = pmConfigFileSets(&myArgc, str, filename, list); 742 if (!array) { 743 str[2] = "dataFiles/SampleIPPConfig"; 744 array = pmConfigFileSets(&myArgc, str, filename, list); 745 } 707 746 ok(array == NULL, "pmConfigFileSets() returned NULL with negative argc pointer"); 708 747 psErr *tmpErr = psErrorLast(); … … 721 760 str[0] = "ARGS:"; 722 761 str[1] = "-site"; 723 str[2] = " data/SampleIPPConfig";762 str[2] = "../dataFiles/SampleIPPConfig"; 724 763 int myArgc = 3; 725 764 char *filename = "FILENAME"; … … 742 781 str[0] = "ARGS:"; 743 782 str[1] = "-site"; 744 str[2] = " data/SampleIPPConfig";783 str[2] = "../dataFiles/SampleIPPConfig"; 745 784 int myArgc = 3; 746 785 char *list = "LIST"; 747 786 psArray *array = pmConfigFileSets(&myArgc, str, NULL, list); 787 if (!array) { 788 str[2] = "dataFiles/SampleIPPConfig"; 789 array = pmConfigFileSets(&myArgc, str, NULL, list); 790 } 748 791 ok(array == NULL, "pmConfigFileSets() returned NULL with NULL filename pointer"); 749 792 psErr *tmpErr = psErrorLast(); … … 762 805 str[0] = "ARGS:"; 763 806 str[1] = "-site"; 764 str[2] = " data/SampleIPPConfig";807 str[2] = "../dataFiles/SampleIPPConfig"; 765 808 int myArgc = 3; 766 809 char *filename = "FILENAME"; 767 810 psArray *array = pmConfigFileSets(&myArgc, str, filename, NULL); 811 if (!array) { 812 str[2] = "dataFiles/SampleIPPConfig"; 813 array = pmConfigFileSets(&myArgc, str, filename, NULL); 814 } 768 815 ok(array == NULL, "pmConfigFileSets() returned NULL with NULL list pointer"); 769 816 psErr *tmpErr = psErrorLast(); … … 782 829 str[0] = "ARGS:"; 783 830 str[1] = "-site"; 784 str[2] = " data/SampleIPPConfig";831 str[2] = "../dataFiles/SampleIPPConfig"; 785 832 int myArgc = 3; 786 833 char *filename = "FILENAME"; 787 834 char *list = "LIST"; 788 835 psArray *array = pmConfigFileSets(&myArgc, str, filename, list); 836 if (!array) { 837 str[2] = "dataFiles/SampleIPPConfig"; 838 array = pmConfigFileSets(&myArgc, str, filename, list); 839 } 789 840 ok(array != NULL && psMemCheckArray(array), 790 841 "pmConfigFileSets() returned non-NULL with acceptable input data"); … … 806 857 str[0] = "ARGS:"; 807 858 str[1] = "-site"; 808 str[2] = " data/SampleIPPConfig";859 str[2] = "../dataFiles/SampleIPPConfig"; 809 860 int myArgc = 3; 810 861 char *name = "NAME"; … … 812 863 char *list = "LIST"; 813 864 bool rc = pmConfigFileSetsMD(NULL, &myArgc, str, name, file, list); 865 if (!rc) { 866 str[2] = "dataFiles/SampleIPPConfig"; 867 rc = pmConfigFileSetsMD(NULL, &myArgc, str, name, file, list); 868 } 814 869 ok(rc == false, "pmConfigFileSetsMD() returned FALSE with NULL metadata pointer"); 815 870 psErr *tmpErr = psErrorLast(); … … 830 885 str[0] = "ARGS:"; 831 886 str[1] = "-site"; 832 str[2] = " data/SampleIPPConfig";887 str[2] = "../dataFiles/SampleIPPConfig"; 833 888 int myArgc = 3; 834 889 char *file = "FILENAME"; 835 890 char *list = "LIST"; 836 891 bool rc = pmConfigFileSetsMD(metadata, &myArgc, str, NULL, file, list); 892 if (!rc) { 893 str[2] = "dataFiles/SampleIPPConfig"; 894 rc = pmConfigFileSetsMD(metadata, &myArgc, str, NULL, file, list); 895 } 837 896 ok(rc == false, "pmConfigFileSetsMD() returned FALSE with NULL name pointer"); 838 897 psErr *tmpErr = psErrorLast(); … … 854 913 str[0] = "ARGS:"; 855 914 str[1] = "-site"; 856 str[2] = " data/SampleIPPConfig";915 str[2] = "../dataFiles/SampleIPPConfig"; 857 916 int myArgc = 3; 858 917 char *name = "NAME"; 859 918 char *list = "LIST"; 860 919 bool rc = pmConfigFileSetsMD(metadata, &myArgc, str, name, NULL, list); 920 if (!rc) { 921 str[2] = "dataFiles/SampleIPPConfig"; 922 rc = pmConfigFileSetsMD(metadata, &myArgc, str, name, NULL, list); 923 } 861 924 ok(rc == false, "pmConfigFileSetsMD() returned FALSE with NULL file pointer"); 862 925 psErr *tmpErr = psErrorLast(); … … 878 941 str[0] = "ARGS:"; 879 942 str[1] = "-site"; 880 str[2] = " data/SampleIPPConfig";943 str[2] = "../dataFiles/SampleIPPConfig"; 881 944 int myArgc = 3; 882 945 char *name = "NAME"; 883 946 char *file = "FILENAME"; 884 947 bool rc = pmConfigFileSetsMD(metadata, &myArgc, str, name, file, NULL); 948 if (!rc) { 949 str[2] = "dataFiles/SampleIPPConfig"; 950 rc = pmConfigFileSetsMD(metadata, &myArgc, str, name, file, NULL); 951 } 885 952 ok(rc == false, "pmConfigFileSetsMD() returned FALSE with NULL list pointer"); 886 953 psErr *tmpErr = psErrorLast(); … … 902 969 str[0] = "ARGS:"; 903 970 str[1] = "-site"; 904 str[2] = " data/SampleIPPConfig";971 str[2] = "../dataFiles/SampleIPPConfig"; 905 972 int myArgc = 3; 906 973 char *name = "NAME"; … … 908 975 char *list = "LIST"; 909 976 bool rc = pmConfigFileSetsMD(metadata, &myArgc, str, name, file, list); 977 if (!rc) { 978 str[2] = "dataFiles/SampleIPPConfig"; 979 rc = pmConfigFileSetsMD(metadata, &myArgc, str, name, file, list); 980 } 910 981 ok(rc == true, "pmConfigFileSetsMD() returned TRUE with acceptable input data"); 911 982 psFree(metadata); … … 966 1037 967 1038 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 1039 // test with acceptable input data 983 1040 // First call with create==FALSE, and a filename that does not exist. … … 988 1045 char *filename = "file:///////JUNK"; 989 1046 pmConfig *config = pmConfigAlloc(); 990 bool rc = pmConfigFileRead(&config->site, "data/SampleIPPConfig", "DESCRIPTION"); 1047 bool rc = pmConfigFileRead(&config->site, "../dataFiles/SampleIPPConfig", "DESCRIPTION"); 1048 if (!rc) { 1049 rc = pmConfigFileRead(&config->site, "dataFiles/SampleIPPConfig", "DESCRIPTION"); 1050 } 991 1051 ok(rc == true, "pmConfigFileRead() was successful"); 992 1052 bool create = false; … … 1010 1070 str[0] = "ARGS:"; 1011 1071 str[1] = "-site"; 1012 str[2] = " data/SampleIPPConfig";1072 str[2] = "../dataFiles/SampleIPPConfig"; 1013 1073 pmConfig *myConfig = pmConfigRead(NULL, str, "RecipeName"); 1074 if (!myConfig) { 1075 str[2] = "dataFiles/SampleIPPConfig"; 1076 myConfig = pmConfigRead(NULL, str, "RecipeName"); 1077 } 1014 1078 ok(myConfig == NULL, "pmConfigRead() returned NULL with NULL argc pointer"); 1015 1079 psErr *tmpErr = psErrorLast(); … … 1045 1109 str[0] = "ARGS:"; 1046 1110 str[1] = "-site"; 1047 str[2] = " data/SampleIPPConfig";1111 str[2] = "../dataFiles/SampleIPPConfig"; 1048 1112 int numArgs = 3; 1049 1113 pmConfig *myConfig = pmConfigRead(&numArgs, str, NULL); 1114 if (!myConfig) { 1115 str[2] = "dataFiles/SampleIPPConfig"; 1116 myConfig = pmConfigRead(&numArgs, str, NULL); 1117 } 1050 1118 ok(myConfig != NULL, "pmConfigRead() returned non-NULL with NULL recipe"); 1051 1119 psErr *tmpErr = psErrorLast(); … … 1069 1137 str[0] = "ARGS:"; 1070 1138 str[1] = "-site"; 1071 str[2] = " data/SampleIPPConfig";1139 str[2] = "../dataFiles/SampleIPPConfig"; 1072 1140 psS32 argc = 3; 1073 1141 printf("----------------------------------------------------------------\n"); … … 1075 1143 bool rc; 1076 1144 pmConfig *myConfig = pmConfigRead(&argc, str, "RecipeName"); 1145 if (!myConfig) { 1146 str[2] = "dataFiles/SampleIPPConfig"; 1147 myConfig = pmConfigRead(&argc, str, "RecipeName"); 1148 } 1077 1149 ok(myConfig, "pmConfigRead() returned non-NULL"); 1078 1150 if (myConfig == NULL) { 1079 printf("TEST ERROR: pmConfigRead() returned NULL\n");1151 diag("TEST ERROR: pmConfigRead() returned NULL\n"); 1080 1152 testStatus = false; 1081 1153 } else { … … 1084 1156 // 1085 1157 if (1 != psTraceGetLevel("dummyTraceFunc01")) { 1086 printf("TEST ERROR: failed to properly set tracelevel for dummyTraceFunc01\n");1087 printf(" tracelevel was %d, should be 1.\n", psTraceGetLevel("dummyTraceFunc01"));1158 diag("TEST ERROR: failed to properly set tracelevel for dummyTraceFunc01\n"); 1159 diag(" tracelevel was %d, should be 1.\n", psTraceGetLevel("dummyTraceFunc01")); 1088 1160 testStatus = false; 1089 1161 } 1090 1162 1091 1163 if (2 != psTraceGetLevel("dummyTraceFunc02")) { 1092 printf("TEST ERROR: failed to properly set tracelevel for dummyTraceFunc02\n");1093 printf(" tracelevel was %d, should be 2.\n", psTraceGetLevel("dummyTraceFunc02"));1164 diag("TEST ERROR: failed to properly set tracelevel for dummyTraceFunc02\n"); 1165 diag(" tracelevel was %d, should be 2.\n", psTraceGetLevel("dummyTraceFunc02")); 1094 1166 testStatus = false; 1095 1167 } 1096 1168 1097 1169 if (1 != psLogGetDestination()) { 1098 printf("TEST ERROR: failed to properly set log destination.\n");1099 printf(" it was %d, should be 1\n", psLogGetDestination());1170 diag("TEST ERROR: failed to properly set log destination.\n"); 1171 diag(" it was %d, should be 1\n", psLogGetDestination()); 1100 1172 testStatus = false; 1101 1173 } 1102 1174 1103 1175 if (3 != psLogGetLevel()) { 1104 printf("TEST ERROR: failed to properly set log level.\n");1105 printf(" it was %d, should be 3\n", psLogGetLevel());1176 diag("TEST ERROR: failed to properly set log level.\n"); 1177 diag(" it was %d, should be 3\n", psLogGetLevel()); 1106 1178 testStatus = false; 1107 1179 } … … 1112 1184 psS32 tmpInt = psMetadataLookupS32(&rc, site, "ARBITRARY_STRING_S32"); 1113 1185 if ((rc == false) || (tmpInt != 20)) { 1114 printf("TEST ERROR: failed to properly set metadata integer ARBITRARY_STRING_S32.\n");1186 diag("TEST ERROR: failed to properly set metadata integer ARBITRARY_STRING_S32.\n"); 1115 1187 testStatus = false; 1116 1188 } … … 1118 1190 psF32 tmpFloat = psMetadataLookupS32(&rc, site, "ARBITRARY_STRING_F32"); 1119 1191 if ((rc == false) || (tmpFloat != 21.0)) { 1120 printf("TEST ERROR: failed to properly set metadata float ARBITRARY_STRING_F32.\n");1192 diag("TEST ERROR: failed to properly set metadata float ARBITRARY_STRING_F32.\n"); 1121 1193 testStatus = false; 1122 1194 } … … 1124 1196 psF64 tmpDub = psMetadataLookupS32(&rc, site, "ARBITRARY_STRING_F64"); 1125 1197 if ((rc == false) || (tmpDub != 22.0)) { 1126 printf("TEST ERROR: failed to properly set metadata double ARBITRARY_STRING_F64.\n");1198 diag("TEST ERROR: failed to properly set metadata double ARBITRARY_STRING_F64.\n"); 1127 1199 testStatus = false; 1128 1200 } … … 1131 1203 tmpBool = psMetadataLookupS32(&rc, site, "ARBITRARY_STRING_BOOL_T"); 1132 1204 if ((rc == false) || (tmpBool != true)) { 1133 printf("TEST ERROR: failed to properly set metadata double ARBITRARY_STRING_BOOL_T.\n");1205 diag("TEST ERROR: failed to properly set metadata double ARBITRARY_STRING_BOOL_T.\n"); 1134 1206 testStatus = false; 1135 1207 } 1136 1208 tmpBool = psMetadataLookupS32(&rc, site, "ARBITRARY_STRING_BOOL_F"); 1137 1209 if ((rc == false) || (tmpBool != false)) { 1138 printf("TEST ERROR: failed to properly set metadata double ARBITRARY_STRING_BOOL_F.\n");1210 diag("TEST ERROR: failed to properly set metadata double ARBITRARY_STRING_BOOL_F.\n"); 1139 1211 testStatus = false; 1140 1212 } … … 1145 1217 psMetadata *tmpMeta = psMetadataLookupMetadata(&rc, site, "CAMERAS"); 1146 1218 if (rc == false) { 1147 printf("TEST ERROR: failed to properly set metadata metadata CAMERAS.\n");1219 diag("TEST ERROR: failed to properly set metadata metadata CAMERAS.\n"); 1148 1220 testStatus = false; 1149 1221 } else { … … 1151 1223 tmpStr = psMetadataLookupStr(&rc, tmpMeta, "MEGACAM_RAW"); 1152 1224 if ((rc == false) || (0 != strcmp(tmpStr, "megacam_raw.config"))) { 1153 printf("TEST ERROR: failed to properly set metadata metadata CAMERAS->MEGACAM_RAW.\n");1225 diag("TEST ERROR: failed to properly set metadata metadata CAMERAS->MEGACAM_RAW.\n"); 1154 1226 testStatus = false; 1155 1227 } … … 1157 1229 tmpStr = psMetadataLookupStr(&rc, tmpMeta, "MEGACAM_SPLICE"); 1158 1230 if ((rc == false) || (0 != strcmp(tmpStr, "megacam_splice.config"))) { 1159 printf("TEST ERROR: failed to properly set metadata metadata CAMERAS->MEGACAM_SPLICE.\n");1231 diag("TEST ERROR: failed to properly set metadata metadata CAMERAS->MEGACAM_SPLICE.\n"); 1160 1232 testStatus = false; 1161 1233 } … … 1163 1235 tmpStr = psMetadataLookupStr(&rc, tmpMeta, "GPC1_RAW"); 1164 1236 if ((rc == false) || (0 != strcmp(tmpStr, "gpc1_raw.config"))) { 1165 printf("TEST ERROR: failed to properly set metadata metadata CAMERAS->GPC1_RAW.\n");1237 diag("TEST ERROR: failed to properly set metadata metadata CAMERAS->GPC1_RAW.\n"); 1166 1238 testStatus = false; 1167 1239 } … … 1169 1241 tmpStr = psMetadataLookupStr(&rc, tmpMeta, "LRIS_BLUE"); 1170 1242 if ((rc == false) || (0 != strcmp(tmpStr, "lris_blue.config"))) { 1171 printf("TEST ERROR: failed to properly set metadata metadata CAMERAS->LRIS_BLUE.\n");1243 diag("TEST ERROR: failed to properly set metadata metadata CAMERAS->LRIS_BLUE.\n"); 1172 1244 testStatus = false; 1173 1245 } … … 1175 1247 tmpStr = psMetadataLookupStr(&rc, tmpMeta, "LRIS_RED"); 1176 1248 if ((rc == false) || (0 != strcmp(tmpStr, "lris_red.config"))) { 1177 printf("TEST ERROR: failed to properly set metadata metadata CAMERAS->LRIS_RED.\n");1249 diag("TEST ERROR: failed to properly set metadata metadata CAMERAS->LRIS_RED.\n"); 1178 1250 testStatus = false; 1179 1251 } … … 1187 1259 tmpStr = psMetadataLookupStr(&rc, site, "DBSERVER"); 1188 1260 if ((rc == false) || (0 != strcmp(tmpStr, "ippdb.ifa.hawaii.edu"))) { 1189 printf("TEST ERROR: failed to properly set metadata string DBSERVER.\n");1261 diag("TEST ERROR: failed to properly set metadata string DBSERVER.\n"); 1190 1262 testStatus = false; 1191 1263 } … … 1193 1265 tmpStr = psMetadataLookupStr(&rc, site, "DBUSER"); 1194 1266 if ((rc == false) || (0 != strcmp(tmpStr, "ipp"))) { 1195 printf("TEST ERROR: failed to properly set metadata string DBUSER.\n");1267 diag("TEST ERROR: failed to properly set metadata string DBUSER.\n"); 1196 1268 testStatus = false; 1197 1269 } … … 1199 1271 tmpStr = psMetadataLookupStr(&rc, site, "DBPASSWORD"); 1200 1272 if ((rc == false) || (0 != strcmp(tmpStr, "password"))) { 1201 printf("TEST ERROR: failed to properly set metadata string DBPASSWORD.\n");1273 diag("TEST ERROR: failed to properly set metadata string DBPASSWORD.\n"); 1202 1274 testStatus = false; 1203 1275 } -
trunk/psModules/test/config/tap_pmConfigCommand.c
r14881 r15986 5 5 * This code will test the pmConfigCommand() routine. 6 6 * 7 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $8 * @date $Date: 200 7-09-18 18:58:52$7 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-01-02 20:49:09 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 37 37 str[0] = "ARGS:"; 38 38 str[1] = "-site"; 39 str[2] = " data/SampleIPPConfig";39 str[2] = "../dataFiles/SampleIPPConfig"; 40 40 psS32 argc = 3; 41 41 pmConfig *config = pmConfigRead(&argc, str, "RecipeName"); 42 if (!config) { 43 str[2] = "dataFiles/SampleIPPConfig"; 44 config = pmConfigRead(&argc, str, "RecipeName"); 45 } 42 46 ok(config != NULL, "pmConfigRead() successful"); 43 47 ok(!pmConfigDatabaseCommand(NULL, config), "pmConfigDatabaseCommand() returned NULL with NULL command input param"); … … 65 69 str[0] = "ARGS:"; 66 70 str[1] = "-site"; 67 str[2] = " data/SampleIPPConfig";71 str[2] = "../dataFiles/SampleIPPConfig"; 68 72 psS32 argc = 3; 69 73 pmConfig *config = pmConfigRead(&argc, str, "RecipeName"); 74 if (!config) { 75 str[2] = "dataFiles/SampleIPPConfig"; 76 config = pmConfigRead(&argc, str, "RecipeName"); 77 } 70 78 ok(config != NULL, "pmConfigRead() successful"); 71 79 char *testCmd = "command"; … … 82 90 str[0] = "ARGS:"; 83 91 str[1] = "-site"; 84 str[2] = " data/SampleIPPConfig";92 str[2] = "../dataFiles/SampleIPPConfig"; 85 93 psS32 argc = 3; 86 94 pmConfig *config = pmConfigRead(&argc, str, "RecipeName"); 95 if (!config) { 96 str[2] = "dataFiles/SampleIPPConfig"; 97 config = pmConfigRead(&argc, str, "RecipeName"); 98 } 87 99 ok(config != NULL, "pmConfigRead() successful"); 88 100 psString testCmd = psStringCopy("my command"); -
trunk/psModules/test/config/tap_pmConfigMask.c
r14882 r15986 5 5 * This code will test the pmConfigMask() routine. 6 6 * 7 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $8 * @date $Date: 200 7-09-18 18:58:56$7 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-01-02 20:49:10 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 25 25 psTraceSetLevel(".", 0); 26 26 psTraceSetLevel("err", ERR_TRACE_LEVEL); 27 plan_tests( 9);27 plan_tests(7); 28 28 29 29 … … 37 37 str[0] = "ARGS:"; 38 38 str[1] = "-site"; 39 str[2] = "data /SampleIPPConfig";39 str[2] = "dataFiles/SampleIPPConfig"; 40 40 psS32 argc = 3; 41 41 pmConfig *config = pmConfigRead(&argc, str, "RecipeName"); 42 if (!config) { 43 str[2] = "../dataFiles/SampleIPPConfig"; 44 config = pmConfigRead(&argc, str, "RecipeName"); 45 } 42 46 ok(config != NULL, "pmConfigRead() successful"); 43 47 ok(!pmConfigMask(NULL, config), "pmConfigMask() returned NULL with NULL masks input param"); … … 49 53 // Test pmConfigMask() with NULL pmConfig input param 50 54 // XXX: This fails on current CVS code because there is no assert in pmConfigMask() for a null pmConfig param 51 {55 if (0) { 52 56 psMemId id = psMemGetId(); 53 57 char *masks = "Mask0 Mask1 Mask2"; … … 61 65 { 62 66 psMemId id = psMemGetId(); 63 // See file TESTDIR/config/data/recipes_masks.config (67 // See file ../dataFiles/recipes_masks.config ( 64 68 char *masks = "DETECTOR RANGE"; 65 69 psMaskType correctMask = 0x02 | 0x04; … … 67 71 str[0] = "ARGS:"; 68 72 str[1] = "-site"; 69 str[2] = "data /SampleIPPConfig";73 str[2] = "dataFiles/SampleIPPConfig"; 70 74 psS32 argc = 3; 71 75 pmConfig *config = pmConfigRead(&argc, str, "RecipeName"); 76 if (!config) { 77 str[2] = "../dataFiles/SampleIPPConfig"; 78 config = pmConfigRead(&argc, str, "RecipeName"); 79 } 72 80 ok(config != NULL, "pmConfigRead() successful"); 81 skip_start(config == NULL, 2, "Skipping tests because pmConfigRead() failed"); 73 82 psMaskType mask = pmConfigMask(masks, config); 74 ok(mask, "pmConfigMask non-zero with acceptable input params");83 ok(mask, "pmConfigMask returned non-zero with acceptable input params"); 75 84 ok(mask == correctMask, "pmConfigMask() generated the correct output mask (%x). Should be (%x)", mask, correctMask); 85 skip_end(); 76 86 psFree(config); 77 87 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
Note:
See TracChangeset
for help on using the changeset viewer.
