From c73cf605867976f6d7dfe756dcad985dee52b726 Mon Sep 17 00:00:00 2001 From: hn06511 Date: Mon, 21 May 2018 13:53:49 -0700 Subject: [PATCH 1/1] Various changes Clearcase.pm: . Set VIEW_DRIVE properly . Changed CCHOME (this keeps moving around) . Was not checking for Windows properly - fixed GD: . Various changes and paths Logger.pm: . The err method should use the msg method instead of the log method so that the user sees the error! --- bin/rexec.pl | 2 +- data/allmach | 0 lib/Clearcase.pm | 8 +- lib/Logger.pm | 2 +- maps/bin/checkaddress.cgi | 0 rc/client_scripts/GD | 32 ++++---- rc/set_path | 4 +- test/testclearcase.conf | 18 +++-- test/testclearcase.pl | 160 +++++++++++++++++++++++++++++++++----- test/testclearquest.pl | 154 ++++++++++++++++++------------------ web/favicon.ico | Bin 11 files changed, 253 insertions(+), 127 deletions(-) mode change 100755 => 100644 bin/rexec.pl mode change 100755 => 100644 data/allmach mode change 100755 => 100644 maps/bin/checkaddress.cgi mode change 100755 => 100644 test/testclearcase.conf mode change 100755 => 100644 test/testclearcase.pl mode change 100755 => 100644 test/testclearquest.pl mode change 100755 => 100644 web/favicon.ico diff --git a/bin/rexec.pl b/bin/rexec.pl old mode 100755 new mode 100644 index 1770744..4cc0eff --- a/bin/rexec.pl +++ b/bin/rexec.pl @@ -36,7 +36,7 @@ $Date: 2008/02/29 15:09:15 $ [-use|rname ] [-p|assword ] [-log] -m|achines ,,... - + Where: diff --git a/data/allmach b/data/allmach old mode 100755 new mode 100644 diff --git a/lib/Clearcase.pm b/lib/Clearcase.pm index a845184..81822dd 100644 --- a/lib/Clearcase.pm +++ b/lib/Clearcase.pm @@ -82,7 +82,7 @@ use Display; my ($clearpid, $clearin, $clearout, $oldHandler, $cleartool); -our $VIEW_DRIVE = 'M'; +our $VIEW_DRIVE = $ENV{CLEARCASE_VIEW_DRIVE} || 'M'; our $VOB_MOUNT = 'vob'; our $WIN_VOB_PREFIX = '\\'; our $SFX = $ENV{CLEARCASE_XN_SFX} ? $ENV{CLEARCASE_XN_SFX} : '@@'; @@ -118,9 +118,9 @@ BEGIN { # We can go to the registry pretty easy in Cygwin but I'm not sure how to do # that in plain old Windows. Most people either have Clearcase installed on # the C drive or commonly on the D drive on servers. So we'll look at both. - $CCHOME = 'C:\\IBMRational\\RationalSDLC\\Clearcase'; + $CCHOME = 'C:\\Program Files (x86)\\ibm\\RationalSDLC\\Clearcase'; - $CCHOME = 'D:\\IBMRational\\RationalSDLC\\Clearcase' + $CCHOME = 'D:\\Program Files (x86)\\ibm\\RationalSDLC\\Clearcase' unless -d $CCHOME; error 'Unable to figure out where Clearcase is installed', 1 @@ -579,7 +579,7 @@ Array of output lines from the cleartool command execution. # to use these Clearcase objects say in a web page where the server is often # run as a plain user who does not have cleartool in their path. unless ($cleartool) { - if ($ARCHITECTURE =~ /Win/ or $ARCHITECTURE eq 'cygwin') { + if ($ARCHITECTURE =~ /Win/i or $ARCHITECTURE eq 'cygwin') { $cleartool = 'cleartool'; } elsif (-x '/opt/rational/clearcase/bin/cleartool') { $cleartool = '/opt/rational/clearcase/bin/cleartool'; diff --git a/lib/Logger.pm b/lib/Logger.pm index 68fa897..e1fe824 100644 --- a/lib/Logger.pm +++ b/lib/Logger.pm @@ -513,7 +513,7 @@ Returns: $msg = "ERROR: $msg"; } # if - $self->log ($msg); + $self->msg($msg); $self->incrementErr; diff --git a/maps/bin/checkaddress.cgi b/maps/bin/checkaddress.cgi old mode 100755 new mode 100644 diff --git a/rc/client_scripts/GD b/rc/client_scripts/GD index b1d2f56..944061c 100644 --- a/rc/client_scripts/GD +++ b/rc/client_scripts/GD @@ -14,11 +14,13 @@ ################################################################################ umask 002 -export SITE_PERLLIB=/cleartrig/ent/SNSD/muos/ccadm_tools/vobs/ranccadm/scripts/lib -export PATH=/cleartrig/ent/SNSD/muos/ccadm_tools/vobs/ranccadm/scripts/clearcase:$PATH +if [ -d /cleartrig/ent/SNSD/muos/ccadm_tools/vobs/ranccadm/scripts/lib ]; then + export PERL5LIB=/cleartrig/ent/SNSD/muos/ccadm_tools/vobs/ranccadm/scripts/lib:$PERL5LIB +fi -export http_proxy=webgate0.gddsi.com:8080 -export ftp_proxy=webgate0.gddsi.com +# This no longer work +#export http_proxy=webgate0.gddsi.com:8080 +#export ftp_proxy=webgate0.gddsi.com export QTDIR="/usr/local/Trolltech/Qt-4.2.2" export QMAKESPEC="$QTDIR/mkspecs/solaris-cc" @@ -29,7 +31,6 @@ export CCASE_MAKE_COMPAT=gnu export CQ_HELP_BROWSER=firefox export CQ_PERLLIB=/opt/rational/common/lib/perl5/5.6.1/sun4-solaris-multi:/opt/rational/common/lib/perl5/5.6.1:/opt/rational/common/lib/perl5/site_perl/5.6.1/sun4-solaris-multi:/opt/rational/common/lib/perl5/site_perl/5.6.1:/opt/rational/common/lib/perl5/site_perl -export PERL5LIB=/cleartrig/ent/SNSD/muos/ccadm_tools/vobs/ranccadm/scripts/lib:$PERL5LIB export TZ="US/Arizona" @@ -39,10 +40,6 @@ export RSU_LICENSE_MAP="/prj/muosran/config/Rational_License_Map" export LM_LICENSE_FILE="1850@ma06app30:flex2:1850@flex2:15280@ranadm2:19353@ranadm2:19355@ranadm2:2468@ranadm2:1717@flex2:1711@bartlett:1711@flex3:27000@ranadm2:28000@ranadm2:5270@flex2" -alias xemacs="ssh muosbldforge2 xemacs" - -export EDITOR="ssh muosbldforge2 xemacs" - if [ $(uname) = "SunOS" ]; then export QTDIR=/usr/local/Trolltech/Qt-4.2.2 export ORACLE_HOME="/usr/local/oracle/product/9.2" @@ -53,13 +50,18 @@ elif [ $(uname) = "Linux" ]; then export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/X11R6/lib fi +# Where the Clearcase view drive is on Windows +export CLEARCASE_VIEW_DRIVE=X + # Additional paths... -append_to_path "/c/Program Files/IBM/RationalSDLC/common" -append_to_path "/d/Program Files/IBM/RationalSDLC/common" -append_to_path "/c/Program Files/IBM/RationalSDLC/Clearquest/cqcli/bin" -append_to_path "/d/Program Files/IBM/RationalSDLC/Clearquest/cqcli/bin" -append_to_path "/c/Program Files/IBM/RationalSDLC/ClearCase/bin" -append_to_path "/d/Program Files/IBM/RationalSDLC/ClearCase/bin" +append_to_path "/cleartrig/ent/SNSD/muos/ccadm_tools/vobs/ranccadm/scripts/clearcase" +append_to_path "/cygcrive/c/Program Files/IBM/RationalSDLC/common" +append_to_path "/cygcrive/d/Program Files/IBM/RationalSDLC/common" +append_to_path "/cygcrive/c/Program Files/IBM/RationalSDLC/Clearquest/cqcli/bin" +append_to_path "/cygcrive/d/Program Files/IBM/RationalSDLC/Clearquest/cqcli/bin" +append_to_path "/cygcrive/c/Program Files/IBM/RationalSDLC/ClearCase/bin" +append_to_path "/cygcrive/d/Program Files/IBM/RationalSDLC/ClearCase/bin" +append_to_path "/cygdrive/c/Program Files (x86)/ibm/gsk8/lib" # Common CDPATHS CDPATH=$CDPATH:/vobs/ranccadm diff --git a/rc/set_path b/rc/set_path index 10a4179..b9b6ed3 100644 --- a/rc/set_path +++ b/rc/set_path @@ -112,7 +112,7 @@ path_dirs="$path_dirs\ /tools/bin\ $systemroot/System32\ $systemroot\ -" +" manpath_dirs="\ /usr/share/man\ @@ -126,7 +126,7 @@ manpath_dirs="\ /opt/ssh/man\ /opt/medusa/share/man\ /usr/afsws/man\ -" +" PATH= for component in $path_dirs; do diff --git a/test/testclearcase.conf b/test/testclearcase.conf old mode 100755 new mode 100644 index c240d95..b58626e --- a/test/testclearcase.conf +++ b/test/testclearcase.conf @@ -1,8 +1,8 @@ ################################################################################ # -# File: testcc.conf +# File: testclearcase.conf # Revision: 2.0 -# Description: Parameters for testcc +# Description: Parameters for testclearcse.pl # # Author: Andrew@DeFaria.com # Created: Thu Sep 6 14:05:55 MST 2007 @@ -12,10 +12,12 @@ # (c) Copyright 2007, Andrew@DeFaria.com, all rights reserved. # ################################################################################# -vobhost: gdvob1 -vobpath: /net/$vobhost -vobstore: $vobpath/local/gdvob1a +# Note this conf file is set up for Windows... +vobhost: az251dp2ch2d +vobpath: //$vobhost +vobstore: $vobpath/temp -viewhost: view2 -viewpath: /net/$viewhost -viewstore: $viewpath/local/view2c +viewhost: az251dp2ch2d +viewpath: //$vobhost +viewdrive: x: +viewstore: $viewpath/viewstore diff --git a/test/testclearcase.pl b/test/testclearcase.pl old mode 100755 new mode 100644 index 512d372..545f3d0 --- a/test/testclearcase.pl +++ b/test/testclearcase.pl @@ -43,6 +43,17 @@ $Date: 2011/01/09 01:01:32 $ -[no]uc|m: Perform UCM Clearcase tests (Default: noucm) -[no]clean: Cleanup after yourself (Default: clean) +if -ucm is specified then the following additional parameters should be set: + + -username: Username to connect to Clearquest with (Can set CQ_USERNAME) + -password: Password to use to connect to Clearquest (CQ_PASSWORD) + -weburl: Web URL to use for enabling Clearcase -> Clearquest + connection (CQ_WEBURL - Do not specify the trailing + "/oslc") + -database: Clearquest database to enable (CQ_DATABASE) + -dbset: Clearquest DBSet (CQ_DBSET) + -provider: Name of provider (Default: CQPROV) + =head1 DESCRIPTION Clearcase smoke tests. Perform simple Clearcase operations to validate that @@ -58,7 +69,7 @@ use warnings; use Cwd; use FindBin; use Getopt::Long; -#use Term::ANSIColor qw(:constants); +use Pod::Usage; use lib "$FindBin::Bin/../lib"; @@ -120,11 +131,20 @@ sub LogOpts() { ); for (sort keys %opts) { + next if /help/ || /usage/ || /password/; + if (ref $opts{$_} eq 'ARRAY') { my $name = $_; - $log->msg("$name:\t$_") for @{$opts{$_}}; + + for (@{$opts{$_}}) { + $log->msg("$name:\t$_") if $_; + } # for } else { - $log->msg("$_:\t$opts{$_}"); + if ($opts{$_}) { + $log->msg("$_:\t$opts{$_}"); + } else { + $log->msg("$_:\t"); + } # if } # if } # for @@ -188,14 +208,28 @@ sub DestroyVob($) { ($status, @output) = $Clearcase::CC->execute('cd'); + $log->err('Unable to perform cd command', 1) if $status; + $log->msg('Unmounting vob ' . $vob->tag); ($status, @output) = $vob->umount; + if ($status) { + $log->err('Unable to unmount vob ' . $vob->tag); + } else { + $log->msg('Umounted vob ' . $vob->tag); + } # if + $log->msg('Removing vob ' . $vob->tag); ($status, @output) = $vob->remove; + if ($status) { + $log->err("Failed to execute command " . + $Clearcase::CC->lastcmd . "\n" . + join "\t\n", @output); + } # if + $log->log($_) for @output; return $status; @@ -227,6 +261,18 @@ sub SetView($) { return $status; } # SetView +sub StopView($) { + my ($view) = @_; + + $log->msg('Stopping view ' . $view->tag); + + my ($status, @output) = $view->stop; + + $log->log($_) for @output; + + return $status; +} # StopView + sub DestroyView($) { my ($view) = @_; @@ -446,7 +492,7 @@ sub CleanupUCM() { ($rc, @output) = $test_activity->remove; $status += $rc; - + $log->log($_) for @output; # Need to remove baselines from streams first using rebase (Devstream) @@ -504,7 +550,7 @@ sub CleanupUCM() { $log->log($_) for @output; $status += DestroyView($test_intview); - + $log->msg('Removing '. $test_devstream->name); ($rc, @output) = $test_devstream->remove; @@ -594,19 +640,71 @@ sub SetupTest($$) { ($status, @output) = $Clearcase::CC->execute("cd $dir"); - if ($status != 0) { - $log->log($_) for @output; - } # if + $log->log($_) for @output; return $status; } # SetupTest +sub SetupAttributeTypes() { + my @CC_CMI_Types = qw(CONTEXT TASK PROVIDERS); + + my $status = SetView($test_intview); + + return $status if $status; + + for (@CC_CMI_Types) { + my $cmd = "mkattype -nc -vtype string CC_CMI_$_"; + + my ($rc, @output) = $Clearcase::CC->execute($cmd); + + $status += $rc; + + $log->log($_) for @output; + } # for + + return $status; +} # SetupAttributeTypes + +sub CRMRegister() { + my $cmd = "crmregister add -database $opts{database} -connection RDE " + . "-url $opts{weburl} -username $opts{username} " + . "-password $opts{password}"; + + my ($status, @output) = Execute $cmd; + + $log->log($_) for @output; + + return $status; +} # CRMRegister + +sub MakeCMProvider() { + my $cmd = 'mkcmprovider -vob ' . $test_pvob->tag + . '-type cmcq -version V1_0 -description ' + . '"RDE CMI CQ Provider" ' + . '-connection baseurl:' . $opts{weburl} . " $opts{provider}"; + + my ($status, @output) = $Clearcase::CC->execute($cmd); + + $log->log($_) for @output; + + return $status; +} # MakeCMProvider + sub SetupUCMTest() { my $status; - $log->msg("Creating UCM Pvob $Clearcase::VOBTAG_PREFIX/tc.pvob"); + $log->msg("Register RDE://$opts{username}\@$opts{database}"); + + $status = CRMRegister; + + $log->err("Unable to register RDE://$opts{username}\@$opts{database} - Check logfile", $status) + if $status; - ($status, $test_pvob) = CreatePvob("$Clearcase::VOBTAG_PREFIX/tc.pvob"); + $log->msg("Creating UCM Pvob ${Clearcase::VOBTAG_PREFIX}tc.pvob"); + + ($status, $test_pvob) = CreatePvob("${Clearcase::VOBTAG_PREFIX}tc.pvob"); + + MountVob $test_pvob; return $status; } # SetupUCMTest @@ -618,7 +716,7 @@ sub CreateUCMProject() { $test_project = Clearcase::UCM::Project->new('tc.project', $test_folder, $test_pvob); $test_project->remove if $test_project->exists; - + $log->msg('Creating UCM Project tc.project'); my ($status, @output) = $test_project->create; @@ -764,6 +862,7 @@ sub RunUCMTests() { $status += CreateUCMIntStream; $status += CreateUCMDevStream; $status += CreateUCMIntView; + $status += SetupAttributeTypes; $status += CreateUCMDevView; $status += CreateUCMComponent; $status += AddModifiableComponent; @@ -784,8 +883,18 @@ my $startTime = time; my $conf_file = "$FindBin::Bin/$script.conf"; my $status = 0; -$opts{base} = 1; -$opts{clean} = 1; +$opts{help} = sub { pod2usage }; +$opts{usage} = sub { pod2usage (-verbose => 2)}; +$opts{base} = 1; +$opts{clean} = 1; +$opts{username} = $ENV{CQ_USERNAME}; +$opts{password} = $ENV{CQ_PASSWORD}; +$opts{weburl} = $ENV{CQ_WEBURL}; + +$opts{weburl} .= $opts{weburl} ? "/oslc" : undef; +$opts{database} = $ENV{CQ_DATABASE}; +$opts{dbset} = $ENV{CQ_DBSET}; +$opts{provider} = $ENV{CQ_PROVIDER} || 'CQPROV'; GetOptions( \%opts, @@ -796,7 +905,11 @@ GetOptions( 'base!', 'ucm!', 'clean!', -) or Usage; + 'username=s', + 'database=s', + 'dbset=s', + 'provider', +) || pod2usage; # Read the config file if (-f $conf_file) { @@ -810,6 +923,13 @@ for (keys %default_opts) { $opts{$_} = $default_opts{$_} if !$opts{$_}; } # for +# Check CQ parameters +if ($opts{ucm}) { + for ('username', 'password', 'weburl', 'database', 'dbset', 'provider') { + pod2usage "In UCM mode you must specify -$_" unless $opts{$_}; + } # for +} # if + $log->msg("$script: Start"); LogOpts; @@ -817,10 +937,12 @@ LogOpts; # Since we are creating private vobs (to avoid complications with having to # know and code the registry password when making public vobs), we'll simply # change $Clearcase::VOBTAG_PREFIX -$Clearcase::VOBTAG_PREFIX = $ENV{TMP} || '/tmp'; +if ($ARCHITECTURE !~ /win/i) { + $Clearcase::VOBTAG_PREFIX = $ENV{TMP} . '/' || '/tmp'; +} # if if ($opts{base}) { - $status = SetupTest "$Clearcase::VOBTAG_PREFIX/tc.vob", 'tc.view'; + $status = SetupTest "${Clearcase::VOBTAG_PREFIX}tc.vob", 'tc.view'; if ($status == 0) { $status += RunTests; @@ -829,7 +951,7 @@ if ($opts{base}) { } # if # Note if we are doing UCM tests then we need the view and vob here... - $status += Cleanup($test_view, $test_vob) if $opts{clean} and !$opts{ucm}; + $status += Cleanup($test_view, $test_vob) if $opts{clean} && !$opts{ucm}; if ($status != 0) { $log->err("$script: Failed (Base Clearcase)"); @@ -885,11 +1007,9 @@ L L -L - =head2 ClearSCM Perl Modules -=begin man +=begin man Clearcase Clearcase::Element diff --git a/test/testclearquest.pl b/test/testclearquest.pl old mode 100755 new mode 100644 index 4197a87..df33056 --- a/test/testclearquest.pl +++ b/test/testclearquest.pl @@ -35,11 +35,11 @@ $Date: 2013/03/14 23:39:39 $ =head1 SYNOPSIS Usage: testclearquest.pl [-u|sage] [-v|erbose] [-d|ebug] - [-get] [-add] [-modify] [-change] [-delete] + [-get] [-add] [-modify] [-change] [-delete] [-username ] [-password ] [-database ] [-dbset ] [-module] [-server ] [-port ] - + Where: -usa|ge: Displays usage -v|erbose: Be verbose @@ -51,20 +51,13 @@ $Date: 2013/03/14 23:39:39 $ -change: Test change -delete: Test delete - -use|rname: Username to open database with (Default: from config file) - -p|assword: Password to open database with (Default: from config file) - -da|tabase: Database to open (Default: from config file) - -db|set: Database Set to use (Default: from config file) - -m|odule: Type of Clearquest module to use. Must be one of 'api', - 'client', or 'rest'. The 'api' module can only be used if - Clearquest is installed locally. The 'client' module can only - be successful if a corresponding server is running. And the - 'rest' module can only be used if a CQ Web server has been set - up and configured (Default: rest) - -s|erver: For module = client or rest this is the name of the server that - will be providing the service - -p|ort: For module = client, this is the point on the server to talk - through. + -use|rname: Username to open database with (Default: CQ_USERNAME or from + config file) + -p|assword: Password to open database with (Default: CQ_PASSWORD or from + config file) + -da|tabase: Database to open (Default: CQ_DATABASE or from config file) + -db|set: Database Set to use (Default: CQ_DBSET or from config file) + =head1 Options @@ -113,6 +106,7 @@ Database Set name (Default: From cq.conf) use FindBin; use Getopt::Long; +use Pod::Usage; use lib "$FindBin::Bin/../lib"; @@ -125,22 +119,23 @@ use Clearcase::UCM::Pvob; use DateUtils; use Display; use Logger; +use OSDep; use TimeUtils; use Utils; my ($cq, %opts, $log, $createView, $test_pvob, $test_project); -my $status = 0; +my $status = 0; my $project = 'tc.project'; sub displayRecord(%) { my (%record) = @_; - + $log->msg('-' x 79); - + for (keys %record) { $log->msg("$_: ", 1); - + if (ref $record{$_} eq 'ARRAY') { $log->msg(join ", ", @{$record{$_}}); } elsif ($record{$_}) { @@ -149,45 +144,45 @@ sub displayRecord(%) { $log->msg(''); } # if } # for - + return; } # displayRecord sub displayResults(@) { my (@records) = @_; - + if (@records) { displayRecord %$_ foreach (@records); } else { $log->msg('Did not find any records'); } # if - + return; } # displayResults sub GetRecord($$;@) { my ($table, $key, @fields) = @_; - + $log->msg("Gettng table: $table key: $key"); my %record = $cq->get($table, $key, @fields); - + if ($cq->checkErr) { $log->err($cq->errmsg); } else { displayRecord %record; } # if - + return $cq->error; } # GetRecord sub FindRecord($$;@) { my ($table, $condition, @fields) = @_; - + my $status; - + $log->msg("Finding table: $table condition: $condition"); - + my ($result, $nbrRecs) = $cq->find($table, $condition, @fields); $log->msg("$nbrRecs records qualified"); @@ -198,89 +193,89 @@ sub FindRecord($$;@) { $createView = $record{ws_cr_view} if $table eq 'Platform_Options'; displayRecord %record; - + $status += $cq->error; } # unless } # while - + return $status } # FindRecord sub ModifyRecord($$;%) { my ($table, $key, %update) = @_; - + $log->msg("Modifying table: $table key: $key"); - + $cq->modify($table, $key, undef, \%update); - + $log->err($cq->errmsg) if $cq->checkErr; - + return $cq->error; } # ModifyRecord sub AssignWOR($) { my ($key) = @_; - + my %record = $cq->get('WOR', $key, ('State')); - + return $cq->error if $cq->checkErr("Unable to find WOR where key = $key"); - + my ($action, %update); - + if ($record{State} ne 'Submitted') { $log->err("Cannot assign $key - not in submitted state"); - + return 1; } # if $action = 'Assign'; $update{PlannedStart} = Today2SQLDatetime; $update{ucm_project} = $project; - + $log->msg("Testing change WOR state of $key action: $action"); - + $cq->modify('WOR', $key, $action, \%update); $log->err($cq->errmsg) if $cq->checkErr; - + return $cq->error; } # AssignWOR sub ActivateWOR($) { my ($key) = @_; - + my %record = $cq->get('WOR', $key, ('State')); - + return $cq->error if $cq->checkErr("Unable to find WOR where key = $key"); - + my ($action, %update); - + if ($record{State} ne 'Assessing') { $log->err("Cannot activate $key - not in Assessing state"); - + return 1; } # if $action = 'Activate'; - + $log->msg("Testing change WOR state of $key action: $action"); - + $cq->modify('WOR', $key, $action); $log->err($cq->errmsg) if $cq->checkErr; - + return $cq->error; } # ActivateWOR sub AddRecord($$;$$) { my ($table, $record, $ordering, $returnField) = @_; - + $returnField ||= 'id'; $log->msg("Adding table: $table"); - + my $dbid = $cq->add($table, $record, @$ordering); - + if ($cq->checkErr) { $log->err($cq->errmsg); @@ -294,11 +289,11 @@ sub AddRecord($$;$$) { sub DeleteRecord($$) { my ($table, $key) = @_; - + $log->msg("Deleting table: $table key: $key"); - + $cq->delete($table, $key); - + $log->err($cq->errmsg) if $cq->checkErr; return $cq->error; @@ -318,7 +313,7 @@ sub CreateWOR() { RCLC_name => 'Test RCLC', Prod_Arch1 => 'testcode : N/A', work_product_name => '10 - Software', - Engr_target => 'Test Engineering Target', + #Engr_target => 'Test Engineering Target', work_code_name => 'RAN-RW2', ); @@ -393,32 +388,29 @@ sub Cleanup($) { ## Main GetOptions( \%opts, - usage => sub { Usage }, + usage => sub { pod2usage }, + help => sub { pod2usage (-verbose => 2)}, verbose => sub { set_verbose }, debug => sub { set_debug }, - 'verbose', - 'debug', - 'usage', 'get', 'add', 'modify', 'change', 'delete', - 'module=s', 'username=s', 'password=s', 'database=s', 'dbset=s', - 'server=s', - 'port=i', -) || Usage; +) || pod2usage; my $processStartTime = time; # Since we are creating private vobs (to avoid complications with having to # know and code the registry password when making public vobs), we'll simply # change $Clearcase::VOBTAG_PREFIX -$Clearcase::VOBTAG_PREFIX = $ENV{TMP} || '/tmp'; +if ($ARCHITECTURE !~ /win/i) { + $Clearcase::VOBTAG_PREFIX = $ENV{TMP} || '/tmp'; +} # if local $| = 1; @@ -457,11 +449,11 @@ $log->msg('Connecting to Clearquest database ' . $cq->connection . '...', 1); unless ($cq->connect) { $cq->checkErr('Unable to connect to database ' . $cq->connection, undef, $log); - + if ($cq->module eq 'client') { $log->msg('Unable to connect to server ' . $cq->server() . ':' . $cq->port()); } # if - + exit $cq->error; } else { $log->msg('connected'); @@ -510,10 +502,10 @@ DeleteRecord 'Component', $FindBin::Script if $opts{add}; $log->msg('Enable tc.project for integration with Clearquest'); -$test_pvob = Clearcase::UCM::Pvob->new("$Clearcase::VOBTAG_PREFIX/tc.pvob"); +$test_pvob = Clearcase::UCM::Pvob->new("${Clearcase::VOBTAG_PREFIX}tc.pvob"); $test_project = Clearcase::UCM::Project->new('tc.project', 'tc.folder', $test_pvob); -my ($rc, @output) = $test_project->change('-force -crmenable XTST1'); +my ($rc, @output) = $test_project->change("-force -crmenable $opts{CQ_DATABASE}"); $status += $rc; @@ -532,13 +524,23 @@ unless ($WORID) { } # unless if ($opts{change}) { - $status += AssignWOR $WORID; - $status += ActivateWOR $WORID; -} # if + my $worStatus; + + $worStatus += AssignWOR $WORID; + $worStatus += ActivateWOR $WORID; -$status += CreateView $WORID; + $status += $worStatus; -$status += Cleanup($WORID); + unless ($worStatus) { + # If we weren't able to assign and activate the WOR then there's no need + # to create the view and no need to clean up unless we created the view. + $worStatus = CreateView $WORID; + + $status += Cleanup($WORID) unless $worStatus; + + $status += $worStatus; + } # unless +} # if if ($status) { $log->err('Clearquest tests FAILED'); diff --git a/web/favicon.ico b/web/favicon.ico old mode 100755 new mode 100644 -- 2.17.1