rase errr when no latest commit exist only if use uselatest option 81/15981/1
authorHyoun Jiil <jiil.hyoun@samsung.com>
Tue, 4 Feb 2014 01:25:45 +0000 (10:25 +0900)
committerHyoun Jiil <jiil.hyoun@samsung.com>
Tue, 4 Feb 2014 01:25:45 +0000 (10:25 +0900)
[Description]

Change-Id: Icf643e9f375159c84e21a8f4320c51ab0dc605b4
Signed-off-by: Hyoun Jiil <jiil.hyoun@samsung.com>
src/build_server/BuildServerException.rb
src/build_server/SocketJobRequestListener.rb
test/build-server.basic1/build-cli-43.testcase
test/build-server.basic1/build-cli-44.testcase [new file with mode: 0644]
test/build-server.basic1/testsuite
test/git01/newbinary.tar.gz [new file with mode: 0644]

index 762c2cb46b117702d37af51aa2b5f03f7e90ccd3..05191a5dbda48aa50c84693cf74a2ac6d926cdbb 100644 (file)
@@ -28,6 +28,7 @@ class BuildServerException < Exception
                "ERR022" => "There already exists same job.",
                "ERR023" => "Cannot create package client!",
                "ERR024" => "Attribute not supports!",
+               "ERR025" => "no latest commit exists",
 
                "ERR100" => "Package info file(\"package/pkginfo.manifest\") does not exist!",
                "ERR101" => "Parsing package info file failed!",
index 2241835eb370c20b5fb9160c2827db4e38541e9e..1a3f18b4307439fc34c4f88eeadb318bc200f5e2 100644 (file)
@@ -272,7 +272,12 @@ class SocketJobRequestListener
                                        else
                                                new_job.user_id = user_id
                         if uselatest then
-                            new_job.git_commit = get_latest_commit(pname, dist_name)
+                            commitId = get_latest_commit(pname, dist_name)
+                            if commitId.nil? then
+                                raise BuildServerException.new("ERR025"), pname
+                            else
+                                new_job.git_commit = commitId
+                            end
                         end
                                        end
                                        new_job_list.push new_job
@@ -320,14 +325,19 @@ class SocketJobRequestListener
                        if new_job.nil? then
                                raise BuildServerException.new("ERR006"), "\"#{pname}\" does not support #{os} in #{dist_name}"
                        else
-                               new_job.user_id = user_id
+                new_job.user_id = user_id
                 if uselatest then
-                    new_job.git_commit = get_latest_commit(pname, dist_name)
+                    commitId = get_latest_commit(pname, dist_name)
+                    if commitId.nil? then
+                        raise BuildServerException.new("ERR025"), pname
+                    else
+                        new_job.git_commit = commitId
+                    end
                 end
-                       end
-               else
-                       raise BuildServerException.new("ERR006"), "Cannot find your project to build!"
-               end
+            end
+        else
+            raise BuildServerException.new("ERR006"), "Cannot find your project to build!"
+        end
 
                # check reverse build
                if no_reverse then new_job.set_no_reverse end
index aa7f45843537459a19233cfd5c3d95c926e3574d..7e966d133a0eb5fd7b4ba97ce998b3256e74a95a 100644 (file)
@@ -79,4 +79,3 @@ Info: Snapshot:
 Info: Job is completed!
 Info: Job is FINISHED successfully!
 Info: Updating the source info for project "binary"
-
diff --git a/test/build-server.basic1/build-cli-44.testcase b/test/build-server.basic1/build-cli-44.testcase
new file mode 100644 (file)
index 0000000..378633b
--- /dev/null
@@ -0,0 +1,9 @@
+#PRE-EXEC
+echo "register noreverse "
+cd git01;tar xf newbinary.tar.gz
+../../build-svr add-prj -n testserver3 -N newbinary -g `pwd`/git01/newbinary -b master
+#EXEC
+../../build-cli build -N newbinary -d 127.0.0.1:2223 -U admin@user -w 1234 --uselatest
+#POST-EXEC
+#EXPECT
+Error: Error: no latest commit exists: newbinary
index dc7390258822fdd57181937468fb711be72f1f24..562420db4274233839b4c141ddb0e7d03513b7e4 100644 (file)
@@ -41,3 +41,4 @@ build-cli-40.testcase
 build-cli-41.testcase
 build-cli-42.testcase
 build-cli-43.testcase
+build-cli-44.testcase
diff --git a/test/git01/newbinary.tar.gz b/test/git01/newbinary.tar.gz
new file mode 100644 (file)
index 0000000..9102737
Binary files /dev/null and b/test/git01/newbinary.tar.gz differ