Commit 46ba9642 authored by Marco Buttu's avatar Marco Buttu
Browse files

Merge branch 'latest64' of https://github.com/discos/discos into fix-issue-143

parents 86174fe2 f61202ea
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -798,7 +798,8 @@ bool CIRATools::radToAngle(const double& rad,IRA::CString& outString)

bool CIRATools::longitudeToRad(const IRA::CString& lon,double& rad,bool complete,char delimiter)
{
	long len=lon.GetLength();
	//long len=lon.GetLength();
	int len=lon.GetLength();
	bool res;
	if (len==0) return false;
	if (lon[len-1]=='d') {
@@ -818,7 +819,8 @@ bool CIRATools::longitudeToRad(const IRA::CString& lon,double& rad,bool complete

bool CIRATools::latitudeToRad(const IRA::CString& lat,double& rad,bool complete,char delimiter)
{
	long len=lat.GetLength();
	//long len=lat.GetLength();
	int len=lat.GetLength();
	bool res;
	if (len==0) return false;
	if (lat[len-1]=='d') {
@@ -837,7 +839,8 @@ bool CIRATools::latitudeToRad(const IRA::CString& lat,double& rad,bool complete,

bool CIRATools::rightAscensionToRad(const IRA::CString& ra,double& rad,bool complete,char delimiter)
{
	long len=ra.GetLength();
	//long len=ra.GetLength();
	int len=ra.GetLength();	
	bool res;
	if (len==0) return false;
	if (ra[len-1]=='d') {
@@ -865,7 +868,8 @@ bool CIRATools::declinationToRad(const IRA::CString& dec,double& rad,bool comple

bool CIRATools::galLongitudeToRad(const IRA::CString& lon,double& rad,bool complete,char delimiter)
{
	long len=lon.GetLength();
	//long len=lon.GetLength();
	int len=lon.GetLength();
	bool res;
	if (len==0) return false;
	if (lon[len-1]=='d') {
@@ -909,7 +913,8 @@ bool CIRATools::elevationToRad(const IRA::CString& el,double& rad,bool complete)

bool CIRATools::offsetToRad(const IRA::CString& offset,double& rad,char delimiter)
{
	long len=offset.GetLength();
	//long len=offset.GetLength();
	int len=offset.GetLength();
	bool res;
	if (len==0) return false;
	if (offset[len-1]=='d') {
+8 −1
Original line number Diff line number Diff line
@@ -169,7 +169,14 @@ CSocket::OperationResult CSocket::Connect(CError& Err,CString IPAddr,WORD Port)
		if (!connect(m_iSocket,(struct sockaddr *)&addr,sizeof(struct sockaddr))) {
			return SUCCESS;
		}
		else if ((errno==EINPROGRESS) || (errno==EALREADY) && (getMode()==NONBLOCKING)) {
		/*
			migration to 64 bits. the older If statement was warned by the compiler. The suggestion was to add a parenthesis.
			"else if ((errno==EINPROGRESS) || (errno==EALREADY) && (getMode()==NONBLOCKING)) {"
			The general rule of operator precedence is && before !!. Tha new code cahnges this an so changes radically what this code is doing.
			The new code reflects what I think it should do (evaluate || before &&).
			
		*/
		else if (((errno==EINPROGRESS) || (errno==EALREADY)) && (getMode()==NONBLOCKING)) {
			if ((m_wAsyncFlag&E_CONNECT)==E_CONNECT) setStatus(CONNECTING);
			return WOULDBLOCK;
		}
+34 −0
Original line number Diff line number Diff line
#*****************************************
#-----------------------------------------
# Marco Buttu <mbuttu@oa-cagliari.inaf.it>
#-----------------------------------------
#*****************************************

PY_PACKAGES = testing

# -----------------
# Include Standards
# -----------------

MAKEDIRTMP := $(shell searchFile include/acsMakefile)
ifneq ($(MAKEDIRTMP),\#error\#)
   MAKEDIR := $(MAKEDIRTMP)/include
   include $(MAKEDIR)/acsMakefile
endif


# TARGETS
all:	do_all
	@echo " . . . 'all' done" 

clean : clean_all 
	$(RM) *.pyc testing/*.pyc
	$(RM) ../lib ../bin ../config ../doc ../idl ../include \
		  ../object ../rtai ../test
	$(RM) $(INTROOT)/lib/python/site-packages/testing*
	@echo " . . . clean done"

install : install_all
	@echo " . . . installation done"

#___oOo___
+0 −0

Empty file added.

+41 −0
Original line number Diff line number Diff line
import os
import time
import datetime
from subprocess import Popen, PIPE

__author__ = "Marco Buttu <mbuttu@oa-cagliari.inaf.it>"


ACSDATA = os.getenv('ACSDATA')
logfile = os.path.join(ACSDATA, 'logs', 'testing.log')


class Container(object):

    def __init__(self, name, lang):
        self.name = name
        self.lang = lang

    def start(self):
        with open(logfile, 'a') as outfile:
            Popen(
                ['acsStartContainer', '-%s' % self.lang, self.name],
                stdout=outfile)

    def stop(self):
        with open(logfile, 'a') as outfile:
            p = Popen(['acsStopContainer', self.name], stdout=outfile)
            p.wait()  # Block until acsStopContainer exits

    def wait_until_running(self, timeout=10):
        t0 = datetime.datetime.now()
        while (datetime.datetime.now() - t0).seconds < timeout:
            if self.is_running():
                break
            else:
                time.sleep(0.5)

    def is_running(self):
        pipes = Popen(['acsContainersStatus'], stdout=PIPE, stderr=PIPE)
        out, err = pipes.communicate()
        return ('%s container is running' % self.name) in out
Loading