Commit 97bbed76 authored by Andrea Orlat's avatar Andrea Orlat
Browse files

if the schedule file is missing a more meaningful error is returned

parent 5afd1189
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -104,4 +104,6 @@

<ErrorCode name="InvalidRestFrequency" shortDescription="The rest frequency is not provided or does not match the number of backend sections" description=""/>

<ErrorCode name="ScheduleNotExist" shortDescription="Schedule could not be found" description=""/>

</Type>
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ public:
			}
		}
		if (queue.pushBack(1)) return ::testing::AssertionFailure() << " insertion should have failed because of container limits";
		if (!queue.isFull()) return ::testing::AssertionFailure() << " ithe container should be full";
		if (!queue.isFull()) return ::testing::AssertionFailure() << " the container should be full";
		return ::testing::AssertionSuccess();
	}

+4 −0
Original line number Diff line number Diff line
@@ -130,6 +130,8 @@ public:
	CColumnEntry(const IRA::CString& name,const IRA::CString& unit,const long& multiplicity,const long& table,const long& rowref):
		CEntry(name,unit,T::format,multiplicity,table,MULTI,T::typeSpec), m_row(rowref)
	{
		m_cache.reserve(_FILE_ENTRY_CACHE_SIZE+1);
		m_outBuffer.reserve(_FILE_ENTRY_CACHE_SIZE+1);
		m_cache.resize(_FILE_ENTRY_CACHE_SIZE);
		initCache();
	};
@@ -476,7 +478,9 @@ public:

	void addDataColumn(const long& tableId,const IRA::CString& baseName,const IRA::CString& desc) {
		IRA::CString err;
		//cout << "nome : " << (const char *)baseName << endl;
		CTable *tab=getTable(tableId,err);
		//cout << "tabella : " << tab << endl;
		if (tab) {
			tab->allocateDataColumn(baseName,desc);
		}
+53 −0
Original line number Diff line number Diff line
@@ -8,12 +8,28 @@ public:
		std::vector<long> dim;
		RecordProperty("description","check if a fits file can be opened correctly (file + binary tables)");
		FitsWriter_private::CTable *tab=file->getTable(2,errorMsg);
		FitsWriter_private::CTable *tab1=file->getTable(3,errorMsg);
		if (!tab) {
			return ::testing::AssertionFailure() << "table 2 could not be collected";
		}
		if (!tab1) {
			return ::testing::AssertionFailure() << "table 3 could not be collected";
		}
		if (!tab->defineDataColumn("Ch",dim,errorMsg)) {
			return ::testing::AssertionFailure() << "data column dimensioning failed with message: " << (const char *)errorMsg;
		}
		dim.push_back(4096);
		dim.push_back(1);
		dim.push_back(8192);
		if (!tab->defineDataColumn("Ch",dim,errorMsg)) {
			return ::testing::AssertionFailure() << "data column dimensioning failed with message: " << (const char *)errorMsg;
		}
		dim.clear();
		dim.push_back(1);
		dim.push_back(1);
		if (!tab1->defineDataColumn("data",dim,errorMsg)) {
			return ::testing::AssertionFailure() << "data column dimensioning failed with message: " << (const char *)errorMsg;
		}
		if (!file->open(errorMsg)) {
			return ::testing::AssertionFailure() << "file creation failed with message: " << (const char *)errorMsg;
		}
@@ -159,6 +175,43 @@ public:
		return ::testing::AssertionSuccess();
	}

	::testing::AssertionResult File_writeTableSpeed() {
		IRA::CString errorMsg;
		long xdata=1;

		double data0,data1;
		data0=1.23;
		data1=565.11;
		TIMEVALUE startTime,stopTime;
		RecordProperty("description","check execution time for large amount of data");
		FitsWriter_private::CTable *tab=file->getTable("RawTable",errorMsg);
		if (!tab) {
			return ::testing::AssertionFailure() << "table " << "RawTable" << " cannot be found, " << (const char *)errorMsg;
		}
		IRA::CIRATools::getTime(startTime);
		for (unsigned k=0;k<220000;k++) {
			if (!tab->setColumn<_FILE_LONG_TYPE>("X",xdata,errorMsg)) {
				return ::testing::AssertionFailure() << "column " << "X" << " cannot be written, message is " << (const char *)errorMsg;
			}
			if (!tab->setDataColumn("data0",data0,errorMsg)) {
				return ::testing::AssertionFailure() << "column " << "data0" << " cannot be written, message is " << (const char *)errorMsg;
			}
			if (!tab->setDataColumn("data1",data1,errorMsg)) {
				return ::testing::AssertionFailure() << "column " << "data1" << " cannot be written, message is " << (const char *)errorMsg;
			}
			xdata++;
			//this will add a blank row at the end of the table when table is flushed at the end....but no issue for this test
			if (!tab->nextRow(errorMsg)) {
				return ::testing::AssertionFailure() << "cannot add row " << k << " in table, message is " << (const char *)errorMsg;
			}
		}
		IRA::CIRATools::getTime(stopTime);
		//double sec=(stopTime.value().value-startTime.value().value)/10000000.0;
		//cout << "tempo impiegato " << sec << "secondi" << endl;
		return ::testing::AssertionSuccess();
	}


protected:
	static FitsWriter_private::CFile *file;

+11 −7
Original line number Diff line number Diff line
@@ -4,16 +4,16 @@
/* This code is under GNU General Public Licence (GPL).                                                          */
/*                                                                                                               */
/* Who                                    when            What                                                   */
/* Andrea Orlati (a.orlati@ira.inaf.it)   13/08/2015
/* Andrea Orlati (a.orlati@ira.inaf.it)   10/08/2015
*/

#ifndef SUMMARYSCHEMA_H_
#define SUMMARYSCHEMA_H_
#ifndef TESTSCHEMA_H_
#define TESTSCHEMA_H_

#define SCHEMA_HEADER_ENTRY_NUMBER 5
#define SCHEMA_TABLE_NUMBER 2
#define SCHEMA_COLUMN_NUMBER 7
#define SCHEMA_DATA_COLUMN_NUMBER 1
#define SCHEMA_TABLE_NUMBER 3
#define SCHEMA_COLUMN_NUMBER 8
#define SCHEMA_DATA_COLUMN_NUMBER 2

#define SCHEMA_HEADER_ENTRY1 ( 0, _FILE_STRING_TYPE,_FILE_SINGLE_ENTRY,"TELESCOP","Telescope name" )
#define SCHEMA_HEADER_ENTRY2 ( 0, _FILE_STRING_TYPE,_FILE_SINGLE_ENTRY,"ReceiverCode","Receiver name" )
@@ -32,8 +32,12 @@
#define SCHEMA_COLUMN7 ( 2, _FILE_DOUBLE_TYPE, 2, "Y", "kelvin" )
#define SCHEMA_DATA_COLUMN1 ( 2, "Ch", "section raw data")

#define SCHEMA_TABLE3 ( "RawTable", 3 )
#define SCHEMA_COLUMN8 ( 3, _FILE_LONG_TYPE, 1, "X","sample number" )
#define SCHEMA_DATA_COLUMN2 ( 3, "data", "raw data")


#define SCHEMA_HEADER_ENTRY5 ( 1, _FILE_DOUBLE_TYPE,_FILE_MULTI_ENTRY,"test","test keyword" )


#endif /* SUMMARYSCHEMA_H_ */
#endif /* TESTSCHEMA_H_ */
Loading