Ensuring test files match dali-core/adaptor 23/251623/3
authorDavid Steele <david.steele@samsung.com>
Fri, 15 Jan 2021 18:21:39 +0000 (18:21 +0000)
committerDavid Steele <david.steele@samsung.com>
Fri, 15 Jan 2021 19:31:00 +0000 (19:31 +0000)
Change-Id: I8810c5d6f07a22cdecc7235916287f6be0ddf406

automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.h [new file with mode: 0644]
automated-tests/tcbuild [changed from symlink to file mode: 0755]

index 062276a..a2a1848 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -55,9 +55,7 @@ void TestApplication::CreateCore()
 
   mCore = Dali::Integration::Core::New(mRenderController,
                                        mPlatformAbstraction,
-                                       mGlAbstraction,
-                                       mGlSyncAbstraction,
-                                       mGlContextHelperAbstraction,
+                                       mGraphicsController,
                                        Integration::RenderToFrameBuffer::FALSE,
                                        Integration::DepthBufferAvailable::TRUE,
                                        Integration::StencilBufferAvailable::TRUE,
@@ -141,19 +139,24 @@ TestRenderController& TestApplication::GetRenderController()
   return mRenderController;
 }
 
+TestGraphicsController& TestApplication::GetGraphicsController()
+{
+  return mGraphicsController;
+}
+
 TestGlAbstraction& TestApplication::GetGlAbstraction()
 {
-  return mGlAbstraction;
+  return static_cast<TestGlAbstraction&>(mGraphicsController.GetGlAbstraction());
 }
 
 TestGlSyncAbstraction& TestApplication::GetGlSyncAbstraction()
 {
-  return mGlSyncAbstraction;
+  return static_cast<TestGlSyncAbstraction&>(mGraphicsController.GetGlSyncAbstraction());
 }
 
 TestGlContextHelperAbstraction& TestApplication::GetGlContextHelperAbstraction()
 {
-  return mGlContextHelperAbstraction;
+  return static_cast<TestGlContextHelperAbstraction&>(mGraphicsController.GetGlContextHelperAbstraction());
 }
 
 void TestApplication::ProcessEvent(const Integration::Event& event)
@@ -262,7 +265,7 @@ bool TestApplication::RenderOnly()
 void TestApplication::ResetContext()
 {
   mCore->ContextDestroyed();
-  mGlAbstraction.Initialize();
+  mGraphicsController.Initialize();
   mCore->ContextCreated();
 }
 
index 7362505..e7d8c76 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TEST_APPLICATION_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <dali/integration-api/resource-policies.h>
 #include <dali/integration-api/scene.h>
 #include <dali/integration-api/trace.h>
+
 #include <dali/public-api/common/dali-common.h>
 #include <test-platform-abstraction.h>
 
-#include "test-gl-abstraction.h"
-#include "test-gl-context-helper-abstraction.h"
-#include "test-gl-sync-abstraction.h"
+#include "test-graphics-controller.h"
 #include "test-render-controller.h"
 
 namespace Dali
@@ -58,27 +57,30 @@ public:
   void CreateScene();
   void InitializeCore();
   ~TestApplication() override;
-  static void                     LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message);
-  static void                     LogContext(bool start, const char* tag);
-  Dali::Integration::Core&        GetCore();
-  TestPlatformAbstraction&        GetPlatform();
-  TestRenderController&           GetRenderController();
+  static void              LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message);
+  static void              LogContext(bool start, const char* tag);
+  Dali::Integration::Core& GetCore();
+  TestPlatformAbstraction& GetPlatform();
+  TestRenderController&    GetRenderController();
+  TestGraphicsController&  GetGraphicsController();
+
   TestGlAbstraction&              GetGlAbstraction();
   TestGlSyncAbstraction&          GetGlSyncAbstraction();
   TestGlContextHelperAbstraction& GetGlContextHelperAbstraction();
-  void                            ProcessEvent(const Integration::Event& event);
-  void                            SendNotification();
-  bool                            Render(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location = NULL);
-  bool                            PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector<Rect<int>>& damagedRects);
-  bool                            RenderWithPartialUpdate(std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect);
-  uint32_t                        GetUpdateStatus();
-  bool                            UpdateOnly(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL);
-  bool                            RenderOnly();
-  void                            ResetContext();
-  bool                            GetRenderNeedsUpdate();
-  bool                            GetRenderNeedsPostRender();
-  uint32_t                        Wait(uint32_t durationToWait);
-  static void                     EnableLogging(bool enabled)
+
+  void        ProcessEvent(const Integration::Event& event);
+  void        SendNotification();
+  bool        Render(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location = NULL);
+  bool        PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector<Rect<int>>& damagedRects);
+  bool        RenderWithPartialUpdate(std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect);
+  uint32_t    GetUpdateStatus();
+  bool        UpdateOnly(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL);
+  bool        RenderOnly();
+  void        ResetContext();
+  bool        GetRenderNeedsUpdate();
+  bool        GetRenderNeedsPostRender();
+  uint32_t    Wait(uint32_t durationToWait);
+  static void EnableLogging(bool enabled)
   {
     mLoggingEnabled = enabled;
   }
