@@ -943,6 +943,37 @@ TEST_F(ProjMgrUnitTests, RunProjMgrSolution_LockPackVersion) {
943943 RteFsUtils::RemoveFile (cbuildPackBackup);
944944}
945945
946+
947+ TEST_F (ProjMgrUnitTests, RunProjMgrSolution_LockPackVersionUpgrade) {
948+ char * argv[6 ];
949+
950+ // convert --solution solution.yml
951+ const string csolution = testinput_folder + " /TestSolution/PackLocking/lock_pack_version_upgrade.csolution.yml" ;
952+ const string cbuildPack = testinput_folder + " /TestSolution/PackLocking/lock_pack_version_upgrade.cbuild-pack.yml" ;
953+
954+ string buf1;
955+ RteFsUtils::ReadFile (cbuildPack, buf1);
956+
957+ const string output = testoutput_folder + " /testpacklock" ;
958+ argv[1 ] = (char *)" convert" ;
959+ argv[2 ] = (char *)" --solution" ;
960+ argv[3 ] = (char *)csolution.c_str ();
961+ argv[4 ] = (char *)" -o" ;
962+ argv[5 ] = (char *)output.c_str ();
963+ EXPECT_EQ (0 , RunProjMgr (6 , argv, m_envp));
964+
965+ string buf2;
966+ RteFsUtils::ReadFile (cbuildPack, buf2);
967+ RteUtils::ReplaceAll (buf2, " \r\n " , " \n " );
968+ // Check that the cbuild-pack file has been modified by this operation to reflect version change in csolution.yml
969+ EXPECT_NE (buf2, buf1); // expected 0.0.1 != 0.2.0
970+
971+ // replace buf1 versions with expected values
972+ RteUtils::ReplaceAll (buf1, " @0.1.1" , " @0.2.0" );
973+ EXPECT_EQ (buf2, buf1);
974+ }
975+
976+
946977TEST_F (ProjMgrUnitTests, RunProjMgrSolution_MultiplePackEntries) {
947978 char * argv[3 ];
948979 const string csolution = testinput_folder + " /TestSolution/PackLocking/multiple_pack_entries.csolution.yml" ;
@@ -1502,8 +1533,7 @@ TEST_F(ProjMgrUnitTests, RunProjMgrSolution_LockedPackVersionNotChangedByAddedPa
15021533 argv[3 ] = (char *)csolution.c_str ();
15031534 argv[4 ] = (char *)" -o" ;
15041535 argv[5 ] = (char *)output.c_str ();
1505- argv[6 ] = (char *)" --cbuildgen" ;
1506- EXPECT_EQ (0 , RunProjMgr (7 , argv, m_envp));
1536+ EXPECT_EQ (0 , RunProjMgr (6 , argv, m_envp));
15071537
15081538 // Check that the cbuild-pack file contains both packs and that the first still has the same version
15091539 EXPECT_TRUE (RteFsUtils::ReadFile (cbuildPack, buf));
0 commit comments