@@ -92,11 +94,9 @@ private:
   void DoUpdate(uint32_t intervalMilliseconds, const char* location = NULL);
 
 protected:
-  TestPlatformAbstraction        mPlatformAbstraction;
-  TestRenderController           mRenderController;
-  TestGlAbstraction              mGlAbstraction;
-  TestGlSyncAbstraction          mGlSyncAbstraction;
-  TestGlContextHelperAbstraction mGlContextHelperAbstraction;
+  TestPlatformAbstraction mPlatformAbstraction;
+  TestRenderController    mRenderController;
+  TestGraphicsController  mGraphicsController;
 
   Integration::UpdateStatus mStatus;
   Integration::RenderStatus mRenderStatus;
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.h
new file mode 100644 (file)
index 0000000..f5ab764
--- /dev/null
@@ -0,0 +1,61 @@
+#ifndef TEST_GRAPHICS_CONTROLLER_H
+#define TEST_GRAPHICS_CONTROLLER_H
+
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dali/graphics-api/graphics-controller.h>
+#include "test-gl-abstraction.h"
+#include "test-gl-context-helper-abstraction.h"
+#include "test-gl-sync-abstraction.h"
+
+namespace Dali
+{
+class TestGraphicsController : public Dali::Graphics::Controller
+{
+public:
+  TestGraphicsController()          = default;
+  virtual ~TestGraphicsController() = default;
+
+  void Initialize()
+  {
+    mGlAbstraction.Initialize();
+  }
+
+  Integration::GlAbstraction& GetGlAbstraction() override
+  {
+    return mGlAbstraction;
+  }
+
+  Integration::GlSyncAbstraction& GetGlSyncAbstraction() override
+  {
+    return mGlSyncAbstraction;
+  }
+
+  Integration::GlContextHelperAbstraction& GetGlContextHelperAbstraction() override
+  {
+    return mGlContextHelperAbstraction;
+  }
+
+private:
+  TestGlAbstraction              mGlAbstraction;
+  TestGlSyncAbstraction          mGlSyncAbstraction;
+  TestGlContextHelperAbstraction mGlContextHelperAbstraction;
+};
+
+} // namespace Dali
+
+#endif //TEST_GRAPHICS_CONTROLLER_H
deleted file mode 120000 (symlink)
index 89c2de70cd166068877a43402f6f48217687e409..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-scripts/tcbuild.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..b60467501b00694f25867da76af3e0e797eea37f
--- /dev/null
@@ -0,0 +1,215 @@
+#!/bin/bash
+
+#---------- DEBUG_BEGIN ----------
+#ARG="-d" # debug-on flag, might be set as $1
+# keyprompt "introductory message" -- wait until any key pressed
+function keyprompt { echo -ne "\n\e[1;31m$1 -- " && read -n 1 && echo -e "\n\e[0m"; }
+# d_bp -- breakpoint at which user need to press any key to proceed
+function d_bp { if [[ "$ARG" == "-d" ]]; then keyprompt "d >> Press any key"; fi }
+# d_showVar VARNAME -- print bash variable name
+function d_showVar { if [ "$ARG" == "-d" -a -n "$1" ]; then echo "d >> ${1} = ${!1}"; fi }
+# d_print "message" -- print a debug message
+function d_print { if [ "$ARG" == "-d" -a -n "$1" ]; then echo -e "d >> $1"; fi }
+#----------  DEBUG_END  ----------
+
+PROJECT_DIR="$(cd "$(dirname $0)" && pwd)"
+d_showVar PROJECT_DIR
+
+function gbs_profile {
+perl -e "
+use Config::Tiny;
+my \$Config = Config::Tiny->read( \"\$ENV{HOME}/.gbs.conf\" );
+my \$profile = \$Config->{general}->{profile};
+\$profile =~ s/profile.//;
+print \$profile;"
+}
+
+PROFILE=`gbs_profile`
+RPM_DIR="$HOME/GBS-ROOT/local/repos/$PROFILE/armv7l/RPMS"
+d_showVar RPM_DIR
+
+function add_module {
+    # argument check
+    if [ -z "$1" ]; then echo "Usage: `basename $0` addmod <module_name> [module_lib_name]"; exit 1; fi
+
+    MODULE_NAME=$1
+    d_showVar MODULE_NAME
+    MODULE_NAME_C=$(echo $MODULE_NAME | sed -e 's/-\([a-z]\)/\U\1/' -e 's/^\([a-z]\)/\U\1/')
+    d_showVar MODULE_NAME_C
+    MODULE_NAME_U=$(echo $MODULE_NAME | sed -e 's/-/_/')
+    d_showVar MODULE_NAME_U
+#    MODULE_LIBNAME=${2:-capi-$MODULE_NAME}
+    MODULE_LIBNAME=$1
+    d_showVar MODULE_LIBNAME
+
+    echo "Adding $MODULE_NAME module to project..."
+    d_bp
+    cd $PROJECT_DIR
+    # prepare .spec file
+    echo "-- Generating packaging/core-$MODULE_NAME-tests.spec file"
+    if [ ! -d packaging ]; then mkdir packaging; fi
+    sed -e "s:\[MODULE_NAME\]:$MODULE_NAME:g" -e "s:\[MODULE_LIBNAME\]:$MODULE_LIBNAME:g" \
+        templates/core-\[module_name\]-tests.spec > packaging/core-$MODULE_NAME-tests.spec
+    # prepare src directory
+    mkdir src/$MODULE_NAME
+    echo "-- Generating src/$MODULE_NAME/CMakeLists.txt file"
+    sed -e "s:%{MODULE_NAME}:$MODULE_NAME:g" -e "s:%{MODULE_LIBNAME}:$MODULE_LIBNAME:g" \
+        templates/src-directory/CMakeLists.txt > src/$MODULE_NAME/CMakeLists.txt
+    echo "-- Generating src/$MODULE_NAME/tct-$MODULE_NAME-core.c file"
+    sed -e "s:%{MODULE_NAME}:$MODULE_NAME:g" \
+        templates/src-directory/tct-\[module_name\]-core.c > src/$MODULE_NAME/tct-$MODULE_NAME-core.c
+    echo "-- Generating src/$MODULE_NAME/utc-$MODULE_NAME.c file"
+    sed -e "s:%{MODULE_NAME_U}:$MODULE_NAME_U:g" -e "s:%{MODULE_NAME_C}:$MODULE_NAME_C:g" \
+        templates/src-directory/utc-\[module_name\].c > src/$MODULE_NAME/utc-$MODULE_NAME.c
+    echo "Task finished successfully"
+}
+
+function rm_module {
+    # argument check
+    if [ -z "$1" ]; then echo "Usage: `basename $0` rmmod <module_name>"; exit 1; fi
+
+    MODULE_NAME=$1
+    d_showVar MODULE_NAME
+
+    echo "Removing $MODULE_NAME module from project..."
+    d_bp
+    echo "---- Updating /opt/tct/packages/package_list.xml"
+    scripts/tcpackageslistsgen.sh $MODULE_NAME /opt/tct/packages/package_list.xml 1
+    if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi
+   # echo "---- Updating test plans"
+   # scripts/tcpackageslistsgen.sh $MODULE_NAME /opt/tct/manager/plan/*.xml 1
+   # if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi
+
+    cd $PROJECT_DIR
+    echo "-- Removing packaging/core-$MODULE_NAME-tests.spec file"
+    rm packaging/core-$MODULE_NAME-tests.spec
+    echo "-- Removing src/$MODULE_NAME directory"
+    rm -r src/$MODULE_NAME
+    echo "Task finished successfully"
+}
+
+function build {
+    if [ -n "$1" ]; then
+        (cd src/$1; ../../scripts/tcheadgen.sh tct-$1-core.h)
+        if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi
+        cp packaging/core-$1-tests.spec ../packaging
+        cp .gitignore-without-autogenerated-files .gitignore
+        gbs build -A armv7l --spec core-$1-tests.spec --include-all --keep-packs | \
+            tee build.log | stdbuf -o0 sed -e 's/error:/\x1b[1;91m&\x1b[0m/' \
+                                           -e 's/warning:/\x1b[93m&\x1b[0m/'
+        rm ../packaging/core-$1-tests.spec
+        cp .gitignore-with-autogenerated-files .gitignore
+    else
+        echo "Build requires a module name"
+        exit 1
+    fi
+}
+
+function inst {
+    if [ -z "$1" ]
+    then
+        for mod in `ls -1 src/ | grep -v CMakeLists`
+        do
+
+       if [ $mod != 'common' ] && [ $mod != 'manual' ]; then
+
+            PKG_NAME="core-$mod-tests"
+            d_showVar PKG_NAME
+            VER=$(cat packaging/$PKG_NAME.spec | awk '/^Version:/ { print $2; exit; }')
+            d_showVar VER
+            PKG_VNAME="$PKG_NAME-$VER"
+            d_showVar PKG_VNAME
+            PKG_FNAME="$PKG_VNAME-0.armv7l.rpm"
+            d_showVar PKG_FNAME
+
+            if [ -f "$RPM_DIR/$PKG_FNAME" ]
+            then
+                inst $mod
+                echo ""
+            fi
+       fi
+        done
+    else
+        cd $PROJECT_DIR
+        # setting variables
+        MOD_NAME="$1"
+        d_showVar MOD_NAME
+        PKG_NAME="core-$MOD_NAME-tests"
+        d_showVar PKG_NAME
+        VER=$(cat packaging/$PKG_NAME.spec | awk '/^Version:/ { print $2; exit; }')
+        d_showVar VER
+        PKG_VNAME="$PKG_NAME-$VER"
+        d_showVar PKG_VNAME
+        PKG_FNAME="$PKG_VNAME-0.armv7l.rpm"
+        d_showVar PKG_FNAME
+        TCT_DIR="opt/tct-$MOD_NAME-core-tests"
+        d_showVar TCT_DIR
+
+        echo "Deploying $MOD_NAME suite to tct-mgr..."
+        d_bp
+        # prepare tct directory and files
+        echo "-- Preparing suite .zip file..."
+        echo "---- Creating /tmp/$TCT_DIR directory"
+        rm -r /tmp/opt > /dev/null 2>&1
+        mkdir -p /tmp/$TCT_DIR
+        # README
+        echo "---- Copying /tmp/$TCT_DIR"
+        cp templates/tct-package/README /tmp/$TCT_DIR
+        # rpm
+        echo "---- Copying /tmp/$TCT_DIR package"
+        cp $RPM_DIR/$PKG_FNAME /tmp/$TCT_DIR
+        if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi
+        # inst.sh
+        echo "---- Generating /tmp/$TCT_DIR/inst.sh file"
+        sed -e "s:%{PKG_NAME}:\"$PKG_NAME\":g" -e "s:%{PKG_FULLNAME}:\"$PKG_FNAME\":g" \
+            -e "s:%{PKG_DIR}:\"/opt/usr/media/tct/$TCT_DIR\":g" \
+            templates/tct-package/inst.sh > /tmp/$TCT_DIR/inst.sh
+        chmod a+x /tmp/$TCT_DIR/inst.sh
+        # tests.xml
+        echo "---- Generating /tmp/$TCT_DIR"
+        scripts/tctestsgen.sh $MOD_NAME /tmp/$TCT_DIR target
+        if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi
+        # zip
+        echo "---- Preparing /tmp/tct/packages/tct-$MOD_NAME-core-tests-2.2.1-1.zip file"
+        # clear old zips
+        rm -r /tmp/tct/packages > /dev/null 2>&1
+        mkdir -p /tmp/tct/packages
+        # create new zip
+        ( cd /tmp; zip -r /tmp/tct/packages/tct-$MOD_NAME-core-tests-2.2.1-1.zip opt > /dev/null 2>&1; )
+        # deployment
+        echo "-- Suite deployment..."
+        echo "---- Copying /opt/tct/packages/tct-$MOD_NAME-core-tests-2.2.1-1.zip"
+        cp /tmp/tct/packages/tct-$MOD_NAME-core-tests-2.2.1-1.zip /opt/tct/packages/
+        echo "---- Updating /opt/tct/packages/package_list.xml"
+        scripts/tcpackageslistsgen.sh $MOD_NAME /opt/tct/packages/package_list.xml 0
+        if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi
+       # echo "---- Updating test plans"
+       # for file in `grep -r tct-$MOD_NAME-core-tests /opt/tct/manager/plan/ | cut -d: -f1 | uniq`
+       # do
+       #     scripts/tcpackageslistsgen.sh $MOD_NAME $file
+       # done
+       # scripts/tcpackageslistsgen.sh $MOD_NAME /opt/tct/manager/plan/Full_test.xml
+       # if [ $? -ne 0 ]; then echo "Aborting..."; exit 1; fi
+        echo "Task finished successfully"
+    fi
+}
+
+if [ -z "$1" ]; then
+    # usage note
+    echo "Usage: `basename $0` <addmod|rmmod|build|install> <module_name> [module_lib_name]"
+    exit 1
+elif [ "addmod" == "$1" ]; then
+    # add new module
+    add_module $2 $3
+elif [ "rmmod" == "$1" ]; then
+    # remove module
+    rm_module $2
+elif [ "build" == "$1" ]; then
+    # build the binary
+    build $2
+elif [ "install" == "$1" ]; then
+    # install
+    inst $2
+else
+    echo "Invalid subcommand: $1"
+fi